basic/source/comp/scanner.cxx | 39 +++++++++++++++++++-------------------- basic/source/inc/scanner.hxx | 2 ++ 2 files changed, 21 insertions(+), 20 deletions(-)
New commits: commit 76f4712c7d1382752edfc153e3879fb447e70db5 Author: August Sodora <aug...@gmail.com> Date: Fri Nov 18 21:35:01 2011 -0500 Remove uses of pLine in scanner diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 2b594de..09e96bc 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -163,21 +163,17 @@ inline bool lclIsWhitespace( sal_Unicode cChar ) void SbiScanner::scanGoto() { - const sal_Unicode* pTestLine = pLine; short nTestCol = nCol; - while( lclIsWhitespace( *pTestLine ) ) - { - pTestLine++; + while(nTestCol < aLine.getLength() && lclIsWhitespace(aLine[nTestCol])) nTestCol++; - } - if( *pTestLine && *(pTestLine + 1) ) + if(nTestCol + 1 < aLine.getLength()) { - String aTestSym = aLine.copy( nTestCol, 2 ); - if( aTestSym.EqualsIgnoreCaseAscii( "to" ) ) + ::rtl::OUString aTestSym = aLine.copy(nTestCol, 2); + if(aTestSym.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("to"))) { - aSym = String::CreateFromAscii( "goto" ); - pLine = pTestLine + 2; + aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("goto")); + pLine = pLine + (nCol - nTestCol) + 2; nCol = nTestCol + 2; } } commit 53a662f53055ea5f262d7e0358d1346bab7f353d Author: August Sodora <aug...@gmail.com> Date: Fri Nov 18 21:27:44 2011 -0500 Refactoring in scanner diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 5d1f36b..2b594de 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -161,6 +161,28 @@ inline bool lclIsWhitespace( sal_Unicode cChar ) } // 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() { // memorize for the EOLN-case @@ -240,26 +262,7 @@ bool SbiScanner::NextSym() // Special handling for "go to" if( bCompatible && *pLine && aSym.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("go") ) ) - { - 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; - } - } - } + scanGoto(); // replace closing '_' by space when end of line is following // (wrong line continuation otherwise) diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx index c96387e..e98ebc3 100644 --- a/basic/source/inc/scanner.hxx +++ b/basic/source/inc/scanner.hxx @@ -45,6 +45,8 @@ class SbiScanner ::rtl::OUString aLine; const sal_Unicode* pLine; const sal_Unicode* pSaveLine; + + void scanGoto(); protected: ::rtl::OUString aSym; String aError; _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits