You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2015/04/27 02:09:27 UTC
[Issue 126272] New: OpenOffice.org Basic compile error : when
comment follow if statement
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Issue ID: 126272
Issue Type: DEFECT
Summary: OpenOffice.org Basic compile error : when comment
follow if statement
Product: General
Version: 4.1.1
Hardware: All
OS: Windows 7
Status: UNCONFIRMED
Severity: normal
Priority: P5
Component: code
Assignee: issues@openoffice.apache.org
Reporter: E.Zido@gmx.de
' This will not cause an Syntax-Err
If A > 3 Then B = 2 Else B = 0
' This will not cause an Syntax-Err
If A > 3 Then B = 2 Else B = 0 ' This one cause Syntax-ERR
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Matthias Seidel <ms...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.0 |4.1.13
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement
followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #5 from bmarcelly <ma...@club-internet.fr> ---
mroe said :
illegal:
If <condition> Then <statement> Else <statement>
the parser should give an error if /If/ and /Else/ in one line or it should
simply stop at the comment.
Look at Microsoft VBA doc on IF statement:
https://msdn.microsoft.com/en-us/library/gg251599%28v=office.14%29.aspx
The single-line form is accepted for if-then-else :
"You can use the single-line form (first syntax) for short, simple tests. "
This single form is widely used in Basic macros, it must be kept for
compatibility. It is not described in the F1 help, but appears in the Wiki
Basic Programming Guide.
The statement works correctly if there is no comment in the same line. This
restriction is minor, if you know it.
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Keith N. McKenna <kn...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.1.13 |4.2.0
CC| |knmc@apache.org
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : follow if
statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Adam E.Z. <E....@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|OpenOffice.org Basic |OpenOffice.org Basic
|compile error : when |compile error : follow if
|comment follow if statement |statement
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Matthias Seidel <ms...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.0 |4.1.13
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Carl Marcum <cm...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cmarcum@apache.org
Summary|OpenOffice.org Basic |OpenOffice.org Basic
|compile error : if |compile error when comment
|statement followed by End |is at the end of a single
|If - in next Line ??? |line if then else statement
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #11 from Matthias Seidel <ms...@apache.org> ---
No problem!
I wasn't sure myself, so I better looked it up.
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement
followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
damjan@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.2.0
OS|Windows 7 |All
CC| |damjan@apache.org
Resolution|--- |FIXED
Latest|--- |4.2.0-dev
Confirmation in| |
Status|CONFIRMED |RESOLVED
--- Comment #6 from damjan@apache.org ---
The Basic parser was only allowing Else to end in EOL, not in a comment. I've
fixed that in r1720205, so resolving fixed.
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Matthias Seidel <ms...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mseidel@apache.org
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #7 from Carl Marcum <cm...@apache.org> ---
I've updated the subject to make it clear what the problem was
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement
followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
bmarcelly <ma...@club-internet.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marcelly@club-internet.fr
Ever confirmed|0 |1
Status|UNCONFIRMED |CONFIRMED
--- Comment #2 from bmarcelly <ma...@club-internet.fr> ---
Confirmed.
The syntax analyzer is disturbed by any comment at right of a line containing
if ... then ... else ...
The comment may be a single apostrophe or a single REM
Further examples:
>> this throws Unexpected symbol : End Sub
Sub Main
for a = -5 to 3
if a > 1 then b = 0 else b = 2 REM
next
End Sub
>> this throws Unexpected symbol : Until
Sub Main1
a= 0
Do
a = a+1
if a > 1 then b = 0 else b = 2 rem
Loop Until a > 3
End Sub
Workaround : do not add a comment on a line "if...then...else..."
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement
followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #4 from mroe <mr...@gmx.net> ---
It seems <comment><newline> is treated like a colon.
Sub Foo1( A as Integer )
If A > 2 Then MsgBox( 0 ) Else MsgBox( 1 ) 'comment
MsgBox( 2 ) 'comment
MsgBox( 3 )
End Sub
Sub Foo2( A as Integer )
If A > 2 Then MsgBox( 0 ) Else MsgBox( 1 ) : MsgBox( 2 ) : MsgBox( 3 )
End Sub
Foo1 and Foo2 gives the same result.
But nevertheless the parser should give an error if /If/ and /Else/ in one line
or it should simply stop at the comment.
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error :if statement
followed by Endf If in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Adam E.Z. <E....@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|OpenOffice.org Basic |OpenOffice.org Basic
|compile error : follow if |compile error :if statement
|statement |followed by Endf If in next
| |Line ???
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement
followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #3 from mroe <mr...@gmx.net> ---
The comment isn't the problem. As I know only oneliners with only one statement
is allowed.
legal:
If <condition> Then <statement>
illegal:
If <condition> Then <statement> Else <statement>
Modify Foo() to
Function Foo(A as Integer) As Integer
Dim B as Integer
If A > 0 Then 'comment
B = 2 'comment
If A > 2 Then B = 3 Else B = 0 'comment
MsgBox( "A" ) 'comment
MsgBox( "B" ) 'comment
MsgBox( "C" ) 'comment
MsgBox( "D" )
End If
Foo = B
End Function
Then you will see that the MsgBoxes will not be reached for A>2.
A comment after MsgBox ( "D" ) will also cause the error because the nested If
statement is unclosed.
IMHO this isn't an issue, it's an illegal oneliner.
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #8 from damjan@apache.org ---
Cherry-picked for AOO42X with commit 3b5ec47b15ab141460e2a7c60e19e9a0616b9d3d.
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error : if statement
followed by End If - in next Line ???
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
Adam E.Z. <E....@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|OpenOffice.org Basic |OpenOffice.org Basic
|compile error :if statement |compile error : if
|followed by Endf If in next |statement followed by End
|Line ??? |If - in next Line ???
--- Comment #1 from Adam E.Z. <E....@gmx.de> ---
Function Foo(A as Integer) As Integer
Dim B as Integer
If A > 0 Then ' REM 1
B = 2 ' REM 2
If A > 2 Then B = 3 Else B = 0 ' REM 3 => syntax err
End If
Foo = B
End Function
Function Foo2(A as Integer) As Integer
Dim B as Integer
If A > 0 Then ' REM 1
B = 2 ' REM 2
If A > 2 Then B = 3 Else B = 0 ' REM 3 => NO syntax err
End If
Foo2 = B
End Function
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #9 from Matthias Seidel <ms...@apache.org> ---
This was fixed and released with AOO 4.1.13:
https://github.com/apache/openoffice/commit/4dcbef3e4f42e9515ba2313db12f4aecd595a57f
I think Damjan cherry-picked the missing test for AOO42X?
--
You are receiving this mail because:
You are the assignee for the issue.
[Issue 126272] OpenOffice.org Basic compile error when comment is at the end of a single line if then else statement
Posted by bu...@apache.org.
https://bz.apache.org/ooo/show_bug.cgi?id=126272
--- Comment #10 from Keith N. McKenna <kn...@apache.org> ---
(In reply to Matthias Seidel from comment #9)
> This was fixed and released with AOO 4.1.13:
>
> https://github.com/apache/openoffice/commit/
> 4dcbef3e4f42e9515ba2313db12f4aecd595a57f
>
> I think Damjan cherry-picked the missing test for AOO42X?
Yes he did, i saw the conversation later and was coming back to reverse this.
Thank you for doing it. Sorry for the noise.
--
You are receiving this mail because:
You are the assignee for the issue.