https://bugs.documentfoundation.org/show_bug.cgi?id=149157

            Bug ID: 149157
           Summary: VBA parsing bug with multiline continuation in comment
           Product: LibreOffice
           Version: 7.3.3.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: minor
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Opening a specific .xls file throws a "BASIC syntax error. Else/Endif without
if." error. This is spurious, if I understand BASIC syntax correctly.



Steps to Reproduce:
1.
https://services.cds.ca/applications/taxforms/taxforms.nsf/Pages/-EN-LimitedPartnershipsandIncomeTrusts
-> scroll down, click 'Display T3 information for year 2020' -> scroll down,
click 'I accept'
2. I'm using the spreadsheet for CUSIP 41754Q104 HARVEST GLOBAL RESOURCE
LEADERS ETF because it's currently the top result but quite a lot of them have
the specific formatting that invokes the bug
3. Download the spreadsheet.
4. Open with Libreoffice; I use `soffice
CDSP-BRWLCN_T3_R16_TY2020_2020_07_27_11_38_36.xls` from the command line

Actual Results:
Document load is interrupted with the above-noted BASIC syntax error. The IDE
will open automatically to allow the error dialog to show.

Expected Results:
The spreadsheet opens without issue.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
The error occurs at line 373 in the above-noted spreadsheet, but in actual
fact, it is caused by the underscore line continuation character at the end of
line 354 ''Nov-2013 Range("S12").Value = 0 Or _'. The one-character change of
removing that underscore fixes the issue.

This appears to be code/comment in a template that is widely used which is why
many of the spreadsheets at the CDS service have this problem. The
underscore/comment appears at some point in the template's history, older
spreadsheets don't have it and are unaffected.

https://help.libreoffice.org/7.3/en-US/text/sbasic/shared/03090407.html?DbPAR=BASIC#bm_id3154347
states that line continuation can be done in a comment, but 'Option Compatible'
needs to be set, and it isn't in this sheet.

Even if it was set line 355 should break the comment continuation leaving line
356 to begin the if statement. Adding more blank lines between 354 and 356 does
not change the behaviour.

MS claims you can't continue a comment:
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/program-structure/how-to-break-and-combine-statements-in-code
so the fact that LibreOffice allows this but only in compatibility (with VBA)
mode is strange.




Version: 7.3.3.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (C.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.3~rc2-0ubuntu0.18.04.1~lo1
Calc: threaded


glxinfo | grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: AMD TAHITI (DRM 2.50.0, 5.4.0-110-generic, LLVM 10.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 20.0.8
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5 (Compatibility Profile) Mesa 20.0.8
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to