| Summary: | VBA parsing bug with multiline continuation in comment | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | studog <stuartm.coding> |
| Component: | BASIC | Assignee: | Andreas Heinisch <andreas.heinisch> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | medium | ||
| Version: | 7.3.3.2 release | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.documentfoundation.org/show_bug.cgi?id=149402 | ||
| Whiteboard: | target:7.4.0 target:7.3.5 | ||
| Crash report or crash signature: | Regression By: | ||
| Attachments: | Copy of the spreadsheet used in the reproduction steps | ||
|
Description
studog
2022-05-18 17:20:42 UTC
Created attachment 180190 [details]
Copy of the spreadsheet used in the reproduction steps
Attached a copy of the spreadsheet I used as an example in the reproduction steps.
Repro.
The minimal code would be:
Option VBASupport 1
sub foo
' _
If Foo Then
Bar
Else
Baz
End If
end sub
It works OK without 'Option VBASupport 1'.
Oh wait. The quote from VB documentation in comment 0 is unrelated: VBA is not VB, and in Excel, the code from comment 2 also shows "Compile error: Else without If"; and the syntax highlighting shows the If line as a comment. So using the comment continuation for VBA code is correct. But in the problematic case, the continuation is followed by an empty line. So the empty line should consume the continuation - but it doesn't. The updated problematic code is: sub foo ' _ If 1 Then Else End If end sub I wonder if there are other variants of the error - when the continuation ignores an empty line outside of comments ... Another observation is: if the trailing _ is followed by a space before newline, the space doesn't cancel the continuation effect of the _, as it should. FTR: the respective VBA documentation [1] doesn't mention a limitation for comments. Comments documentation [2], [3] also doesn't mention that. [1] https://docs.microsoft.com/en-us/office/vba/language/glossary/vbe-glossary#line-continuation-character [2] https://docs.microsoft.com/en-us/office/vba/language/glossary/vbe-glossary#comment [3] https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/rem-statement Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b94275f6d2cb4dc28d1563fd7994251042b6d51a tdf#149157 - Break multiline continuation in a comment after a new line It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/73e46d86335e60f1b11a91b23522402cd34466a8 tdf#149157 - Break multiline continuation in a comment after a new line It will be available in 7.3.5. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. |