summaryrefslogtreecommitdiff
path: root/starmath/source/parse.cxx
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2001-11-20 09:08:19 +0000
committerThomas Lange <tl@openoffice.org>2001-11-20 09:08:19 +0000
commit8e9a562b86a77aae266ac2c7f22215a8ca5ad88b (patch)
treea32fb8a12038da45dde2443b8435b141dfffbb16 /starmath/source/parse.cxx
parent7a0f492d893288a4734f1261f33387fdc1f46413 (diff)
#94931# allowing for missing symbol-names after '' character
Diffstat (limited to 'starmath/source/parse.cxx')
-rw-r--r--starmath/source/parse.cxx34
1 files changed, 25 insertions, 9 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 52385fb84166..d58f8a169c7c 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: parse.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: tl $ $Date: 2001-09-11 09:19:55 $
+ * last change: $Author: tl $ $Date: 2001-11-20 10:08:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -728,19 +728,35 @@ void SmParser::NextToken()
xub_StrLen nTmpStart = rnEndPos +
(xub_StrLen) aTmpRes.LeadingWhiteSpace;
- INT32 n = aTmpRes.EndPos - nTmpStart;
- CurToken.eType = TSPECIAL;
+ // default setting fo the case that no identifier
+ // i.e. a valid symbol-name is following the '%'
+ // character
+ CurToken.eType = TTEXT;
CurToken.cMathChar = '\0';
CurToken.nGroup = 0;
CurToken.nLevel = 5;
- CurToken.aText = BufferString.Copy( nTmpStart, n );
+ CurToken.aText = String();
CurToken.nRow = Row;
CurToken.nCol = nTmpStart - ColOff + 1;
- if (aTmpRes.EndPos > rnEndPos)
- rnEndPos = aTmpRes.EndPos;
- else
- ++rnEndPos;
+ if (aTmpRes.TokenType & KParseType::IDENTNAME)
+ {
+
+ INT32 n = aTmpRes.EndPos - nTmpStart;
+ CurToken.eType = TSPECIAL;
+ CurToken.aText = BufferString.Copy( nTmpStart, n );
+
+ DBG_ASSERT( aTmpRes.EndPos > rnEndPos,
+ "empty identifier" );
+ if (aTmpRes.EndPos > rnEndPos)
+ rnEndPos = aTmpRes.EndPos;
+ else
+ ++rnEndPos;
+ }
+
+ // if no symbol-name was found we start-over with
+ // finding the next token right afer the '%' sign.
+ // I.e. we leave rnEndPos unmodified.
}
break;
case '[':