[Libreoffice-commits] core.git: starmath/inc starmath/source

Takeshi Abe tabe at fixedpoint.jp
Thu Mar 9 01:56:01 UTC 2017


 starmath/inc/starmath.hrc |   10 +++++++---
 starmath/source/parse.cxx |   26 ++++++++++++++++----------
 starmath/source/smres.src |   33 +++++++++++++++++++++++++++++----
 3 files changed, 52 insertions(+), 17 deletions(-)

New commits:
commit 945f0eb76c645a27c5b19466ed7a0b2bfc6cb9c5
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Mar 8 23:22:37 2017 +0900

    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 at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc
index 1d83abf..a09ebec 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 329bd9f..cf1dcc8 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 69252a5..a67c1aa 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" ;


More information about the Libreoffice-commits mailing list