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