Kaydet (Commit) 97caa8a8 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Markus Mohrhard

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/34518Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst b51bc85c
......@@ -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";
......
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