Kaydet (Commit) 768708ea authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: prefix members of CSS1Parser

Change-Id: Iaf7ed92d3ef132a79de30f0d596acdfba9c7185a
Reviewed-on: https://gerrit.libreoffice.org/71848Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst ddea1727
...@@ -40,11 +40,11 @@ ...@@ -40,11 +40,11 @@
#define LOOP_CHECK_RESTART \ #define LOOP_CHECK_RESTART \
nOldInPos = SAL_MAX_INT32; nOldInPos = SAL_MAX_INT32;
#define LOOP_CHECK_CHECK( where ) \ #define LOOP_CHECK_CHECK( where ) \
OSL_ENSURE( nOldInPos!=nInPos || cNextCh==sal_Unicode(EOF), where ); \ OSL_ENSURE( nOldInPos!=m_nInPos || m_cNextCh==sal_Unicode(EOF), where ); \
if( nOldInPos==nInPos && cNextCh!=sal_Unicode(EOF) ) \ if( nOldInPos==m_nInPos && m_cNextCh!=sal_Unicode(EOF) ) \
break; \ break; \
else \ else \
nOldInPos = nInPos; nOldInPos = m_nInPos;
#else #else
...@@ -58,38 +58,38 @@ const sal_Int32 MAX_LEN = 1024; ...@@ -58,38 +58,38 @@ const sal_Int32 MAX_LEN = 1024;
void CSS1Parser::InitRead( const OUString& rIn ) void CSS1Parser::InitRead( const OUString& rIn )
{ {
nlLineNr = 0; m_nlLineNr = 0;
nlLinePos = 0; m_nlLinePos = 0;
bWhiteSpace = true; // if nothing was read it's like there was WS m_bWhiteSpace = true; // if nothing was read it's like there was WS
bEOF = false; m_bEOF = false;
eState = CSS1_PAR_WORKING; m_eState = CSS1_PAR_WORKING;
nValue = 0.; m_nValue = 0.;
aIn = rIn; m_aIn = rIn;
nInPos = 0; m_nInPos = 0;
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
sal_Unicode CSS1Parser::GetNextChar() sal_Unicode CSS1Parser::GetNextChar()
{ {
if( nInPos >= aIn.getLength() ) if( m_nInPos >= m_aIn.getLength() )
{ {
bEOF = true; m_bEOF = true;
return sal_Unicode(EOF); return sal_Unicode(EOF);
} }
sal_Unicode c = aIn[nInPos]; sal_Unicode c = m_aIn[m_nInPos];
nInPos++; m_nInPos++;
if( c == '\n' ) if( c == '\n' )
{ {
++nlLineNr; ++m_nlLineNr;
nlLinePos = 1; m_nlLinePos = 1;
} }
else else
++nlLinePos; ++m_nlLinePos;
return c; return c;
} }
...@@ -105,29 +105,29 @@ sal_Unicode CSS1Parser::GetNextChar() ...@@ -105,29 +105,29 @@ sal_Unicode CSS1Parser::GetNextChar()
CSS1Token CSS1Parser::GetNextToken() CSS1Token CSS1Parser::GetNextToken()
{ {
CSS1Token nRet = CSS1_NULL; CSS1Token nRet = CSS1_NULL;
aToken.clear(); m_aToken.clear();
do { do {
// remember if white space was read // remember if white space was read
bool bPrevWhiteSpace = bWhiteSpace; bool bPrevWhiteSpace = m_bWhiteSpace;
bWhiteSpace = false; m_bWhiteSpace = false;
bool bNextCh = true; bool bNextCh = true;
switch( cNextCh ) switch( m_cNextCh )
{ {
case '/': // COMMENT | '/' case '/': // COMMENT | '/'
{ {
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
if( '*' == cNextCh ) if( '*' == m_cNextCh )
{ {
// COMMENT // COMMENT
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
bool bAsterisk = false; bool bAsterisk = false;
while( !(bAsterisk && '/'==cNextCh) && !IsEOF() ) while( !(bAsterisk && '/'==m_cNextCh) && !IsEOF() )
{ {
bAsterisk = ('*'==cNextCh); bAsterisk = ('*'==m_cNextCh);
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} }
} }
else else
...@@ -141,30 +141,30 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -141,30 +141,30 @@ CSS1Token CSS1Parser::GetNextToken()
case '@': // '@import' | '@XXX' case '@': // '@import' | '@XXX'
{ {
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
if (rtl::isAsciiAlpha(cNextCh)) if (rtl::isAsciiAlpha(m_cNextCh))
{ {
// scan the next identifier // scan the next identifier
OUStringBuffer sTmpBuffer(32); OUStringBuffer sTmpBuffer(32);
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( (rtl::isAsciiAlphanumeric(cNextCh) || } while( (rtl::isAsciiAlphanumeric(m_cNextCh) ||
'-' == cNextCh) && !IsEOF() ); '-' == m_cNextCh) && !IsEOF() );
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
// check if we know it // check if we know it
switch( aToken[0] ) switch( m_aToken[0] )
{ {
case 'i': case 'i':
case 'I': case 'I':
if( aToken.equalsIgnoreAsciiCase( "import" ) ) if( m_aToken.equalsIgnoreAsciiCase( "import" ) )
nRet = CSS1_IMPORT_SYM; nRet = CSS1_IMPORT_SYM;
break; break;
case 'p': case 'p':
case 'P': case 'P':
if( aToken.equalsIgnoreAsciiCase( "page" ) ) if( m_aToken.equalsIgnoreAsciiCase( "page" ) )
nRet = CSS1_PAGE_SYM; nRet = CSS1_PAGE_SYM;
break; break;
} }
...@@ -173,7 +173,7 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -173,7 +173,7 @@ CSS1Token CSS1Parser::GetNextToken()
// semicolon at end of the next block // semicolon at end of the next block
if( CSS1_NULL==nRet ) if( CSS1_NULL==nRet )
{ {
aToken.clear(); m_aToken.clear();
int nBlockLvl = 0; int nBlockLvl = 0;
sal_Unicode cQuoteCh = 0; sal_Unicode cQuoteCh = 0;
bool bDone = false, bEscape = false; bool bDone = false, bEscape = false;
...@@ -181,7 +181,7 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -181,7 +181,7 @@ CSS1Token CSS1Parser::GetNextToken()
{ {
bool bOldEscape = bEscape; bool bOldEscape = bEscape;
bEscape = false; bEscape = false;
switch( cNextCh ) switch( m_cNextCh )
{ {
case '{': case '{':
if( !cQuoteCh && !bOldEscape ) if( !cQuoteCh && !bOldEscape )
...@@ -201,12 +201,12 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -201,12 +201,12 @@ CSS1Token CSS1Parser::GetNextToken()
{ {
if( cQuoteCh ) if( cQuoteCh )
{ {
if( cQuoteCh == cNextCh ) if( cQuoteCh == m_cNextCh )
cQuoteCh = 0; cQuoteCh = 0;
} }
else else
{ {
cQuoteCh = cNextCh; cQuoteCh = m_cNextCh;
} }
} }
break; break;
...@@ -215,7 +215,7 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -215,7 +215,7 @@ CSS1Token CSS1Parser::GetNextToken()
bEscape = true; bEscape = true;
break; break;
} }
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} }
} }
...@@ -227,28 +227,28 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -227,28 +227,28 @@ CSS1Token CSS1Parser::GetNextToken()
case '!': // '!' 'legal' | '!' 'important' | syntax error case '!': // '!' 'legal' | '!' 'important' | syntax error
{ {
// ignore white space // ignore white space
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
while( ( ' ' == cNextCh || while( ( ' ' == m_cNextCh ||
(cNextCh >= 0x09 && cNextCh <= 0x0d) ) && !IsEOF() ) (m_cNextCh >= 0x09 && m_cNextCh <= 0x0d) ) && !IsEOF() )
{ {
bWhiteSpace = true; m_bWhiteSpace = true;
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} }
if( 'i'==cNextCh || 'I'==cNextCh) if( 'i'==m_cNextCh || 'I'==m_cNextCh)
{ {
// scan next identifier // scan next identifier
OUStringBuffer sTmpBuffer(32); OUStringBuffer sTmpBuffer(32);
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( (rtl::isAsciiAlphanumeric(cNextCh) || } while( (rtl::isAsciiAlphanumeric(m_cNextCh) ||
'-' == cNextCh) && !IsEOF() ); '-' == m_cNextCh) && !IsEOF() );
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
if( ( 'i'==aToken[0] || 'I'==aToken[0] ) && if( ( 'i'==m_aToken[0] || 'I'==m_aToken[0] ) &&
aToken.equalsIgnoreAsciiCase( "important" ) ) m_aToken.equalsIgnoreAsciiCase( "important" ) )
{ {
// '!' 'important' // '!' 'important'
nRet = CSS1_IMPORTANT_SYM; nRet = CSS1_IMPORTANT_SYM;
...@@ -259,7 +259,7 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -259,7 +259,7 @@ CSS1Token CSS1Parser::GetNextToken()
nRet = CSS1_IDENT; nRet = CSS1_IDENT;
} }
bWhiteSpace = false; m_bWhiteSpace = false;
bNextCh = false; bNextCh = false;
} }
else else
...@@ -274,16 +274,16 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -274,16 +274,16 @@ CSS1Token CSS1Parser::GetNextToken()
case '\'': // STRING case '\'': // STRING
{ {
// \... isn't possible yet!!! // \... isn't possible yet!!!
sal_Unicode cQuoteChar = cNextCh; sal_Unicode cQuoteChar = m_cNextCh;
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
OUStringBuffer sTmpBuffer( MAX_LEN ); OUStringBuffer sTmpBuffer( MAX_LEN );
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( cQuoteChar != cNextCh && !IsEOF() ); } while( cQuoteChar != m_cNextCh && !IsEOF() );
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
nRet = CSS1_STRING; nRet = CSS1_STRING;
} }
...@@ -301,27 +301,27 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -301,27 +301,27 @@ CSS1Token CSS1Parser::GetNextToken()
case '9': // NUMBER | PERCENTAGE | LENGTH case '9': // NUMBER | PERCENTAGE | LENGTH
{ {
// save current position // save current position
std::size_t nInPosSave = nInPos; std::size_t nInPosSave = m_nInPos;
sal_Unicode cNextChSave = cNextCh; sal_Unicode cNextChSave = m_cNextCh;
sal_uInt32 nlLineNrSave = nlLineNr; sal_uInt32 nlLineNrSave = m_nlLineNr;
sal_uInt32 nlLinePosSave = nlLinePos; sal_uInt32 nlLinePosSave = m_nlLinePos;
bool bEOFSave = bEOF; bool bEOFSave = m_bEOF;
// first try to parse a hex digit // first try to parse a hex digit
OUStringBuffer sTmpBuffer( 16 ); OUStringBuffer sTmpBuffer( 16 );
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( sTmpBuffer.getLength() < 7 && } while( sTmpBuffer.getLength() < 7 &&
( ('0'<=cNextCh && '9'>=cNextCh) || ( ('0'<=m_cNextCh && '9'>=m_cNextCh) ||
('A'<=cNextCh && 'F'>=cNextCh) || ('A'<=m_cNextCh && 'F'>=m_cNextCh) ||
('a'<=cNextCh && 'f'>=cNextCh) ) && ('a'<=m_cNextCh && 'f'>=m_cNextCh) ) &&
!IsEOF() ); !IsEOF() );
if( sTmpBuffer.getLength()==6 ) if( sTmpBuffer.getLength()==6 )
{ {
// we found a color in hex // we found a color in hex
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
nRet = CSS1_HEXCOLOR; nRet = CSS1_HEXCOLOR;
bNextCh = false; bNextCh = false;
...@@ -329,36 +329,36 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -329,36 +329,36 @@ CSS1Token CSS1Parser::GetNextToken()
} }
// otherwise we try a number // otherwise we try a number
nInPos = nInPosSave; m_nInPos = nInPosSave;
cNextCh = cNextChSave; m_cNextCh = cNextChSave;
nlLineNr = nlLineNrSave; m_nlLineNr = nlLineNrSave;
nlLinePos = nlLinePosSave; m_nlLinePos = nlLinePosSave;
bEOF = bEOFSave; m_bEOF = bEOFSave;
// first parse the number // first parse the number
sTmpBuffer.setLength( 0 ); sTmpBuffer.setLength( 0 );
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( (('0'<=cNextCh && '9'>=cNextCh) || '.'==cNextCh) && } while( (('0'<=m_cNextCh && '9'>=m_cNextCh) || '.'==m_cNextCh) &&
!IsEOF() ); !IsEOF() );
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
nValue = aToken.toDouble(); m_nValue = m_aToken.toDouble();
// ignore white space // ignore white space
while( ( ' ' == cNextCh || while( ( ' ' == m_cNextCh ||
(cNextCh >= 0x09 && cNextCh <= 0x0d) ) && !IsEOF() ) (m_cNextCh >= 0x09 && m_cNextCh <= 0x0d) ) && !IsEOF() )
{ {
bWhiteSpace = true; m_bWhiteSpace = true;
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} }
// check now, of there is an unit // check now, of there is an unit
switch( cNextCh ) switch( m_cNextCh )
{ {
case '%': // PERCENTAGE case '%': // PERCENTAGE
bWhiteSpace = false; m_bWhiteSpace = false;
nRet = CSS1_PERCENTAGE; nRet = CSS1_PERCENTAGE;
break; break;
...@@ -374,20 +374,20 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -374,20 +374,20 @@ CSS1Token CSS1Parser::GetNextToken()
case 'M': // LENGTH mm | LENGTH IDENT case 'M': // LENGTH mm | LENGTH IDENT
{ {
// save current position // save current position
sal_Int32 nInPosOld = nInPos; sal_Int32 nInPosOld = m_nInPos;
sal_Unicode cNextChOld = cNextCh; sal_Unicode cNextChOld = m_cNextCh;
sal_uLong nlLineNrOld = nlLineNr; sal_uLong nlLineNrOld = m_nlLineNr;
sal_uLong nlLinePosOld = nlLinePos; sal_uLong nlLinePosOld = m_nlLinePos;
bool bEOFOld = bEOF; bool bEOFOld = m_bEOF;
// parse the next identifier // parse the next identifier
OUString aIdent; OUString aIdent;
OUStringBuffer sTmpBuffer2(64); OUStringBuffer sTmpBuffer2(64);
do { do {
sTmpBuffer2.append( cNextCh ); sTmpBuffer2.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( (rtl::isAsciiAlphanumeric(cNextCh) || } while( (rtl::isAsciiAlphanumeric(m_cNextCh) ||
'-' == cNextCh) && !IsEOF() ); '-' == m_cNextCh) && !IsEOF() );
aIdent += sTmpBuffer2; aIdent += sTmpBuffer2;
...@@ -460,19 +460,19 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -460,19 +460,19 @@ CSS1Token CSS1Parser::GetNextToken()
} }
if( CSS1_LENGTH==nRet && nScale!=1.0 ) if( CSS1_LENGTH==nRet && nScale!=1.0 )
nValue *= nScale; m_nValue *= nScale;
if( nRet == CSS1_NUMBER ) if( nRet == CSS1_NUMBER )
{ {
nInPos = nInPosOld; m_nInPos = nInPosOld;
cNextCh = cNextChOld; m_cNextCh = cNextChOld;
nlLineNr = nlLineNrOld; m_nlLineNr = nlLineNrOld;
nlLinePos = nlLinePosOld; m_nlLinePos = nlLinePosOld;
bEOF = bEOFOld; m_bEOF = bEOFOld;
} }
else else
{ {
bWhiteSpace = false; m_bWhiteSpace = false;
} }
bNextCh = false; bNextCh = false;
} }
...@@ -519,33 +519,33 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -519,33 +519,33 @@ CSS1Token CSS1Parser::GetNextToken()
break; break;
case '#': // '#' case '#': // '#'
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
if( ('0'<=cNextCh && '9'>=cNextCh) || if( ('0'<=m_cNextCh && '9'>=m_cNextCh) ||
('a'<=cNextCh && 'f'>=cNextCh) || ('a'<=m_cNextCh && 'f'>=m_cNextCh) ||
('A'<=cNextCh && 'F'>=cNextCh) ) ('A'<=m_cNextCh && 'F'>=m_cNextCh) )
{ {
// save current position // save current position
sal_Int32 nInPosSave = nInPos; sal_Int32 nInPosSave = m_nInPos;
sal_Unicode cNextChSave = cNextCh; sal_Unicode cNextChSave = m_cNextCh;
sal_uLong nlLineNrSave = nlLineNr; sal_uLong nlLineNrSave = m_nlLineNr;
sal_uLong nlLinePosSave = nlLinePos; sal_uLong nlLinePosSave = m_nlLinePos;
bool bEOFSave = bEOF; bool bEOFSave = m_bEOF;
// first try to parse a hex digit // first try to parse a hex digit
OUStringBuffer sTmpBuffer(6); OUStringBuffer sTmpBuffer(6);
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( sTmpBuffer.getLength() < 7 && } while( sTmpBuffer.getLength() < 7 &&
( ('0'<=cNextCh && '9'>=cNextCh) || ( ('0'<=m_cNextCh && '9'>=m_cNextCh) ||
('A'<=cNextCh && 'F'>=cNextCh) || ('A'<=m_cNextCh && 'F'>=m_cNextCh) ||
('a'<=cNextCh && 'f'>=cNextCh) ) && ('a'<=m_cNextCh && 'f'>=m_cNextCh) ) &&
!IsEOF() ); !IsEOF() );
if( sTmpBuffer.getLength()==6 || sTmpBuffer.getLength()==3 ) if( sTmpBuffer.getLength()==6 || sTmpBuffer.getLength()==3 )
{ {
// we found a color in hex // we found a color in hex
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
nRet = CSS1_HEXCOLOR; nRet = CSS1_HEXCOLOR;
bNextCh = false; bNextCh = false;
...@@ -553,11 +553,11 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -553,11 +553,11 @@ CSS1Token CSS1Parser::GetNextToken()
} }
// otherwise we try a number // otherwise we try a number
nInPos = nInPosSave; m_nInPos = nInPosSave;
cNextCh = cNextChSave; m_cNextCh = cNextChSave;
nlLineNr = nlLineNrSave; m_nlLineNr = nlLineNrSave;
nlLinePos = nlLinePosSave; m_nlLinePos = nlLinePosSave;
bEOF = bEOFSave; m_bEOF = bEOFSave;
} }
nRet = CSS1_HASH; nRet = CSS1_HASH;
...@@ -568,20 +568,20 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -568,20 +568,20 @@ CSS1Token CSS1Parser::GetNextToken()
case '\t': case '\t':
case '\r': case '\r':
case '\n': // White-Space case '\n': // White-Space
bWhiteSpace = true; m_bWhiteSpace = true;
break; break;
case sal_Unicode(EOF): case sal_Unicode(EOF):
if( IsEOF() ) if( IsEOF() )
{ {
eState = CSS1_PAR_ACCEPTED; m_eState = CSS1_PAR_ACCEPTED;
bNextCh = false; bNextCh = false;
break; break;
} }
[[fallthrough]]; [[fallthrough]];
default: // IDENT | syntax error default: // IDENT | syntax error
if (rtl::isAsciiAlpha(cNextCh)) if (rtl::isAsciiAlpha(m_cNextCh))
{ {
// IDENT // IDENT
...@@ -590,19 +590,19 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -590,19 +590,19 @@ CSS1Token CSS1Parser::GetNextToken()
// parse the next identifier // parse the next identifier
OUStringBuffer sTmpBuffer(64); OUStringBuffer sTmpBuffer(64);
do { do {
sTmpBuffer.append( cNextCh ); sTmpBuffer.append( m_cNextCh );
if( bHexColor ) if( bHexColor )
{ {
bHexColor = sTmpBuffer.getLength()<7 && bHexColor = sTmpBuffer.getLength()<7 &&
( ('0'<=cNextCh && '9'>=cNextCh) || ( ('0'<=m_cNextCh && '9'>=m_cNextCh) ||
('A'<=cNextCh && 'F'>=cNextCh) || ('A'<=m_cNextCh && 'F'>=m_cNextCh) ||
('a'<=cNextCh && 'f'>=cNextCh) ); ('a'<=m_cNextCh && 'f'>=m_cNextCh) );
} }
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( (rtl::isAsciiAlphanumeric(cNextCh) || } while( (rtl::isAsciiAlphanumeric(m_cNextCh) ||
'-' == cNextCh) && !IsEOF() ); '-' == m_cNextCh) && !IsEOF() );
aToken += sTmpBuffer; m_aToken += sTmpBuffer;
if( bHexColor && sTmpBuffer.getLength()==6 ) if( bHexColor && sTmpBuffer.getLength()==6 )
{ {
...@@ -611,27 +611,27 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -611,27 +611,27 @@ CSS1Token CSS1Parser::GetNextToken()
break; break;
} }
if( '('==cNextCh && if( '('==m_cNextCh &&
( (('u'==aToken[0] || 'U'==aToken[0]) && ( (('u'==m_aToken[0] || 'U'==m_aToken[0]) &&
aToken.equalsIgnoreAsciiCase( "url" )) || m_aToken.equalsIgnoreAsciiCase( "url" )) ||
(('r'==aToken[0] || 'R'==aToken[0]) && (('r'==m_aToken[0] || 'R'==m_aToken[0]) &&
aToken.equalsIgnoreAsciiCase( "rgb" )) ) ) m_aToken.equalsIgnoreAsciiCase( "rgb" )) ) )
{ {
int nNestCnt = 0; int nNestCnt = 0;
OUStringBuffer sTmpBuffer2(64); OUStringBuffer sTmpBuffer2(64);
do { do {
sTmpBuffer2.append( cNextCh ); sTmpBuffer2.append( m_cNextCh );
switch( cNextCh ) switch( m_cNextCh )
{ {
case '(': nNestCnt++; break; case '(': nNestCnt++; break;
case ')': nNestCnt--; break; case ')': nNestCnt--; break;
} }
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( (nNestCnt>1 || ')'!=cNextCh) && !IsEOF() ); } while( (nNestCnt>1 || ')'!=m_cNextCh) && !IsEOF() );
sTmpBuffer2.append( cNextCh ); sTmpBuffer2.append( m_cNextCh );
aToken += sTmpBuffer2; m_aToken += sTmpBuffer2;
bNextCh = true; bNextCh = true;
nRet = 'u'==aToken[0] || 'U'==aToken[0] nRet = 'u'==m_aToken[0] || 'U'==m_aToken[0]
? CSS1_URL ? CSS1_URL
: CSS1_RGB; : CSS1_RGB;
} }
...@@ -645,7 +645,7 @@ CSS1Token CSS1Parser::GetNextToken() ...@@ -645,7 +645,7 @@ CSS1Token CSS1Parser::GetNextToken()
break; break;
} }
if( bNextCh ) if( bNextCh )
cNextCh = GetNextChar(); m_cNextCh = GetNextChar();
} while( CSS1_NULL==nRet && IsParserWorking() ); } while( CSS1_NULL==nRet && IsParserWorking() );
...@@ -679,12 +679,12 @@ void CSS1Parser::ParseStyleSheet() ...@@ -679,12 +679,12 @@ void CSS1Parser::ParseStyleSheet()
{ {
LOOP_CHECK_CHECK( "Infinite loop in ParseStyleSheet()/import *" ) LOOP_CHECK_CHECK( "Infinite loop in ParseStyleSheet()/import *" )
switch( nToken ) switch( m_nToken )
{ {
case CSS1_IMPORT_SYM: case CSS1_IMPORT_SYM:
// IMPORT_SYM url // IMPORT_SYM url
// URL are skipped without checks // URL are skipped without checks
nToken = GetNextToken(); m_nToken = GetNextToken();
break; break;
case CSS1_IDENT: // Look-Aheads case CSS1_IDENT: // Look-Aheads
case CSS1_DOT_W_WS: case CSS1_DOT_W_WS:
...@@ -699,7 +699,7 @@ void CSS1Parser::ParseStyleSheet() ...@@ -699,7 +699,7 @@ void CSS1Parser::ParseStyleSheet()
} }
if( !bDone ) if( !bDone )
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
LOOP_CHECK_RESTART LOOP_CHECK_RESTART
...@@ -709,7 +709,7 @@ void CSS1Parser::ParseStyleSheet() ...@@ -709,7 +709,7 @@ void CSS1Parser::ParseStyleSheet()
{ {
LOOP_CHECK_CHECK( "Infinite loop in ParseStyleSheet()/rule *" ) LOOP_CHECK_CHECK( "Infinite loop in ParseStyleSheet()/rule *" )
switch( nToken ) switch( m_nToken )
{ {
case CSS1_IDENT: // Look-Aheads case CSS1_IDENT: // Look-Aheads
case CSS1_DOT_W_WS: case CSS1_DOT_W_WS:
...@@ -720,7 +720,7 @@ void CSS1Parser::ParseStyleSheet() ...@@ -720,7 +720,7 @@ void CSS1Parser::ParseStyleSheet()
break; break;
default: default:
// error handling: ignore // error handling: ignore
nToken = GetNextToken(); m_nToken = GetNextToken();
break; break;
} }
} }
...@@ -743,12 +743,12 @@ void CSS1Parser::ParseRule() ...@@ -743,12 +743,12 @@ void CSS1Parser::ParseRule()
LOOP_CHECK_DECL LOOP_CHECK_DECL
// [ ',' selector ]* // [ ',' selector ]*
while( CSS1_COMMA==nToken && IsParserWorking() ) while( CSS1_COMMA==m_nToken && IsParserWorking() )
{ {
LOOP_CHECK_CHECK( "Infinite loop in ParseRule()/selector *" ) LOOP_CHECK_CHECK( "Infinite loop in ParseRule()/selector *" )
// ignore ',' // ignore ','
nToken = GetNextToken(); m_nToken = GetNextToken();
// selector // selector
pSelector = ParseSelector(); pSelector = ParseSelector();
...@@ -760,9 +760,9 @@ void CSS1Parser::ParseRule() ...@@ -760,9 +760,9 @@ void CSS1Parser::ParseRule()
} }
// '{' // '{'
if( CSS1_OBRACE != nToken ) if( CSS1_OBRACE != m_nToken )
return; return;
nToken = GetNextToken(); m_nToken = GetNextToken();
// declaration // declaration
OUString aProperty; OUString aProperty;
...@@ -776,15 +776,15 @@ void CSS1Parser::ParseRule() ...@@ -776,15 +776,15 @@ void CSS1Parser::ParseRule()
LOOP_CHECK_RESTART LOOP_CHECK_RESTART
// [ ';' declaration ]* // [ ';' declaration ]*
while( CSS1_SEMICOLON==nToken && IsParserWorking() ) while( CSS1_SEMICOLON==m_nToken && IsParserWorking() )
{ {
LOOP_CHECK_CHECK( "Infinite loop in ParseRule()/declaration *" ) LOOP_CHECK_CHECK( "Infinite loop in ParseRule()/declaration *" )
// ';' // ';'
nToken = GetNextToken(); m_nToken = GetNextToken();
// declaration // declaration
if( CSS1_IDENT == nToken ) if( CSS1_IDENT == m_nToken )
{ {
std::unique_ptr<CSS1Expression> pExp = ParseDeclaration( aProperty ); std::unique_ptr<CSS1Expression> pExp = ParseDeclaration( aProperty );
if( pExp ) if( pExp )
...@@ -796,8 +796,8 @@ void CSS1Parser::ParseRule() ...@@ -796,8 +796,8 @@ void CSS1Parser::ParseRule()
} }
// '}' // '}'
if( CSS1_CBRACE == nToken ) if( CSS1_CBRACE == m_nToken )
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
// selector // selector
...@@ -837,26 +837,26 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector() ...@@ -837,26 +837,26 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector()
bool bNextToken = true; bool bNextToken = true;
switch( nToken ) switch( m_nToken )
{ {
case CSS1_IDENT: case CSS1_IDENT:
{ {
// element_name [ DOT_WO_WS class ]? // element_name [ DOT_WO_WS class ]?
// element_name // element_name
OUString aElement = aToken; OUString aElement = m_aToken;
CSS1SelectorType eType = CSS1_SELTYPE_ELEMENT; CSS1SelectorType eType = CSS1_SELTYPE_ELEMENT;
nToken = GetNextToken(); m_nToken = GetNextToken();
if( CSS1_DOT_WO_WS == nToken ) if( CSS1_DOT_WO_WS == m_nToken )
{ {
// DOT_WO_WS // DOT_WO_WS
nToken = GetNextToken(); m_nToken = GetNextToken();
// class // class
if( CSS1_IDENT == nToken ) if( CSS1_IDENT == m_nToken )
{ {
aElement += "." + aToken; aElement += "." + m_aToken;
eType = CSS1_SELTYPE_ELEM_CLASS; eType = CSS1_SELTYPE_ELEM_CLASS;
} }
else else
...@@ -877,12 +877,12 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector() ...@@ -877,12 +877,12 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector()
// DOT_W_WS class // DOT_W_WS class
// DOT_W_WS // DOT_W_WS
nToken = GetNextToken(); m_nToken = GetNextToken();
if( CSS1_IDENT==nToken ) if( CSS1_IDENT==m_nToken )
{ {
// class // class
pNew = new CSS1Selector( CSS1_SELTYPE_CLASS, aToken ); pNew = new CSS1Selector( CSS1_SELTYPE_CLASS, m_aToken );
} }
else else
{ {
...@@ -894,12 +894,12 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector() ...@@ -894,12 +894,12 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector()
// '#' id_selector // '#' id_selector
// '#' // '#'
nToken = GetNextToken(); m_nToken = GetNextToken();
if( CSS1_IDENT==nToken ) if( CSS1_IDENT==m_nToken )
{ {
// id_selector // id_selector
pNew = new CSS1Selector( CSS1_SELTYPE_ID, aToken ); pNew = new CSS1Selector( CSS1_SELTYPE_ID, m_aToken );
} }
else else
{ {
...@@ -911,7 +911,7 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector() ...@@ -911,7 +911,7 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector()
case CSS1_PAGE_SYM: case CSS1_PAGE_SYM:
{ {
// @page // @page
pNew = new CSS1Selector( CSS1_SELTYPE_PAGE, aToken ); pNew = new CSS1Selector( CSS1_SELTYPE_PAGE, m_aToken );
} }
break; break;
...@@ -936,7 +936,7 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector() ...@@ -936,7 +936,7 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector()
} }
if( bNextToken && !bDone ) if( bNextToken && !bDone )
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
if( !pRoot ) if( !pRoot )
...@@ -946,14 +946,14 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector() ...@@ -946,14 +946,14 @@ std::unique_ptr<CSS1Selector> CSS1Parser::ParseSelector()
} }
// [ ':' pseudo_element ]? // [ ':' pseudo_element ]?
if( CSS1_COLON==nToken && IsParserWorking() ) if( CSS1_COLON==m_nToken && IsParserWorking() )
{ {
// ':' pseudo element // ':' pseudo element
nToken = GetNextToken(); m_nToken = GetNextToken();
if( CSS1_IDENT==nToken ) if( CSS1_IDENT==m_nToken )
{ {
pLast->SetNext( new CSS1Selector(CSS1_SELTYPE_PSEUDO,aToken) ); pLast->SetNext( new CSS1Selector(CSS1_SELTYPE_PSEUDO,m_aToken) );
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
else else
{ {
...@@ -994,22 +994,22 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert ...@@ -994,22 +994,22 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert
CSS1Expression *pLast = nullptr; CSS1Expression *pLast = nullptr;
// property // property
if( CSS1_IDENT != nToken ) if( CSS1_IDENT != m_nToken )
{ {
// missing property // missing property
return pRoot; return pRoot;
} }
rProperty = aToken; rProperty = m_aToken;
nToken = GetNextToken(); m_nToken = GetNextToken();
// ':' // ':'
if( CSS1_COLON != nToken ) if( CSS1_COLON != m_nToken )
{ {
// missing ':' // missing ':'
return pRoot; return pRoot;
} }
nToken = GetNextToken(); m_nToken = GetNextToken();
// term [operator term]* // term [operator term]*
// here we're pretty lax regarding the syntax, but this shouldn't // here we're pretty lax regarding the syntax, but this shouldn't
...@@ -1024,7 +1024,7 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert ...@@ -1024,7 +1024,7 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert
{ {
LOOP_CHECK_CHECK( "Infinite loop in ParseDeclaration()" ) LOOP_CHECK_CHECK( "Infinite loop in ParseDeclaration()" )
switch( nToken ) switch( m_nToken )
{ {
case CSS1_MINUS: case CSS1_MINUS:
cSign = '-'; cSign = '-';
...@@ -1040,7 +1040,7 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert ...@@ -1040,7 +1040,7 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert
case CSS1_EMS: case CSS1_EMS:
case CSS1_EMX: case CSS1_EMX:
if( '-'==cSign ) if( '-'==cSign )
nValue = -nValue; m_nValue = -m_nValue;
[[fallthrough]]; [[fallthrough]];
case CSS1_STRING: case CSS1_STRING:
case CSS1_PERCENTAGE: case CSS1_PERCENTAGE:
...@@ -1048,8 +1048,8 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert ...@@ -1048,8 +1048,8 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert
case CSS1_URL: case CSS1_URL:
case CSS1_RGB: case CSS1_RGB:
case CSS1_HEXCOLOR: case CSS1_HEXCOLOR:
pNew = new CSS1Expression( nToken, aToken, nValue, cOp ); pNew = new CSS1Expression( m_nToken, m_aToken, m_nValue, cOp );
nValue = 0; // otherwise this also is applied to next ident m_nValue = 0; // otherwise this also is applied to next ident
cSign = 0; cSign = 0;
cOp = 0; cOp = 0;
break; break;
...@@ -1084,7 +1084,7 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert ...@@ -1084,7 +1084,7 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert
} }
if( !bDone ) if( !bDone )
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
if( !pRoot ) if( !pRoot )
...@@ -1094,25 +1094,25 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert ...@@ -1094,25 +1094,25 @@ std::unique_ptr<CSS1Expression> CSS1Parser::ParseDeclaration( OUString& rPropert
} }
// prio? // prio?
if( CSS1_IMPORTANT_SYM==nToken ) if( CSS1_IMPORTANT_SYM==m_nToken )
{ {
// IMPORTANT_SYM // IMPORTANT_SYM
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
return pRoot; return pRoot;
} }
CSS1Parser::CSS1Parser() CSS1Parser::CSS1Parser()
: bWhiteSpace(false) : m_bWhiteSpace(false)
, bEOF(false) , m_bEOF(false)
, cNextCh(0) , m_cNextCh(0)
, nInPos(0) , m_nInPos(0)
, nlLineNr(0) , m_nlLineNr(0)
, nlLinePos(0) , m_nlLinePos(0)
, nValue(0) , m_nValue(0)
, eState(CSS1_PAR_ACCEPTED) , m_eState(CSS1_PAR_ACCEPTED)
, nToken(CSS1_NULL) , m_nToken(CSS1_NULL)
{ {
} }
...@@ -1158,9 +1158,9 @@ void CSS1Parser::ParseStyleOption( const OUString& rIn ) ...@@ -1158,9 +1158,9 @@ void CSS1Parser::ParseStyleOption( const OUString& rIn )
InitRead( rIn ); InitRead( rIn );
// fdo#41796: skip over spurious semicolons // fdo#41796: skip over spurious semicolons
while (CSS1_SEMICOLON == nToken) while (CSS1_SEMICOLON == m_nToken)
{ {
nToken = GetNextToken(); m_nToken = GetNextToken();
} }
OUString aProperty; OUString aProperty;
...@@ -1174,12 +1174,12 @@ void CSS1Parser::ParseStyleOption( const OUString& rIn ) ...@@ -1174,12 +1174,12 @@ void CSS1Parser::ParseStyleOption( const OUString& rIn )
LOOP_CHECK_DECL LOOP_CHECK_DECL
// [ ';' declaration ]* // [ ';' declaration ]*
while( CSS1_SEMICOLON==nToken && IsParserWorking() ) while( CSS1_SEMICOLON==m_nToken && IsParserWorking() )
{ {
LOOP_CHECK_CHECK( "Infinite loop in ParseStyleOption()" ) LOOP_CHECK_CHECK( "Infinite loop in ParseStyleOption()" )
nToken = GetNextToken(); m_nToken = GetNextToken();
if( CSS1_IDENT==nToken ) if( CSS1_IDENT==m_nToken )
{ {
std::unique_ptr<CSS1Expression> pExp = ParseDeclaration( aProperty ); std::unique_ptr<CSS1Expression> pExp = ParseDeclaration( aProperty );
if( pExp ) if( pExp )
......
...@@ -173,23 +173,23 @@ inline sal_Int32 CSS1Expression::GetSLength() const ...@@ -173,23 +173,23 @@ inline sal_Int32 CSS1Expression::GetSLength() const
*/ */
class CSS1Parser class CSS1Parser
{ {
bool bWhiteSpace : 1; // read a whitespace? bool m_bWhiteSpace : 1; // read a whitespace?
bool bEOF : 1; // is end of "file"? bool m_bEOF : 1; // is end of "file"?
sal_Unicode cNextCh; // next character sal_Unicode m_cNextCh; // next character
sal_Int32 nInPos; // current position in the input string sal_Int32 m_nInPos; // current position in the input string
sal_uInt32 nlLineNr; // current row number sal_uInt32 m_nlLineNr; // current row number
sal_uInt32 nlLinePos; // current column number sal_uInt32 m_nlLinePos; // current column number
double nValue; // value of the token as number double m_nValue; // value of the token as number
CSS1ParserState eState; // current state of the parser CSS1ParserState m_eState; // current state of the parser
CSS1Token nToken; // the current token CSS1Token m_nToken; // the current token
OUString aIn; // the string to parse OUString m_aIn; // the string to parse
OUString aToken; // token as string OUString m_aToken; // token as string
/// prepare parsing /// prepare parsing
void InitRead( const OUString& rIn ); void InitRead( const OUString& rIn );
...@@ -201,9 +201,9 @@ class CSS1Parser ...@@ -201,9 +201,9 @@ class CSS1Parser
CSS1Token GetNextToken(); CSS1Token GetNextToken();
/// Is the parser still working? /// Is the parser still working?
bool IsParserWorking() const { return CSS1_PAR_WORKING == eState; } bool IsParserWorking() const { return CSS1_PAR_WORKING == m_eState; }
bool IsEOF() const { return bEOF; } bool IsEOF() const { return m_bEOF; }
// parse parts of the grammar // parse parts of the grammar
void ParseRule(); void ParseRule();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment