[Libreoffice-commits] core.git: basic/source

Justin Luth justin_luth at sil.org
Tue Feb 28 02:48:46 UTC 2017


 basic/source/comp/scanner.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 97caa8a8a0d80baa1a77859b117a8bc2b8b952f8
Author: Justin Luth <justin_luth at sil.org>
Date:   Tue Feb 21 17:44:29 2017 +0300

    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 at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 398b78a..4cd7928 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";


More information about the Libreoffice-commits mailing list