Kaydet (Commit) 53a662f5 authored tarafından August Sodora's avatar August Sodora

Refactoring in scanner

üst ac4b051e
...@@ -161,6 +161,28 @@ inline bool lclIsWhitespace( sal_Unicode cChar ) ...@@ -161,6 +161,28 @@ inline bool lclIsWhitespace( sal_Unicode cChar )
} // namespace } // namespace
void SbiScanner::scanGoto()
{
const sal_Unicode* pTestLine = pLine;
short nTestCol = nCol;
while( lclIsWhitespace( *pTestLine ) )
{
pTestLine++;
nTestCol++;
}
if( *pTestLine && *(pTestLine + 1) )
{
String aTestSym = aLine.copy( nTestCol, 2 );
if( aTestSym.EqualsIgnoreCaseAscii( "to" ) )
{
aSym = String::CreateFromAscii( "goto" );
pLine = pTestLine + 2;
nCol = nTestCol + 2;
}
}
}
bool SbiScanner::NextSym() bool SbiScanner::NextSym()
{ {
// memorize for the EOLN-case // memorize for the EOLN-case
...@@ -240,26 +262,7 @@ bool SbiScanner::NextSym() ...@@ -240,26 +262,7 @@ bool SbiScanner::NextSym()
// Special handling for "go to" // Special handling for "go to"
if( bCompatible && *pLine && aSym.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("go") ) ) if( bCompatible && *pLine && aSym.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("go") ) )
{ scanGoto();
const sal_Unicode* pTestLine = pLine;
short nTestCol = nCol;
while( lclIsWhitespace( *pTestLine ) )
{
pTestLine++;
nTestCol++;
}
if( *pTestLine && *(pTestLine + 1) )
{
String aTestSym = aLine.copy( nTestCol, 2 );
if( aTestSym.EqualsIgnoreCaseAscii( "to" ) )
{
aSym = String::CreateFromAscii( "goto" );
pLine = pTestLine + 2;
nCol = nTestCol + 2;
}
}
}
// replace closing '_' by space when end of line is following // replace closing '_' by space when end of line is following
// (wrong line continuation otherwise) // (wrong line continuation otherwise)
......
...@@ -45,6 +45,8 @@ class SbiScanner ...@@ -45,6 +45,8 @@ class SbiScanner
::rtl::OUString aLine; ::rtl::OUString aLine;
const sal_Unicode* pLine; const sal_Unicode* pLine;
const sal_Unicode* pSaveLine; const sal_Unicode* pSaveLine;
void scanGoto();
protected: protected:
::rtl::OUString aSym; ::rtl::OUString aSym;
String aError; String aError;
......
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