summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-11-18 21:27:44 -0500
committerAugust Sodora <augsod@gmail.com>2011-11-18 21:40:39 -0500
commit53a662f53055ea5f262d7e0358d1346bab7f353d (patch)
tree20526a82f4f8c3fbbfff263a6d72f77f86f0f8c9 /basic
parentac4b051e3247ccc9dfc40ca0699537ce4256de35 (diff)
Refactoring in scanner
Diffstat (limited to 'basic')
-rw-r--r--basic/source/comp/scanner.cxx43
-rw-r--r--basic/source/inc/scanner.hxx2
2 files changed, 25 insertions, 20 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 5d1f36b74e86..2b594de03766 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 c96387ebbe3e..e98ebc32c9f3 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;