summaryrefslogtreecommitdiff
path: root/starmath/source/parse.cxx
diff options
context:
space:
mode:
authordante <dante19031999@gmail.com>2021-02-05 16:27:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-02-06 20:53:22 +0100
commit96e9870b3204eabc6bca1c92f714f80592a54102 (patch)
treebf0cdb9c3b94f924eab4ece2114ec96d3e370d87 /starmath/source/parse.cxx
parentd76b9cc0e96e06777c683ba172e04454c8893c84 (diff)
Use multichar operators
There are no functional changes, only type change. This patch unlocks other possibilities like: - Syntax highlight for errors - Visual editor for structure nodes - Implement some mathml features Change-Id: I76a1b62126ae5fcb6a7285b07b24e9defa63fd44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110481 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath/source/parse.cxx')
-rw-r--r--starmath/source/parse.cxx94
1 files changed, 47 insertions, 47 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index fbf27478d2c7..68aab9e8dc77 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -476,7 +476,7 @@ void SmParser::NextToken() //Central part of the parser
if (nRealStart >= nBufLen)
{
m_aCurToken.eType = TEND;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText.clear();
@@ -494,7 +494,7 @@ void SmParser::NextToken() //Central part of the parser
sal_Int32 n = aRes.EndPos - nRealStart;
assert(n >= 0);
m_aCurToken.eType = TNUMBER;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = m_aBufferString.copy( nRealStart, n );
@@ -504,7 +504,7 @@ void SmParser::NextToken() //Central part of the parser
else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING)
{
m_aCurToken.eType = TTEXT;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = aRes.DequotedNameOrString;
@@ -521,7 +521,7 @@ void SmParser::NextToken() //Central part of the parser
if (pEntry)
{
m_aCurToken.eType = pEntry->eType;
- m_aCurToken.cMathChar = pEntry->cMathChar;
+ m_aCurToken.setChar(pEntry->cMathChar);
m_aCurToken.nGroup = pEntry->nGroup;
m_aCurToken.nLevel = pEntry->nLevel;
m_aCurToken.aText = pEntry->pIdent;
@@ -529,7 +529,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TIDENT;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = aName;
@@ -540,7 +540,7 @@ void SmParser::NextToken() //Central part of the parser
else if (aRes.TokenType == 0 && '_' == m_aBufferString[ nRealStart ])
{
m_aCurToken.eType = TRSUB;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Power;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "_";
@@ -560,7 +560,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("<<", nRealStart))
{
m_aCurToken.eType = TLL;
- m_aCurToken.cMathChar = MS_LL;
+ m_aCurToken.setChar(MS_LL);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<<";
@@ -570,7 +570,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<=", nRealStart))
{
m_aCurToken.eType = TLE;
- m_aCurToken.cMathChar = MS_LE;
+ m_aCurToken.setChar(MS_LE);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<=";
@@ -580,7 +580,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<-", nRealStart))
{
m_aCurToken.eType = TLEFTARROW;
- m_aCurToken.cMathChar = MS_LEFTARROW;
+ m_aCurToken.setChar(MS_LEFTARROW);
m_aCurToken.nGroup = TG::Standalone;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "<-";
@@ -590,7 +590,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<>", nRealStart))
{
m_aCurToken.eType = TNEQ;
- m_aCurToken.cMathChar = MS_NEQ;
+ m_aCurToken.setChar(MS_NEQ);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<>";
@@ -600,7 +600,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<?>", nRealStart))
{
m_aCurToken.eType = TPLACE;
- m_aCurToken.cMathChar = MS_PLACE;
+ m_aCurToken.setChar(MS_PLACE);
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "<?>";
@@ -610,7 +610,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TLT;
- m_aCurToken.cMathChar = MS_LT;
+ m_aCurToken.setChar(MS_LT);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<";
@@ -622,7 +622,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match(">=", nRealStart))
{
m_aCurToken.eType = TGE;
- m_aCurToken.cMathChar = MS_GE;
+ m_aCurToken.setChar(MS_GE);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = ">=";
@@ -632,7 +632,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match(">>", nRealStart))
{
m_aCurToken.eType = TGG;
- m_aCurToken.cMathChar = MS_GG;
+ m_aCurToken.setChar(MS_GG);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = ">>";
@@ -642,7 +642,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TGT;
- m_aCurToken.cMathChar = MS_GT;
+ m_aCurToken.setChar(MS_GT);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = ">";
@@ -684,7 +684,7 @@ void SmParser::NextToken() //Central part of the parser
// i.e. a valid symbol-name is following the '%'
// character
m_aCurToken.eType = TTEXT;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText ="%";
@@ -714,7 +714,7 @@ void SmParser::NextToken() //Central part of the parser
case '[':
{
m_aCurToken.eType = TLBRACKET;
- m_aCurToken.cMathChar = MS_LBRACKET;
+ m_aCurToken.setChar(MS_LBRACKET);
m_aCurToken.nGroup = TG::LBrace;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "[";
@@ -723,7 +723,7 @@ void SmParser::NextToken() //Central part of the parser
case '\\':
{
m_aCurToken.eType = TESCAPE;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "\\";
@@ -732,7 +732,7 @@ void SmParser::NextToken() //Central part of the parser
case ']':
{
m_aCurToken.eType = TRBRACKET;
- m_aCurToken.cMathChar = MS_RBRACKET;
+ m_aCurToken.setChar(MS_RBRACKET);
m_aCurToken.nGroup = TG::RBrace;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "]";
@@ -741,7 +741,7 @@ void SmParser::NextToken() //Central part of the parser
case '^':
{
m_aCurToken.eType = TRSUP;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Power;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "^";
@@ -750,7 +750,7 @@ void SmParser::NextToken() //Central part of the parser
case '`':
{
m_aCurToken.eType = TSBLANK;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Blank;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "`";
@@ -759,7 +759,7 @@ void SmParser::NextToken() //Central part of the parser
case '{':
{
m_aCurToken.eType = TLGROUP;
- m_aCurToken.cMathChar = MS_LBRACE;
+ m_aCurToken.setChar(MS_LBRACE);
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "{";
@@ -768,7 +768,7 @@ void SmParser::NextToken() //Central part of the parser
case '|':
{
m_aCurToken.eType = TOR;
- m_aCurToken.cMathChar = MS_OR;
+ m_aCurToken.setChar(MS_OR);
m_aCurToken.nGroup = TG::Sum;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "|";
@@ -777,7 +777,7 @@ void SmParser::NextToken() //Central part of the parser
case '}':
{
m_aCurToken.eType = TRGROUP;
- m_aCurToken.cMathChar = MS_RBRACE;
+ m_aCurToken.setChar(MS_RBRACE);
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "}";
@@ -786,7 +786,7 @@ void SmParser::NextToken() //Central part of the parser
case '~':
{
m_aCurToken.eType = TBLANK;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Blank;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "~";
@@ -797,7 +797,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("##", nRealStart))
{
m_aCurToken.eType = TDPOUND;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "##";
@@ -807,7 +807,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TPOUND;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "#";
@@ -817,7 +817,7 @@ void SmParser::NextToken() //Central part of the parser
case '&':
{
m_aCurToken.eType = TAND;
- m_aCurToken.cMathChar = MS_AND;
+ m_aCurToken.setChar(MS_AND);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "&";
@@ -826,7 +826,7 @@ void SmParser::NextToken() //Central part of the parser
case '(':
{
m_aCurToken.eType = TLPARENT;
- m_aCurToken.cMathChar = MS_LPARENT;
+ m_aCurToken.setChar(MS_LPARENT);
m_aCurToken.nGroup = TG::LBrace;
m_aCurToken.nLevel = 5; //! 0 to continue expression
m_aCurToken.aText = "(";
@@ -835,7 +835,7 @@ void SmParser::NextToken() //Central part of the parser
case ')':
{
m_aCurToken.eType = TRPARENT;
- m_aCurToken.cMathChar = MS_RPARENT;
+ m_aCurToken.setChar(MS_RPARENT);
m_aCurToken.nGroup = TG::RBrace;
m_aCurToken.nLevel = 0; //! 0 to terminate expression
m_aCurToken.aText = ")";
@@ -844,7 +844,7 @@ void SmParser::NextToken() //Central part of the parser
case '*':
{
m_aCurToken.eType = TMULTIPLY;
- m_aCurToken.cMathChar = MS_MULTIPLY;
+ m_aCurToken.setChar(MS_MULTIPLY);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "*";
@@ -855,7 +855,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("+-", nRealStart))
{
m_aCurToken.eType = TPLUSMINUS;
- m_aCurToken.cMathChar = MS_PLUSMINUS;
+ m_aCurToken.setChar(MS_PLUSMINUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "+-";
@@ -865,7 +865,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TPLUS;
- m_aCurToken.cMathChar = MS_PLUS;
+ m_aCurToken.setChar(MS_PLUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "+";
@@ -877,7 +877,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("-+", nRealStart))
{
m_aCurToken.eType = TMINUSPLUS;
- m_aCurToken.cMathChar = MS_MINUSPLUS;
+ m_aCurToken.setChar(MS_MINUSPLUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "-+";
@@ -887,7 +887,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("->", nRealStart))
{
m_aCurToken.eType = TRIGHTARROW;
- m_aCurToken.cMathChar = MS_RIGHTARROW;
+ m_aCurToken.setChar(MS_RIGHTARROW);
m_aCurToken.nGroup = TG::Standalone;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "->";
@@ -897,7 +897,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TMINUS;
- m_aCurToken.cMathChar = MS_MINUS;
+ m_aCurToken.setChar(MS_MINUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "-";
@@ -913,7 +913,7 @@ void SmParser::NextToken() //Central part of the parser
// texts like .34 ...56 ... h ...78..90
// will be treated as numbers
m_aCurToken.eType = TNUMBER;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
@@ -937,7 +937,7 @@ void SmParser::NextToken() //Central part of the parser
case '/':
{
m_aCurToken.eType = TDIVIDEBY;
- m_aCurToken.cMathChar = MS_SLASH;
+ m_aCurToken.setChar(MS_SLASH);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "/";
@@ -946,7 +946,7 @@ void SmParser::NextToken() //Central part of the parser
case '=':
{
m_aCurToken.eType = TASSIGN;
- m_aCurToken.cMathChar = MS_ASSIGN;
+ m_aCurToken.setChar(MS_ASSIGN);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "=";
@@ -963,7 +963,7 @@ void SmParser::NextToken() //Central part of the parser
if (!bHandled)
{
m_aCurToken.eType = TCHARACTER;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
@@ -1043,7 +1043,7 @@ void SmParser::NextTokenColor(bool dvipload)
if( m_aBufferString[ nRealStart ] == '#' && !m_aBufferString.match("##", nRealStart) )
{
m_aCurToken.eType = THEX;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Color;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "hex";
@@ -1117,28 +1117,28 @@ void SmParser::NextTokenFontSize()
{
case '*':
m_aCurToken.eType = TMULTIPLY;
- m_aCurToken.cMathChar = MS_MULTIPLY;
+ m_aCurToken.setChar(MS_MULTIPLY);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "*";
break;
case '+':
m_aCurToken.eType = TPLUS;
- m_aCurToken.cMathChar = MS_PLUS;
+ m_aCurToken.setChar(MS_PLUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "+";
break;
case '-':
m_aCurToken.eType = TMINUS;
- m_aCurToken.cMathChar = MS_MINUS;
+ m_aCurToken.setChar(MS_MINUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "-";
break;
case '/':
m_aCurToken.eType = TDIVIDEBY;
- m_aCurToken.cMathChar = MS_SLASH;
+ m_aCurToken.setChar(MS_SLASH);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "/";
@@ -1156,7 +1156,7 @@ void SmParser::NextTokenFontSize()
sal_Int32 n = aRes.EndPos - nRealStart;
assert(n >= 0);
m_aCurToken.eType = THEX;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = m_aBufferString.copy( nRealStart, n );
@@ -2001,7 +2001,7 @@ std::unique_ptr<SmStructureNode> SmParser::DoUnOper()
// we'll use row & column of the keyword for abs
aNodeToken.eType = TABS;
- aNodeToken.cMathChar = MS_VERTLINE;
+ aNodeToken.setChar(MS_VERTLINE);
std::unique_ptr<SmNode> xLeft(new SmMathSymbolNode(aNodeToken));
std::unique_ptr<SmNode> xRight(new SmMathSymbolNode(aNodeToken));