summaryrefslogtreecommitdiff
path: root/starmath/source/parse.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/source/parse.cxx')
-rw-r--r--starmath/source/parse.cxx995
1 files changed, 501 insertions, 494 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 6a649d0e5c..13f0242593 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -85,8 +85,8 @@ SmToken::SmToken() :
SmToken::SmToken(SmTokenType eTokenType,
sal_Unicode cMath,
const sal_Char* pText,
- ULONG nTokenGroup,
- USHORT nTokenLevel) {
+ sal_uLong nTokenGroup,
+ sal_uInt16 nTokenLevel) {
eType = eTokenType;
cMathChar = cMath;
aText.AssignAscii(pText);
@@ -315,8 +315,8 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName )
const SmTokenTableEntry * pRes = 0;
if (rName.Len())
{
- INT32 nEntries = SAL_N_ELEMENTS(aTokenTable);
- for (INT32 i = 0; i < nEntries; ++i)
+ sal_Int32 nEntries = SAL_N_ELEMENTS(aTokenTable);
+ for (sal_Int32 i = 0; i < nEntries; ++i)
{
if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent ))
{
@@ -351,7 +351,7 @@ bool SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos )
break;
- INT16 nTypJp = SM_MOD()->GetSysLocale().GetCharClass().getType( rTxt, nPos );
+ sal_Int16 nTypJp = SM_MOD()->GetSysLocale().GetCharClass().getType( rTxt, nPos );
bool bIsDelim = (*pDelim != 0 ||
nTypJp == com::sun::star::i18n::UnicodeType::SPACE_SEPARATOR ||
nTypJp == com::sun::star::i18n::UnicodeType::CONTROL);
@@ -361,24 +361,24 @@ bool SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos )
#endif
-void SmParser::Insert(const String &rText, USHORT nPos)
+void SmParser::Insert(const String &rText, sal_uInt16 nPos)
{
- BufferString.Insert(rText, nPos);
+ m_aBufferString.Insert(rText, nPos);
xub_StrLen nLen = rText.Len();
- BufferIndex = BufferIndex + nLen;
- nTokenIndex = nTokenIndex + nLen;
+ m_nBufferIndex = m_nBufferIndex + nLen;
+ m_nTokenIndex = m_nTokenIndex + nLen;
}
-void SmParser::Replace( USHORT nPos, USHORT nLen, const String &rText )
+void SmParser::Replace( sal_uInt16 nPos, sal_uInt16 nLen, const String &rText )
{
- OSL_ENSURE( nPos + nLen <= BufferString.Len(), "argument mismatch" );
+ OSL_ENSURE( nPos + nLen <= m_aBufferString.Len(), "argument mismatch" );
- BufferString.Replace( nPos, nLen, rText );
- INT16 nChg = rText.Len() - nLen;
- BufferIndex = BufferIndex + nChg;
- nTokenIndex = nTokenIndex + nChg;
+ m_aBufferString.Replace( nPos, nLen, rText );
+ sal_Int16 nChg = rText.Len() - nLen;
+ m_nBufferIndex = m_nBufferIndex + nChg;
+ m_nTokenIndex = m_nTokenIndex + nChg;
}
@@ -405,7 +405,7 @@ void SmParser::NextToken()
{
static const String aEmptyStr;
- xub_StrLen nBufLen = BufferString.Len();
+ xub_StrLen nBufLen = m_aBufferString.Len();
ParseResult aRes;
xub_StrLen nRealStart;
bool bCont;
@@ -415,13 +415,13 @@ void SmParser::NextToken()
{
// skip white spaces
while (UnicodeType::SPACE_SEPARATOR ==
- aCC.getType( BufferString, BufferIndex ))
- ++BufferIndex;
+ aCC.getType( m_aBufferString, m_nBufferIndex ))
+ ++m_nBufferIndex;
sal_Int32 nStartFlags = coStartFlags;
sal_Int32 nContFlags = coContFlags;
- sal_Unicode cFirstChar = BufferString.GetChar( BufferIndex );
- aRes = aCC.parseAnyToken( BufferString, BufferIndex,
+ sal_Unicode cFirstChar = m_aBufferString.GetChar( m_nBufferIndex );
+ aRes = aCC.parseAnyToken( m_aBufferString, m_nBufferIndex,
nStartFlags, aEmptyStr,
nContFlags, aEmptyStr );
@@ -438,7 +438,7 @@ void SmParser::NextToken()
aCC.setLocale( aDotLoc );
aTmpRes = aCC.parsePredefinedToken(
KParseType::ASC_NUMBER,
- BufferString, BufferIndex,
+ m_aBufferString, m_nBufferIndex,
KParseTokens::ASC_DIGIT, aEmptyStr,
KParseTokens::ASC_DIGIT | KParseTokens::ASC_DOT, aEmptyStr );
aCC.setLocale( aOldLoc );
@@ -446,29 +446,29 @@ void SmParser::NextToken()
aRes.TokenType = aTmpRes.TokenType;
}
- nRealStart = BufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace);
- BufferIndex = nRealStart;
+ nRealStart = m_nBufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace);
+ m_nBufferIndex = nRealStart;
bCont = false;
if ( aRes.TokenType == 0 &&
nRealStart < nBufLen &&
- '\n' == BufferString.GetChar( nRealStart ) )
+ '\n' == m_aBufferString.GetChar( nRealStart ) )
{
// keep data needed for tokens row and col entry up to date
- ++Row;
- BufferIndex = ColOff = nRealStart + 1;
+ ++m_Row;
+ m_nBufferIndex = m_nColOff = nRealStart + 1;
bCont = true;
}
else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
{
- String aName( BufferString.Copy( nRealStart, 2 ));
+ String aName( m_aBufferString.Copy( nRealStart, 2 ));
if ( aName.EqualsAscii( "%%" ))
{
//SkipComment
- BufferIndex = nRealStart + 2;
- while (BufferIndex < nBufLen &&
- '\n' != BufferString.GetChar( BufferIndex ))
- ++BufferIndex;
+ m_nBufferIndex = nRealStart + 2;
+ while (m_nBufferIndex < nBufLen &&
+ '\n' != m_aBufferString.GetChar( m_nBufferIndex ))
+ ++m_nBufferIndex;
bCont = true;
}
}
@@ -476,33 +476,33 @@ void SmParser::NextToken()
} while (bCont);
// set index of current token
- nTokenIndex = BufferIndex;
+ m_nTokenIndex = m_nBufferIndex;
- CurToken.nRow = Row;
- CurToken.nCol = nRealStart - ColOff + 1;
+ m_aCurToken.nRow = m_Row;
+ m_aCurToken.nCol = nRealStart - m_nColOff + 1;
bool bHandled = true;
if (nRealStart >= nBufLen)
{
- CurToken.eType = TEND;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.Erase();
+ m_aCurToken.eType = TEND;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.Erase();
}
else if ((aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER))
|| (bNumStart && (aRes.TokenType & KParseType::IDENTNAME)))
{
- INT32 n = aRes.EndPos - nRealStart;
+ sal_Int32 n = aRes.EndPos - nRealStart;
OSL_ENSURE( n >= 0, "length < 0" );
- CurToken.eType = TNUMBER;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) );
+ m_aCurToken.eType = TNUMBER;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) );
#if OSL_DEBUG_LEVEL > 1
- if (!IsDelimiter( BufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
+ if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
{
DBG_WARNING( "identifier really finished? (compatibility!)" );
}
@@ -510,59 +510,59 @@ void SmParser::NextToken()
}
else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING)
{
- CurToken.eType = TTEXT;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = aRes.DequotedNameOrString;
- CurToken.nRow = Row;
- CurToken.nCol = nRealStart - ColOff + 2;
+ m_aCurToken.eType = TTEXT;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = aRes.DequotedNameOrString;
+ m_aCurToken.nRow = m_Row;
+ m_aCurToken.nCol = nRealStart - m_nColOff + 2;
}
else if (aRes.TokenType & KParseType::IDENTNAME)
{
- INT32 n = aRes.EndPos - nRealStart;
+ sal_Int32 n = aRes.EndPos - nRealStart;
OSL_ENSURE( n >= 0, "length < 0" );
- String aName( BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) );
+ String aName( m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) );
const SmTokenTableEntry *pEntry = GetTokenTableEntry( aName );
if (pEntry)
{
- CurToken.eType = pEntry->eType;
- CurToken.cMathChar = pEntry->cMathChar;
- CurToken.nGroup = pEntry->nGroup;
- CurToken.nLevel = pEntry->nLevel;
- CurToken.aText.AssignAscii( pEntry->pIdent );
+ m_aCurToken.eType = pEntry->eType;
+ m_aCurToken.cMathChar = pEntry->cMathChar;
+ m_aCurToken.nGroup = pEntry->nGroup;
+ m_aCurToken.nLevel = pEntry->nLevel;
+ m_aCurToken.aText.AssignAscii( pEntry->pIdent );
}
else
{
- CurToken.eType = TIDENT;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = aName;
+ m_aCurToken.eType = TIDENT;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = aName;
#if OSL_DEBUG_LEVEL > 1
- if (!IsDelimiter( BufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
+ if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
{
DBG_WARNING( "identifier really finished? (compatibility!)" );
}
#endif
}
}
- else if (aRes.TokenType == 0 && '_' == BufferString.GetChar( nRealStart ))
+ else if (aRes.TokenType == 0 && '_' == m_aBufferString.GetChar( nRealStart ))
{
- CurToken.eType = TRSUB;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGPOWER;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "_" );
+ m_aCurToken.eType = TRSUB;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGPOWER;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "_" );
aRes.EndPos = nRealStart + 1;
}
else if (aRes.TokenType & KParseType::BOOLEAN)
{
sal_Int32 &rnEndPos = aRes.EndPos;
- String aName( BufferString.Copy( nRealStart,
+ String aName( m_aBufferString.Copy( nRealStart,
sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ));
if (2 >= aName.Len())
{
@@ -571,91 +571,91 @@ void SmParser::NextToken()
{
case '<':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "<<" ))
{
- CurToken.eType = TLL;
- CurToken.cMathChar = MS_LL;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<<" );
+ m_aCurToken.eType = TLL;
+ m_aCurToken.cMathChar = MS_LL;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<<" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 2 ).
+ else if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "<=" ))
{
- CurToken.eType = TLE;
- CurToken.cMathChar = MS_LE;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<=" );
+ m_aCurToken.eType = TLE;
+ m_aCurToken.cMathChar = MS_LE;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<=" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 2 ).
+ else if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "<>" ))
{
- CurToken.eType = TNEQ;
- CurToken.cMathChar = MS_NEQ;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<>" );
+ m_aCurToken.eType = TNEQ;
+ m_aCurToken.cMathChar = MS_NEQ;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<>" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 3 ).
+ else if (m_aBufferString.Copy( nRealStart, 3 ).
EqualsAscii( "<?>" ))
{
- CurToken.eType = TPLACE;
- CurToken.cMathChar = MS_PLACE;
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "<?>" );
+ m_aCurToken.eType = TPLACE;
+ m_aCurToken.cMathChar = MS_PLACE;
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "<?>" );
rnEndPos = nRealStart + 3;
}
else
{
- CurToken.eType = TLT;
- CurToken.cMathChar = MS_LT;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<" );
+ m_aCurToken.eType = TLT;
+ m_aCurToken.cMathChar = MS_LT;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<" );
}
}
break;
case '>':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( ">=" ))
{
- CurToken.eType = TGE;
- CurToken.cMathChar = MS_GE;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( ">=" );
+ m_aCurToken.eType = TGE;
+ m_aCurToken.cMathChar = MS_GE;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( ">=" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 2 ).
+ else if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( ">>" ))
{
- CurToken.eType = TGG;
- CurToken.cMathChar = MS_GG;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( ">>" );
+ m_aCurToken.eType = TGG;
+ m_aCurToken.cMathChar = MS_GG;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( ">>" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TGT;
- CurToken.cMathChar = MS_GT;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( ">" );
+ m_aCurToken.eType = TGT;
+ m_aCurToken.cMathChar = MS_GT;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( ">" );
}
}
break;
@@ -667,7 +667,7 @@ void SmParser::NextToken()
else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
{
sal_Int32 &rnEndPos = aRes.EndPos;
- String aName( BufferString.Copy( nRealStart,
+ String aName( m_aBufferString.Copy( nRealStart,
sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ) );
if (1 == aName.Len())
@@ -680,12 +680,12 @@ void SmParser::NextToken()
//! modifies aRes.EndPos
OSL_ENSURE( rnEndPos >= nBufLen ||
- '%' != BufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ),
+ '%' != m_aBufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ),
"unexpected comment start" );
// get identifier of user-defined character
ParseResult aTmpRes = aCC.parseAnyToken(
- BufferString, rnEndPos,
+ m_aBufferString, rnEndPos,
KParseTokens::ANY_LETTER,
aEmptyStr,
coContFlags,
@@ -697,20 +697,20 @@ void SmParser::NextToken()
// default setting for 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 = String();
- CurToken.nRow = sal::static_int_cast< xub_StrLen >(Row);
- CurToken.nCol = nTmpStart - ColOff;
+ m_aCurToken.eType = TTEXT;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = String();
+ m_aCurToken.nRow = sal::static_int_cast< xub_StrLen >(m_Row);
+ m_aCurToken.nCol = nTmpStart - m_nColOff;
if (aTmpRes.TokenType & KParseType::IDENTNAME)
{
xub_StrLen n = sal::static_int_cast< xub_StrLen >(aTmpRes.EndPos - nTmpStart);
- CurToken.eType = TSPECIAL;
- CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 );
+ m_aCurToken.eType = TSPECIAL;
+ m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 );
OSL_ENSURE( aTmpRes.EndPos > rnEndPos,
"empty identifier" );
@@ -727,187 +727,187 @@ void SmParser::NextToken()
break;
case '[':
{
- CurToken.eType = TLBRACKET;
- CurToken.cMathChar = MS_LBRACKET;
- CurToken.nGroup = TGLBRACES;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "[" );
+ m_aCurToken.eType = TLBRACKET;
+ m_aCurToken.cMathChar = MS_LBRACKET;
+ m_aCurToken.nGroup = TGLBRACES;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "[" );
}
break;
case '\\':
{
- CurToken.eType = TESCAPE;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "\\" );
+ m_aCurToken.eType = TESCAPE;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "\\" );
}
break;
case ']':
{
- CurToken.eType = TRBRACKET;
- CurToken.cMathChar = MS_RBRACKET;
- CurToken.nGroup = TGRBRACES;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "]" );
+ m_aCurToken.eType = TRBRACKET;
+ m_aCurToken.cMathChar = MS_RBRACKET;
+ m_aCurToken.nGroup = TGRBRACES;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "]" );
}
break;
case '^':
{
- CurToken.eType = TRSUP;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGPOWER;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "^" );
+ m_aCurToken.eType = TRSUP;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGPOWER;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "^" );
}
break;
case '`':
{
- CurToken.eType = TSBLANK;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGBLANK;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "`" );
+ m_aCurToken.eType = TSBLANK;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGBLANK;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "`" );
}
break;
case '{':
{
- CurToken.eType = TLGROUP;
- CurToken.cMathChar = MS_LBRACE;
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "{" );
+ m_aCurToken.eType = TLGROUP;
+ m_aCurToken.cMathChar = MS_LBRACE;
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "{" );
}
break;
case '|':
{
- CurToken.eType = TOR;
- CurToken.cMathChar = MS_OR;
- CurToken.nGroup = TGSUM;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "|" );
+ m_aCurToken.eType = TOR;
+ m_aCurToken.cMathChar = MS_OR;
+ m_aCurToken.nGroup = TGSUM;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "|" );
}
break;
case '}':
{
- CurToken.eType = TRGROUP;
- CurToken.cMathChar = MS_RBRACE;
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "}" );
+ m_aCurToken.eType = TRGROUP;
+ m_aCurToken.cMathChar = MS_RBRACE;
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "}" );
}
break;
case '~':
{
- CurToken.eType = TBLANK;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGBLANK;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "~" );
+ m_aCurToken.eType = TBLANK;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGBLANK;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "~" );
}
break;
case '#':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "##" ))
{
- CurToken.eType = TDPOUND;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "##" );
+ m_aCurToken.eType = TDPOUND;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "##" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TPOUND;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "#" );
+ m_aCurToken.eType = TPOUND;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "#" );
}
}
break;
case '&':
{
- CurToken.eType = TAND;
- CurToken.cMathChar = MS_AND;
- CurToken.nGroup = TGPRODUCT;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "&" );
+ m_aCurToken.eType = TAND;
+ m_aCurToken.cMathChar = MS_AND;
+ m_aCurToken.nGroup = TGPRODUCT;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "&" );
}
break;
case '(':
{
- CurToken.eType = TLPARENT;
- CurToken.cMathChar = MS_LPARENT;
- CurToken.nGroup = TGLBRACES;
- CurToken.nLevel = 5; //! 0 to continue expression
- CurToken.aText.AssignAscii( "(" );
+ m_aCurToken.eType = TLPARENT;
+ m_aCurToken.cMathChar = MS_LPARENT;
+ m_aCurToken.nGroup = TGLBRACES;
+ m_aCurToken.nLevel = 5; //! 0 to continue expression
+ m_aCurToken.aText.AssignAscii( "(" );
}
break;
case ')':
{
- CurToken.eType = TRPARENT;
- CurToken.cMathChar = MS_RPARENT;
- CurToken.nGroup = TGRBRACES;
- CurToken.nLevel = 0; //! 0 to terminate expression
- CurToken.aText.AssignAscii( ")" );
+ m_aCurToken.eType = TRPARENT;
+ m_aCurToken.cMathChar = MS_RPARENT;
+ m_aCurToken.nGroup = TGRBRACES;
+ m_aCurToken.nLevel = 0; //! 0 to terminate expression
+ m_aCurToken.aText.AssignAscii( ")" );
}
break;
case '*':
{
- CurToken.eType = TMULTIPLY;
- CurToken.cMathChar = MS_MULTIPLY;
- CurToken.nGroup = TGPRODUCT;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "*" );
+ m_aCurToken.eType = TMULTIPLY;
+ m_aCurToken.cMathChar = MS_MULTIPLY;
+ m_aCurToken.nGroup = TGPRODUCT;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "*" );
}
break;
case '+':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "+-" ))
{
- CurToken.eType = TPLUSMINUS;
- CurToken.cMathChar = MS_PLUSMINUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "+-" );
+ m_aCurToken.eType = TPLUSMINUS;
+ m_aCurToken.cMathChar = MS_PLUSMINUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "+-" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TPLUS;
- CurToken.cMathChar = MS_PLUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "+" );
+ m_aCurToken.eType = TPLUS;
+ m_aCurToken.cMathChar = MS_PLUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "+" );
}
}
break;
case '-':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "-+" ))
{
- CurToken.eType = TMINUSPLUS;
- CurToken.cMathChar = MS_MINUSPLUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "-+" );
+ m_aCurToken.eType = TMINUSPLUS;
+ m_aCurToken.cMathChar = MS_MINUSPLUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "-+" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TMINUS;
- CurToken.cMathChar = MS_MINUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "-" );
+ m_aCurToken.eType = TMINUS;
+ m_aCurToken.cMathChar = MS_MINUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "-" );
}
}
break;
@@ -916,40 +916,40 @@ void SmParser::NextToken()
// for compatibility with SO5.2
// texts like .34 ...56 ... h ...78..90
// will be treated as numbers
- CurToken.eType = TNUMBER;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
+ m_aCurToken.eType = TNUMBER;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
- xub_StrLen nTxtStart = BufferIndex;
+ xub_StrLen nTxtStart = m_nBufferIndex;
sal_Unicode cChar;
do
{
- cChar = BufferString.GetChar( ++BufferIndex );
+ cChar = m_aBufferString.GetChar( ++m_nBufferIndex );
}
while ( cChar == '.' || IsDigit( cChar ) );
- CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart),
- sal::static_int_cast< xub_StrLen >(BufferIndex - nTxtStart) );
- aRes.EndPos = BufferIndex;
+ m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart),
+ sal::static_int_cast< xub_StrLen >(m_nBufferIndex - nTxtStart) );
+ aRes.EndPos = m_nBufferIndex;
}
break;
case '/':
{
- CurToken.eType = TDIVIDEBY;
- CurToken.cMathChar = MS_SLASH;
- CurToken.nGroup = TGPRODUCT;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "/" );
+ m_aCurToken.eType = TDIVIDEBY;
+ m_aCurToken.cMathChar = MS_SLASH;
+ m_aCurToken.nGroup = TGPRODUCT;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "/" );
}
break;
case '=':
{
- CurToken.eType = TASSIGN;
- CurToken.cMathChar = MS_ASSIGN;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "=" );
+ m_aCurToken.eType = TASSIGN;
+ m_aCurToken.cMathChar = MS_ASSIGN;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "=" );
}
break;
default:
@@ -962,17 +962,17 @@ void SmParser::NextToken()
if (!bHandled)
{
- CurToken.eType = TCHARACTER;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = BufferString.Copy( nRealStart, 1 );
+ m_aCurToken.eType = TCHARACTER;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = m_aBufferString.Copy( nRealStart, 1 );
aRes.EndPos = nRealStart + 1;
}
- if (TEND != CurToken.eType)
- BufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos);
+ if (TEND != m_aCurToken.eType)
+ m_nBufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos);
}
@@ -986,25 +986,25 @@ void SmParser::Table()
SmNodeArray LineArray;
Line();
- while (CurToken.eType == TNEWLINE)
+ while (m_aCurToken.eType == TNEWLINE)
{
NextToken();
Line();
}
- if (CurToken.eType != TEND)
+ if (m_aCurToken.eType != TEND)
Error(PE_UNEXPECTED_CHAR);
- ULONG n = NodeStack.Count();
+ sal_uLong n = m_aNodeStack.Count();
LineArray.resize(n);
- for (ULONG i = 0; i < n; i++)
- LineArray[n - (i + 1)] = NodeStack.Pop();
+ for (sal_uLong i = 0; i < n; i++)
+ LineArray[n - (i + 1)] = m_aNodeStack.Pop();
- SmStructureNode *pSNode = new SmTableNode(CurToken);
+ SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
pSNode->SetSubNodes(LineArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1026,19 +1026,21 @@ void SmParser::Align()
// (the dominant one in 4.0) and erase all others (especially old
// discarded tokens) from command string.
while (TokenInGroup(TGALIGN))
- { if (TokenInGroup(TGDISCARDED) || pSNode)
- { BufferIndex = GetTokenIndex();
- BufferString.Erase(BufferIndex, CurToken.aText.Len());
+ {
+ if (TokenInGroup(TGDISCARDED) || pSNode)
+ {
+ m_nBufferIndex = GetTokenIndex();
+ m_aBufferString.Erase(m_nBufferIndex, m_aCurToken.aText.Len());
}
else
- pSNode = new SmAlignNode(CurToken);
+ pSNode = new SmAlignNode(m_aCurToken);
NextToken();
}
}
else
{
- pSNode = new SmAlignNode(CurToken);
+ pSNode = new SmAlignNode(m_aCurToken);
NextToken();
@@ -1056,15 +1058,15 @@ void SmParser::Align()
Insert('}', GetTokenIndex());
if (pSNode)
- { pSNode->SetSubNodes(NodeStack.Pop(), 0);
- NodeStack.Push(pSNode);
+ { pSNode->SetSubNodes(m_aNodeStack.Pop(), 0);
+ m_aNodeStack.Push(pSNode);
}
}
void SmParser::Line()
{
- USHORT n = 0;
+ sal_uInt16 n = 0;
SmNodeArray ExpressionArray;
ExpressionArray.resize(n);
@@ -1072,19 +1074,19 @@ void SmParser::Line()
// start with single expression that may have an alignment statement
// (and go on with expressions that must not have alignment
// statements in 'while' loop below. See also 'Expression()'.)
- if (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+ if (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE)
{ Align();
ExpressionArray.resize(++n);
- ExpressionArray[n - 1] = NodeStack.Pop();
+ ExpressionArray[n - 1] = m_aNodeStack.Pop();
}
- while (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+ while (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE)
{ if (CONVERT_40_TO_50 != GetConversion())
Expression();
else
Align();
ExpressionArray.resize(++n);
- ExpressionArray[n - 1] = NodeStack.Pop();
+ ExpressionArray[n - 1] = m_aNodeStack.Pop();
}
//If there's no expression, add an empty one.
@@ -1093,44 +1095,43 @@ void SmParser::Line()
if(ExpressionArray.size() == 0)
ExpressionArray.push_back(new SmExpressionNode(SmToken()));
-
- SmStructureNode *pSNode = new SmLineNode(CurToken);
+ SmStructureNode *pSNode = new SmLineNode(m_aCurToken);
pSNode->SetSubNodes(ExpressionArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
void SmParser::Expression()
{
bool bUseExtraSpaces = true;
- SmNode *pNode = NodeStack.Pop();
+ SmNode *pNode = m_aNodeStack.Pop();
if (pNode)
{
if (pNode->GetToken().eType == TNOSPACE)
bUseExtraSpaces = false;
else
- NodeStack.Push(pNode); // push the node from above again (now to be used as argument to this current 'nospace' node)
+ m_aNodeStack.Push(pNode); // push the node from above again (now to be used as argument to this current 'nospace' node)
}
- USHORT n = 0;
+ sal_uInt16 n = 0;
SmNodeArray RelationArray;
RelationArray.resize(n);
Relation();
RelationArray.resize(++n);
- RelationArray[n - 1] = NodeStack.Pop();
+ RelationArray[n - 1] = m_aNodeStack.Pop();
- while (CurToken.nLevel >= 4)
+ while (m_aCurToken.nLevel >= 4)
{ Relation();
RelationArray.resize(++n);
- RelationArray[n - 1] = NodeStack.Pop();
+ RelationArray[n - 1] = m_aNodeStack.Pop();
}
- SmExpressionNode *pSNode = new SmExpressionNode(CurToken);
+ SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken);
pSNode->SetSubNodes(RelationArray);
pSNode->SetUseExtraSpaces(bUseExtraSpaces);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1139,16 +1140,16 @@ void SmParser::Relation()
Sum();
while (TokenInGroup(TGRELATION))
{
- SmStructureNode *pSNode = new SmBinHorNode(CurToken);
- SmNode *pFirst = NodeStack.Pop();
+ SmStructureNode *pSNode = new SmBinHorNode(m_aCurToken);
+ SmNode *pFirst = m_aNodeStack.Pop();
OpSubSup();
- SmNode *pSecond = NodeStack.Pop();
+ SmNode *pSecond = m_aNodeStack.Pop();
Sum();
- pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
@@ -1158,16 +1159,16 @@ void SmParser::Sum()
Product();
while (TokenInGroup(TGSUM))
{
- SmStructureNode *pSNode = new SmBinHorNode(CurToken);
- SmNode *pFirst = NodeStack.Pop();
+ SmStructureNode *pSNode = new SmBinHorNode(m_aCurToken);
+ SmNode *pFirst = m_aNodeStack.Pop();
OpSubSup();
- SmNode *pSecond = NodeStack.Pop();
+ SmNode *pSecond = m_aNodeStack.Pop();
Product();
- pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
@@ -1178,36 +1179,36 @@ void SmParser::Product()
while (TokenInGroup(TGPRODUCT))
{ SmStructureNode *pSNode;
- SmNode *pFirst = NodeStack.Pop(),
+ SmNode *pFirst = m_aNodeStack.Pop(),
*pOper;
bool bSwitchArgs = false;
- SmTokenType eType = CurToken.eType;
+ SmTokenType eType = m_aCurToken.eType;
switch (eType)
{
case TOVER:
- pSNode = new SmBinVerNode(CurToken);
- pOper = new SmRectangleNode(CurToken);
+ pSNode = new SmBinVerNode(m_aCurToken);
+ pOper = new SmRectangleNode(m_aCurToken);
NextToken();
break;
case TBOPER:
- pSNode = new SmBinHorNode(CurToken);
+ pSNode = new SmBinHorNode(m_aCurToken);
NextToken();
//Let the glyph node know it's a binary operation
- CurToken.eType = TBOPER;
- CurToken.nGroup = TGPRODUCT;
+ m_aCurToken.eType = TBOPER;
+ m_aCurToken.nGroup = TGPRODUCT;
GlyphSpecial();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
break;
case TOVERBRACE :
case TUNDERBRACE :
- pSNode = new SmVerticalBraceNode(CurToken);
- pOper = new SmMathSymbolNode(CurToken);
+ pSNode = new SmVerticalBraceNode(m_aCurToken);
+ pOper = new SmMathSymbolNode(m_aCurToken);
NextToken();
break;
@@ -1215,11 +1216,11 @@ void SmParser::Product()
case TWIDEBACKSLASH:
case TWIDESLASH:
{
- SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(CurToken);
+ SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(m_aCurToken);
pSTmp->SetAscending(eType == TWIDESLASH);
pSNode = pSTmp;
- pOper = new SmPolyLineNode(CurToken);
+ pOper = new SmPolyLineNode(m_aCurToken);
NextToken();
bSwitchArgs = true;
@@ -1227,25 +1228,25 @@ void SmParser::Product()
}
default:
- pSNode = new SmBinHorNode(CurToken);
+ pSNode = new SmBinHorNode(m_aCurToken);
OpSubSup();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
}
Power();
if (bSwitchArgs)
//! vgl siehe SmBinDiagonalNode::Arrange
- pSNode->SetSubNodes(pFirst, NodeStack.Pop(), pOper);
+ pSNode->SetSubNodes(pFirst, m_aNodeStack.Pop(), pOper);
else
- pSNode->SetSubNodes(pFirst, pOper, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFirst, pOper, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
-void SmParser::SubSup(ULONG nActiveGroup)
+void SmParser::SubSup(sal_uLong nActiveGroup)
{
OSL_ENSURE(nActiveGroup == TGPOWER || nActiveGroup == TGLIMIT,
"Sm: wrong token group");
@@ -1254,8 +1255,8 @@ void SmParser::SubSup(ULONG nActiveGroup)
// already finish
return;
- SmSubSupNode *pNode = new SmSubSupNode(CurToken);
- //! Of course 'CurToken' is just the first sub-/supscript token.
+ SmSubSupNode *pNode = new SmSubSupNode(m_aCurToken);
+ //! Of course 'm_aCurToken' is just the first sub-/supscript token.
//! It should be of no further interest. The positions of the
//! sub-/supscripts will be identified by the corresponding subnodes
//! index in the 'aSubNodes' array (enum value from 'SmSubSup').
@@ -1265,14 +1266,14 @@ void SmParser::SubSup(ULONG nActiveGroup)
// initialize subnodes array
SmNodeArray aSubNodes;
aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
- aSubNodes[0] = NodeStack.Pop();
- for (USHORT i = 1; i < aSubNodes.size(); i++)
+ aSubNodes[0] = m_aNodeStack.Pop();
+ for (sal_uInt16 i = 1; i < aSubNodes.size(); i++)
aSubNodes[i] = NULL;
// process all sub-/supscripts
int nIndex = 0;
while (TokenInGroup(nActiveGroup))
- { SmTokenType eType (CurToken.eType);
+ { SmTokenType eType (m_aCurToken.eType);
// skip sub-/supscript token
NextToken();
@@ -1305,18 +1306,18 @@ void SmParser::SubSup(ULONG nActiveGroup)
// set sub-/supscript if not already done
if (aSubNodes[nIndex] != NULL)
Error(PE_DOUBLE_SUBSUPSCRIPT);
- aSubNodes[nIndex] = NodeStack.Pop();
+ aSubNodes[nIndex] = m_aNodeStack.Pop();
}
pNode->SetSubNodes(aSubNodes);
- NodeStack.Push(pNode);
+ m_aNodeStack.Push(pNode);
}
void SmParser::OpSubSup()
{
// push operator symbol
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
// skip operator token
NextToken();
// get sub- supscripts if any
@@ -1337,28 +1338,28 @@ void SmParser::Power()
void SmParser::Blank()
{
OSL_ENSURE(TokenInGroup(TGBLANK), "Sm : wrong token");
- SmBlankNode *pBlankNode = new SmBlankNode(CurToken);
+ SmBlankNode *pBlankNode = new SmBlankNode(m_aCurToken);
while (TokenInGroup(TGBLANK))
{
- pBlankNode->IncreaseBy(CurToken);
+ pBlankNode->IncreaseBy(m_aCurToken);
NextToken();
}
// Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist
- if ( CurToken.eType == TNEWLINE ||
- (CurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) )
+ if ( m_aCurToken.eType == TNEWLINE ||
+ (m_aCurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) )
{
pBlankNode->Clear();
}
- NodeStack.Push(pBlankNode);
+ m_aNodeStack.Push(pBlankNode);
}
void SmParser::Term()
{
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TESCAPE :
Escape();
@@ -1367,15 +1368,15 @@ void SmParser::Term()
case TNOSPACE :
case TLGROUP :
{
- bool bNoSpace = CurToken.eType == TNOSPACE;
+ bool bNoSpace = m_aCurToken.eType == TNOSPACE;
if (bNoSpace) // push 'no space' node and continue to parse expression
{
- NodeStack.Push(new SmExpressionNode(CurToken));
+ m_aNodeStack.Push(new SmExpressionNode(m_aCurToken));
NextToken();
}
- if (CurToken.eType != TLGROUP)
+ if (m_aCurToken.eType != TLGROUP)
{
- NodeStack.Pop(); // get rid of the 'no space' node pushed above
+ m_aNodeStack.Pop(); // get rid of the 'no space' node pushed above
Term();
}
else
@@ -1383,20 +1384,20 @@ void SmParser::Term()
NextToken();
// allow for empty group
- if (CurToken.eType == TRGROUP)
+ if (m_aCurToken.eType == TRGROUP)
{
if (bNoSpace) // get rid of the 'no space' node pushed above
- NodeStack.Pop();
- SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+ m_aNodeStack.Pop();
+ SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken);
pSNode->SetSubNodes(NULL, NULL);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
NextToken();
}
else // go as usual
{
Align();
- if (CurToken.eType != TRGROUP)
+ if (m_aCurToken.eType != TRGROUP)
Error(PE_RGROUP_EXPECTED);
else
NextToken();
@@ -1415,16 +1416,16 @@ void SmParser::Term()
break;
case TTEXT :
- NodeStack.Push(new SmTextNode(CurToken, FNT_TEXT));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_TEXT));
NextToken();
break;
case TIDENT :
case TCHARACTER :
- NodeStack.Push(new SmTextNode(CurToken, FNT_VARIABLE));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_VARIABLE));
NextToken();
break;
case TNUMBER :
- NodeStack.Push(new SmTextNode(CurToken, FNT_NUMBER));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_NUMBER));
NextToken();
break;
@@ -1461,12 +1462,12 @@ void SmParser::Term()
case TDOTSLOW :
case TDOTSUP :
case TDOTSVERT :
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
NextToken();
break;
case TPLACE:
- NodeStack.Push(new SmPlaceNode(CurToken));
+ m_aNodeStack.Push(new SmPlaceNode(m_aCurToken));
NextToken();
break;
@@ -1501,7 +1502,7 @@ void SmParser::Term()
{ SmStructureNodeArray aArray;
bool bIsAttr;
- USHORT n = 0;
+ sal_uInt16 n = 0;
while (true == (bIsAttr = TokenInGroup(TGATTRIBUT))
|| TokenInGroup(TGFONTATTR))
{ aArray.resize(n + 1);
@@ -1514,19 +1515,19 @@ void SmParser::Term()
// check if casting in following line is ok
OSL_ENSURE(!NodeStack.Top()->IsVisible(), "Sm : Ooops...");
- aArray[n] = (SmStructureNode *) NodeStack.Pop();
+ aArray[n] = (SmStructureNode *) m_aNodeStack.Pop();
n++;
}
Power();
- SmNode *pFirstNode = NodeStack.Pop();
+ SmNode *pFirstNode = m_aNodeStack.Pop();
while (n > 0)
{ aArray[n - 1]->SetSubNodes(0, pFirstNode);
pFirstNode = aArray[n - 1];
n--;
}
- NodeStack.Push(pFirstNode);
+ m_aNodeStack.Push(pFirstNode);
}
else if (TokenInGroup(TGFUNCTION))
{ if (CONVERT_40_TO_50 != GetConversion())
@@ -1542,9 +1543,9 @@ void SmParser::Term()
//
Function();
- SmNode *pFunc = NodeStack.Pop();
+ SmNode *pFunc = m_aNodeStack.Pop();
- if (CurToken.eType == TLPARENT)
+ if (m_aCurToken.eType == TLPARENT)
{ Term();
}
else
@@ -1555,8 +1556,8 @@ void SmParser::Term()
Insert('}', GetTokenIndex());
SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
- pSNode->SetSubNodes(pFunc, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFunc, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
else
@@ -1569,7 +1570,7 @@ void SmParser::Escape()
{
NextToken();
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TLPARENT :
case TRPARENT :
@@ -1596,8 +1597,8 @@ void SmParser::Escape()
Error(PE_UNEXPECTED_TOKEN);
}
- SmNode *pNode = new SmMathSymbolNode(CurToken);
- NodeStack.Push(pNode);
+ SmNode *pNode = new SmMathSymbolNode(m_aCurToken);
+ m_aNodeStack.Push(pNode);
NextToken();
}
@@ -1606,27 +1607,27 @@ void SmParser::Escape()
void SmParser::Operator()
{
if (TokenInGroup(TGOPER))
- { SmStructureNode *pSNode = new SmOperNode(CurToken);
+ { SmStructureNode *pSNode = new SmOperNode(m_aCurToken);
// put operator on top of stack
Oper();
if (TokenInGroup(TGLIMIT) || TokenInGroup(TGPOWER))
- SubSup(CurToken.nGroup);
- SmNode *pOperator = NodeStack.Pop();
+ SubSup(m_aCurToken.nGroup);
+ SmNode *pOperator = m_aNodeStack.Pop();
// get argument
Power();
- pSNode->SetSubNodes(pOperator, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pOperator, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
void SmParser::Oper()
{
- SmTokenType eType (CurToken.eType);
+ SmTokenType eType (m_aCurToken.eType);
SmNode *pNode = NULL;
switch (eType)
@@ -1640,7 +1641,7 @@ void SmParser::Oper()
case TLINT :
case TLLINT :
case TLLLINT :
- pNode = new SmMathSymbolNode(CurToken);
+ pNode = new SmMathSymbolNode(m_aCurToken);
break;
case TLIM :
@@ -1657,27 +1658,27 @@ void SmParser::Oper()
break;
}
if( pLim )
- CurToken.aText.AssignAscii( pLim );
- pNode = new SmTextNode(CurToken, FNT_TEXT);
+ m_aCurToken.aText.AssignAscii( pLim );
+ pNode = new SmTextNode(m_aCurToken, FNT_TEXT);
}
break;
case TOVERBRACE :
case TUNDERBRACE :
- pNode = new SmMathSymbolNode(CurToken);
+ pNode = new SmMathSymbolNode(m_aCurToken);
break;
case TOPER :
NextToken();
OSL_ENSURE(CurToken.eType == TSPECIAL, "Sm: wrong token");
- pNode = new SmGlyphSpecialNode(CurToken);
+ pNode = new SmGlyphSpecialNode(m_aCurToken);
break;
default :
OSL_ENSURE(0, "Sm: unknown case");
}
- NodeStack.Push(pNode);
+ m_aNodeStack.Push(pNode);
NextToken();
}
@@ -1687,8 +1688,8 @@ void SmParser::UnOper()
{
OSL_ENSURE(TokenInGroup(TGUNOPER), "Sm: wrong token");
- SmToken aNodeToken = CurToken;
- SmTokenType eType = CurToken.eType;
+ SmToken aNodeToken = m_aCurToken;
+ SmTokenType eType = m_aCurToken.eType;
bool bIsPostfix = eType == TFACT;
SmStructureNode *pSNode;
@@ -1706,16 +1707,16 @@ void SmParser::UnOper()
case TNROOT :
NextToken();
Power();
- pExtra = NodeStack.Pop();
+ pExtra = m_aNodeStack.Pop();
break;
case TUOPER :
NextToken();
//Let the glyph know what it is...
- CurToken.eType = TUOPER;
- CurToken.nGroup = TGUNOPER;
+ m_aCurToken.eType = TUOPER;
+ m_aCurToken.nGroup = TGUNOPER;
GlyphSpecial();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
break;
case TPLUS :
@@ -1725,7 +1726,7 @@ void SmParser::UnOper()
case TNEG :
case TFACT :
OpSubSup();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
break;
default :
@@ -1734,7 +1735,7 @@ void SmParser::UnOper()
// get argument
Power();
- pArg = NodeStack.Pop();
+ pArg = m_aNodeStack.Pop();
if (eType == TABS)
{ pSNode = new SmBraceNode(aNodeToken);
@@ -1768,7 +1769,7 @@ void SmParser::UnOper()
pSNode->SetSubNodes(pOper, pArg);
}
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1776,35 +1777,35 @@ void SmParser::Attribut()
{
OSL_ENSURE(TokenInGroup(TGATTRIBUT), "Sm: wrong token group");
- SmStructureNode *pSNode = new SmAttributNode(CurToken);
+ SmStructureNode *pSNode = new SmAttributNode(m_aCurToken);
SmNode *pAttr;
SmScaleMode eScaleMode = SCALE_NONE;
// get appropriate node for the attribut itself
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{ case TUNDERLINE :
case TOVERLINE :
case TOVERSTRIKE :
- pAttr = new SmRectangleNode(CurToken);
+ pAttr = new SmRectangleNode(m_aCurToken);
eScaleMode = SCALE_WIDTH;
break;
case TWIDEVEC :
case TWIDEHAT :
case TWIDETILDE :
- pAttr = new SmMathSymbolNode(CurToken);
+ pAttr = new SmMathSymbolNode(m_aCurToken);
eScaleMode = SCALE_WIDTH;
break;
default :
- pAttr = new SmMathSymbolNode(CurToken);
+ pAttr = new SmMathSymbolNode(m_aCurToken);
}
NextToken();
pSNode->SetSubNodes(pAttr, 0);
pSNode->SetScaleMode(eScaleMode);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1812,14 +1813,14 @@ void SmParser::FontAttribut()
{
OSL_ENSURE(TokenInGroup(TGFONTATTR), "Sm: wrong token group");
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TITALIC :
case TNITALIC :
case TBOLD :
case TNBOLD :
case TPHANTOM :
- NodeStack.Push(new SmFontNode(CurToken));
+ m_aNodeStack.Push(new SmFontNode(m_aCurToken));
NextToken();
break;
@@ -1851,14 +1852,14 @@ void SmParser::Color()
{ NextToken();
if (TokenInGroup(TGCOLOR))
- { aToken = CurToken;
+ { aToken = m_aCurToken;
NextToken();
}
else
Error(PE_COLOR_EXPECTED);
- } while (CurToken.eType == TCOLOR);
+ } while (m_aCurToken.eType == TCOLOR);
- NodeStack.Push(new SmFontNode(aToken));
+ m_aNodeStack.Push(new SmFontNode(aToken));
}
@@ -1872,14 +1873,14 @@ void SmParser::Font()
{ NextToken();
if (TokenInGroup(TGFONT))
- { aToken = CurToken;
+ { aToken = m_aCurToken;
NextToken();
}
else
Error(PE_FONT_EXPECTED);
- } while (CurToken.eType == TFONT);
+ } while (m_aCurToken.eType == TFONT);
- NodeStack.Push(new SmFontNode(aToken));
+ m_aNodeStack.Push(new SmFontNode(aToken));
}
@@ -1909,12 +1910,12 @@ void SmParser::FontSize()
{
OSL_ENSURE(CurToken.eType == TSIZE, "Sm : Ooops...");
- USHORT Type;
- SmFontNode *pFontNode = new SmFontNode(CurToken);
+ sal_uInt16 Type;
+ SmFontNode *pFontNode = new SmFontNode(m_aCurToken);
NextToken();
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TNUMBER: Type = FNTSIZ_ABSOLUT; break;
case TPLUS: Type = FNTSIZ_PLUS; break;
@@ -1931,7 +1932,7 @@ void SmParser::FontSize()
if (Type != FNTSIZ_ABSOLUT)
{
NextToken();
- if (CurToken.eType != TNUMBER)
+ if (m_aCurToken.eType != TNUMBER)
{
delete pFontNode;
Error(PE_SIZE_EXPECTED);
@@ -1941,10 +1942,10 @@ void SmParser::FontSize()
// get number argument
Fraction aValue( 1L );
- if (lcl_IsNumber( CurToken.aText ))
+ if (lcl_IsNumber( m_aCurToken.aText ))
{
double fTmp;
- if ((fTmp = CurToken.aText.ToDouble()) != 0.0)
+ if ((fTmp = m_aCurToken.aText.ToDouble()) != 0.0)
{
aValue = fTmp;
@@ -1970,7 +1971,7 @@ void SmParser::FontSize()
NextToken();
pFontNode->SetSizeParameter(aValue, Type);
- NodeStack.Push(pFontNode);
+ m_aNodeStack.Push(pFontNode);
}
@@ -1979,14 +1980,14 @@ void SmParser::Brace()
OSL_ENSURE(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES),
"Sm: kein Klammer Ausdruck");
- SmStructureNode *pSNode = new SmBraceNode(CurToken);
+ SmStructureNode *pSNode = new SmBraceNode(m_aCurToken);
SmNode *pBody = 0,
*pLeft = 0,
*pRight = 0;
SmScaleMode eScaleMode = SCALE_NONE;
SmParseError eError = PE_NONE;
- if (CurToken.eType == TLEFT)
+ if (m_aCurToken.eType == TLEFT)
{ NextToken();
eScaleMode = SCALE_HEIGHT;
@@ -1994,19 +1995,19 @@ void SmParser::Brace()
// check for left bracket
if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
{
- pLeft = new SmMathSymbolNode(CurToken);
+ pLeft = new SmMathSymbolNode(m_aCurToken);
NextToken();
Bracebody(true);
- pBody = NodeStack.Pop();
+ pBody = m_aNodeStack.Pop();
- if (CurToken.eType == TRIGHT)
+ if (m_aCurToken.eType == TRIGHT)
{ NextToken();
// check for right bracket
if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
{
- pRight = new SmMathSymbolNode(CurToken);
+ pRight = new SmMathSymbolNode(m_aCurToken);
NextToken();
}
else
@@ -2022,11 +2023,11 @@ void SmParser::Brace()
{
if (TokenInGroup(TGLBRACES))
{
- pLeft = new SmMathSymbolNode(CurToken);
+ pLeft = new SmMathSymbolNode(m_aCurToken);
NextToken();
Bracebody(false);
- pBody = NodeStack.Pop();
+ pBody = m_aNodeStack.Pop();
SmTokenType eExpectedType = TUNKNOWN;
switch (pLeft->GetToken().eType)
@@ -2043,9 +2044,9 @@ void SmParser::Brace()
OSL_ENSURE(0, "Sm: unknown case");
}
- if (CurToken.eType == eExpectedType)
+ if (m_aCurToken.eType == eExpectedType)
{
- pRight = new SmMathSymbolNode(CurToken);
+ pRight = new SmMathSymbolNode(m_aCurToken);
NextToken();
}
else
@@ -2060,7 +2061,7 @@ void SmParser::Brace()
OSL_ENSURE(pRight, "Sm: NULL pointer");
pSNode->SetSubNodes(pLeft, pBody, pRight);
pSNode->SetScaleMode(eScaleMode);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
else
{ delete pSNode;
@@ -2075,37 +2076,37 @@ void SmParser::Brace()
void SmParser::Bracebody(bool bIsLeftRight)
{
- SmStructureNode *pBody = new SmBracebodyNode(CurToken);
+ SmStructureNode *pBody = new SmBracebodyNode(m_aCurToken);
SmNodeArray aNodes;
- USHORT nNum = 0;
+ sal_uInt16 nNum = 0;
// get body if any
if (bIsLeftRight)
{
do
{
- if (CurToken.eType == TMLINE)
+ if (m_aCurToken.eType == TMLINE)
{
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
NextToken();
nNum++;
}
- else if (CurToken.eType != TRIGHT)
+ else if (m_aCurToken.eType != TRIGHT)
{ Align();
nNum++;
- if (CurToken.eType != TMLINE && CurToken.eType != TRIGHT)
+ if (m_aCurToken.eType != TMLINE && m_aCurToken.eType != TRIGHT)
Error(PE_RIGHT_EXPECTED);
}
- } while (CurToken.eType != TEND && CurToken.eType != TRIGHT);
+ } while (m_aCurToken.eType != TEND && m_aCurToken.eType != TRIGHT);
}
else
{
do
{
- if (CurToken.eType == TMLINE)
+ if (m_aCurToken.eType == TMLINE)
{
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
NextToken();
nNum++;
}
@@ -2113,26 +2114,26 @@ void SmParser::Bracebody(bool bIsLeftRight)
{ Align();
nNum++;
- if (CurToken.eType != TMLINE && !TokenInGroup(TGRBRACES))
+ if (m_aCurToken.eType != TMLINE && !TokenInGroup(TGRBRACES))
Error(PE_RBRACE_EXPECTED);
}
- } while (CurToken.eType != TEND && !TokenInGroup(TGRBRACES));
+ } while (m_aCurToken.eType != TEND && !TokenInGroup(TGRBRACES));
}
// build argument vector in parsing order
aNodes.resize(nNum);
- for (USHORT i = 0; i < nNum; i++)
- aNodes[nNum - 1 - i] = NodeStack.Pop();
+ for (sal_uInt16 i = 0; i < nNum; i++)
+ aNodes[nNum - 1 - i] = m_aNodeStack.Pop();
pBody->SetSubNodes(aNodes);
pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
- NodeStack.Push(pBody);
+ m_aNodeStack.Push(pBody);
}
void SmParser::Function()
{
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TFUNC:
NextToken(); // skip "FUNC"-statement
@@ -2157,7 +2158,7 @@ void SmParser::Function()
case TLN :
case TLOG :
case TEXP :
- NodeStack.Push(new SmTextNode(CurToken, FNT_FUNCTION));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_FUNCTION));
NextToken();
break;
@@ -2170,7 +2171,7 @@ void SmParser::Function()
void SmParser::Binom()
{
SmNodeArray ExpressionArray;
- SmStructureNode *pSNode = new SmTableNode(CurToken);
+ SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
NextToken();
@@ -2180,10 +2181,10 @@ void SmParser::Binom()
ExpressionArray.resize(2);
for (int i = 0; i < 2; i++)
- ExpressionArray[2 - (i + 1)] = NodeStack.Pop();
+ ExpressionArray[2 - (i + 1)] = m_aNodeStack.Pop();
pSNode->SetSubNodes(ExpressionArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -2191,9 +2192,9 @@ void SmParser::Stack()
{
SmNodeArray ExpressionArray;
NextToken();
- if (CurToken.eType == TLGROUP)
+ if (m_aCurToken.eType == TLGROUP)
{
- USHORT n = 0;
+ sal_uInt16 n = 0;
do
{
@@ -2201,25 +2202,25 @@ void SmParser::Stack()
Align();
n++;
}
- while (CurToken.eType == TPOUND);
+ while (m_aCurToken.eType == TPOUND);
ExpressionArray.resize(n);
- for (USHORT i = 0; i < n; i++)
- ExpressionArray[n - (i + 1)] = NodeStack.Pop();
+ for (sal_uInt16 i = 0; i < n; i++)
+ ExpressionArray[n - (i + 1)] = m_aNodeStack.Pop();
- if (CurToken.eType != TRGROUP)
+ if (m_aCurToken.eType != TRGROUP)
Error(PE_RGROUP_EXPECTED);
NextToken();
//We need to let the table node know it context
//it's used in SmNodeToTextVisitor
- SmToken aTok = CurToken;
+ SmToken aTok = m_aCurToken;
aTok.eType = TSTACK;
SmStructureNode *pSNode = new SmTableNode(aTok);
pSNode->SetSubNodes(ExpressionArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
else
Error(PE_LGROUP_EXPECTED);
@@ -2231,9 +2232,9 @@ void SmParser::Matrix()
SmNodeArray ExpressionArray;
NextToken();
- if (CurToken.eType == TLGROUP)
+ if (m_aCurToken.eType == TLGROUP)
{
- USHORT c = 0;
+ sal_uInt16 c = 0;
do
{
@@ -2241,19 +2242,19 @@ void SmParser::Matrix()
Align();
c++;
}
- while (CurToken.eType == TPOUND);
+ while (m_aCurToken.eType == TPOUND);
- USHORT r = 1;
+ sal_uInt16 r = 1;
- while (CurToken.eType == TDPOUND)
+ while (m_aCurToken.eType == TDPOUND)
{
NextToken();
- for (USHORT i = 0; i < c; i++)
+ for (sal_uInt16 i = 0; i < c; i++)
{
Align();
if (i < (c - 1))
{
- if (CurToken.eType == TPOUND)
+ if (m_aCurToken.eType == TPOUND)
{
NextToken();
}
@@ -2269,18 +2270,18 @@ void SmParser::Matrix()
ExpressionArray.resize(nRC);
- for (USHORT i = 0; i < (nRC); i++)
- ExpressionArray[(nRC) - (i + 1)] = NodeStack.Pop();
+ for (sal_uInt16 i = 0; i < (nRC); i++)
+ ExpressionArray[(nRC) - (i + 1)] = m_aNodeStack.Pop();
- if (CurToken.eType != TRGROUP)
+ if (m_aCurToken.eType != TRGROUP)
Error(PE_RGROUP_EXPECTED);
NextToken();
- SmMatrixNode *pMNode = new SmMatrixNode(CurToken);
+ SmMatrixNode *pMNode = new SmMatrixNode(m_aCurToken);
pMNode->SetSubNodes(ExpressionArray);
pMNode->SetRowCol(r, c);
- NodeStack.Push(pMNode);
+ m_aNodeStack.Push(pMNode);
}
else
Error(PE_LGROUP_EXPECTED);
@@ -2290,7 +2291,7 @@ void SmParser::Matrix()
void SmParser::Special()
{
bool bReplace = false;
- String &rName = CurToken.aText;
+ String &rName = m_aCurToken.aText;
String aNewName;
if (CONVERT_NONE == GetConversion())
@@ -2336,8 +2337,8 @@ void SmParser::Special()
{
OSL_ENSURE( pFrom->Count() == pTo->Count(),
"array length mismatch" );
- USHORT nCount = sal::static_int_cast< USHORT >(pFrom->Count());
- for (USHORT i = 0; i < nCount; ++i)
+ sal_uInt16 nCount = sal::static_int_cast< sal_uInt16 >(pFrom->Count());
+ for (sal_uInt16 i = 0; i < nCount; ++i)
{
if (pFrom->GetString(i) == rName)
{
@@ -2357,28 +2358,33 @@ void SmParser::Special()
rName = aNewName;
}
- NodeStack.Push(new SmSpecialNode(CurToken));
+ // add symbol name to list of used symbols
+ const String aSymbolName( m_aCurToken.aText.Copy( 1 ) );
+ if (aSymbolName.Len() > 0 )
+ AddToUsedSymbols( aSymbolName );
+
+ m_aNodeStack.Push(new SmSpecialNode(m_aCurToken));
NextToken();
}
void SmParser::GlyphSpecial()
{
- NodeStack.Push(new SmGlyphSpecialNode(CurToken));
+ m_aNodeStack.Push(new SmGlyphSpecialNode(m_aCurToken));
NextToken();
}
void SmParser::Error(SmParseError eError)
{
- SmStructureNode *pSNode = new SmExpressionNode(CurToken);
- SmErrorNode *pErr = new SmErrorNode(eError, CurToken);
+ SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken);
+ SmErrorNode *pErr = new SmErrorNode(eError, m_aCurToken);
pSNode->SetSubNodes(pErr, 0);
//! put a structure node on the stack (instead of the error node itself)
//! because sometimes such a node is expected in order to attach some
//! subnodes
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
AddError(eError, pSNode);
@@ -2391,56 +2397,57 @@ void SmParser::Error(SmParseError eError)
SmParser::SmParser()
{
- eConversion = CONVERT_NONE;
- bImportSymNames = bExportSymNames = false;
- nLang = Application::GetSettings().GetUILanguage();
+ m_eConversion = CONVERT_NONE;
+ bImportSymNames = m_bExportSymNames = false;
+ m_nLang = Application::GetSettings().GetUILanguage();
}
-
SmNode *SmParser::Parse(const String &rBuffer)
{
- BufferString = rBuffer;
- BufferString.ConvertLineEnd( LINEEND_LF );
- BufferIndex = 0;
- nTokenIndex = 0;
- Row = 1;
- ColOff = 0;
- CurError = -1;
+ ClearUsedSymbols();
+
+ m_aBufferString = rBuffer;
+ m_aBufferString.ConvertLineEnd( LINEEND_LF );
+ m_nBufferIndex = 0;
+ m_nTokenIndex = 0;
+ m_Row = 1;
+ m_nColOff = 0;
+ m_nCurError = -1;
- for ( size_t i = 0, n = ErrDescList.size(); i < n; ++i )
- delete ErrDescList[ i ];
- ErrDescList.clear();
+ for ( size_t i = 0, n = m_aErrDescList.size(); i < n; ++i )
+ delete m_aErrDescList[ i ];
+ m_aErrDescList.clear();
- NodeStack.Clear();
+ m_aNodeStack.Clear();
SetLanguage( Application::GetSettings().GetUILanguage() );
NextToken();
Table();
- return NodeStack.Pop();
+ return m_aNodeStack.Pop();
}
SmNode *SmParser::ParseExpression(const String &rBuffer)
{
- BufferString = rBuffer;
- BufferString.ConvertLineEnd( LINEEND_LF );
- BufferIndex = 0;
- nTokenIndex = 0;
- Row = 1;
- ColOff = 0;
- CurError = -1;
+ m_aBufferString = rBuffer;
+ m_aBufferString.ConvertLineEnd( LINEEND_LF );
+ m_nBufferIndex = 0;
+ m_nTokenIndex = 0;
+ m_Row = 1;
+ m_nColOff = 0;
+ m_nCurError = -1;
- for ( size_t i = 0, n = ErrDescList.size(); i < n; ++i )
- delete ErrDescList[ i ];
- ErrDescList.clear();
+ for ( size_t i = 0, n = m_aErrDescList.size(); i < n; ++i )
+ delete m_aErrDescList[ i ];
+ m_aErrDescList.clear();
- NodeStack.Clear();
+ m_aNodeStack.Clear();
SetLanguage( Application::GetSettings().GetUILanguage() );
NextToken();
Expression();
- return NodeStack.Pop();
+ return m_aNodeStack.Pop();
}
@@ -2452,7 +2459,7 @@ size_t SmParser::AddError(SmParseError Type, SmNode *pNode)
pErrDesc->pNode = pNode;
pErrDesc->Text = String(SmResId(RID_ERR_IDENT));
- USHORT nRID;
+ sal_uInt16 nRID;
switch (Type)
{
case PE_UNEXPECTED_CHAR: nRID = RID_ERR_UNEXPECTEDCHARACTER; break;
@@ -2474,20 +2481,20 @@ size_t SmParser::AddError(SmParseError Type, SmNode *pNode)
}
pErrDesc->Text += SmResId(nRID);
- ErrDescList.push_back( pErrDesc );
+ m_aErrDescList.push_back( pErrDesc );
- return ErrDescList.size()-1;
+ return m_aErrDescList.size()-1;
}
const SmErrorDesc *SmParser::NextError()
{
- if ( !ErrDescList.empty() )
- if (CurError > 0) return ErrDescList[ --CurError ];
+ if ( !m_aErrDescList.empty() )
+ if (m_nCurError > 0) return m_aErrDescList[ --m_nCurError ];
else
{
- CurError = 0;
- return ErrDescList[ CurError ];
+ m_nCurError = 0;
+ return m_aErrDescList[ m_nCurError ];
}
else return NULL;
}
@@ -2495,12 +2502,12 @@ const SmErrorDesc *SmParser::NextError()
const SmErrorDesc *SmParser::PrevError()
{
- if ( !ErrDescList.empty() )
- if (CurError < (int) (ErrDescList.size() - 1)) return ErrDescList[ ++CurError ];
+ if ( !m_aErrDescList.empty() )
+ if (m_nCurError < (int) (m_aErrDescList.size() - 1)) return m_aErrDescList[ ++m_nCurError ];
else
{
- CurError = (int) (ErrDescList.size() - 1);
- return ErrDescList[ CurError ];
+ m_nCurError = (int) (m_aErrDescList.size() - 1);
+ return m_aErrDescList[ m_nCurError ];
}
else return NULL;
}
@@ -2508,9 +2515,9 @@ const SmErrorDesc *SmParser::PrevError()
const SmErrorDesc *SmParser::GetError(size_t i)
{
- return ( i < ErrDescList.size() )
- ? ErrDescList[ i ]
- : ErrDescList[ CurError ];
+ return ( i < m_aErrDescList.size() )
+ ? m_aErrDescList[ i ]
+ : m_aErrDescList[ m_nCurError ];
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */