summaryrefslogtreecommitdiff
path: root/basic/source/comp/scanner.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-02-21 17:44:29 +0300
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-02-28 02:48:16 +0000
commit97caa8a8a0d80baa1a77859b117a8bc2b8b952f8 (patch)
tree3e2e05e67ac3767aca35602850a14631b3d1127f /basic/source/comp/scanner.cxx
parentb51bc85cd2ded95668cfcacdb8a2a4a388fe51f4 (diff)
VBA: allow and ignore compiler directives
Instead of erroring out on this: #If Win64 Then Declare PtrSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" #Else Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" #End If just treat the # commands as remarks and continue on. This type of coding will become more common as 64bit versions of Office require such constructs. Change-Id: I63bfb8cbe9ad3ef35bab4c041d9d94daa7fbba18 Reviewed-on: https://gerrit.libreoffice.org/34518 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'basic/source/comp/scanner.cxx')
-rw-r--r--basic/source/comp/scanner.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 398b78a6cdbd..4cd7928b3a02 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -212,6 +212,7 @@ bool SbiScanner::NextSym()
eScanType = SbxVARIANT;
aSym.clear();
bHash = bSymbol = bNumber = bSpaces = false;
+ bool bCompilerDirective = false;
// read in line?
if( !pLine )
@@ -246,7 +247,11 @@ bool SbiScanner::NextSym()
{
++pLine;
++nCol;
- bHash = true;
+ //ignore compiler directives (# is first non-space character)
+ if( nOldCol2 == 0 )
+ bCompilerDirective = true;
+ else
+ bHash = true;
}
// copy character if symbol
@@ -551,7 +556,9 @@ bool SbiScanner::NextSym()
PrevLineCommentLbl:
if( bPrevLineExtentsComment || (eScanType != SbxSTRING &&
- ( aSym.startsWith("'") || aSym.equalsIgnoreAsciiCase( "REM" ) ) ) )
+ ( bCompilerDirective ||
+ aSym.startsWith("'") ||
+ aSym.equalsIgnoreAsciiCase( "REM" ) ) ) )
{
bPrevLineExtentsComment = false;
aSym = "REM";