| View previous topic :: View next topic |
| Author |
Message |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1145 Location: France
|
Posted: Sat Dec 24, 2005 4:30 am Post subject: Basic compiler bugged in 2.0.1 ? |
|
|
Hi all,
I have recently downloaded the official OpenOffice.org 2.0.1 (build 8990).
I installed it on my Win XP Home computer (complete install, after deleting old 1.9 and without data from 1.1).
Then I re-installed Xray and Multipages add-ons. Problem : there is a syntax error in both add-ons
After investigation, I found two problems related with the continuation character in Basic (underscore character). In the following lines the _ character must be the last character of the line.
| Code: | Sub Main
' comment ending with _
End Sub |
This code displays syntax error : Statement block still open: End Sub missing.
If you suppress the trailing _ the error disappears.
Obviously the comment part of the line was interpreted.
| Code: | Sub Main
const a = "1234567890" & _
"1234567890" & _
"1234567890" & _
"1234567890" & _
"1234567890" & _
"1234567890" & _
"1234567890" & _
"1234567890"
End Sub |
Here again there is a syntax error. If you suppress one character in any one of the strings, the error disappears.
The compiler does not like strings of 80 characters or more, if they are defined with continuation lines.
Do you also get these errors? If so, this 2.0.1 is nearly unusable for Basic macros. _________________ Bernard
OpenOffice.org 1.1.5 fr / OpenOffice.org 3.1.1 en + langpacks
MS-Windows XP Home SP3 |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 7664 Location: Kentucky, USA
|
Posted: Sat Dec 24, 2005 8:57 am Post subject: |
|
|
This does throw an error as does the larger piece of code you posted:
| Code: | Sub Main
' comment ending with _
End Sub |
These do not, however, in the last one Xray reports "a" as being Empty. Xray reports "a" correctly in 1.1.5.
| Code: | Sub Main
' comment ending with_
End Sub |
| Code: | Sub Main
' comment ending with _
a = 1
End Sub |
| Code: | Sub Main
' comment ending with _
a = 1
Xray a
End Sub |
OOo 2.0.1 - Windows 2000 Pro - Xray 5.1
Last edited by JohnV on Sat Dec 24, 2005 4:31 pm; edited 1 time in total |
|
| Back to top |
|
 |
DrewJensen Super User


Joined: 06 Jul 2005 Posts: 2599 Location: Cumberland, MD
|
Posted: Sat Dec 24, 2005 9:27 am Post subject: |
|
|
| Quote: |
The compiler does not like strings of 80 characters or more, if they are defined with continuation lines.
|
Haven't tried all the test yet, but this seems a little different.
It appears that the problem is with constants of 80 characters. The continuation doesn't matter.
no error
| Code: |
sub strLength
dim a as string
a = "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890"
print a
end sub
|
error
| Code: |
sub strLength
const a = "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890" & "1234567890"
print a
end sub
|
Using the continuatoin character in either scenario gives the same results.
EDIT:
OK, all the tests you showed for the continuation character and comments are working just the same for me..But I am also on WinXP..so hopefully a Linux person will check in also. _________________ Blog - http://baseanswers.spaces.live.com/ |
|
| Back to top |
|
 |
james_h Super User


Joined: 05 Nov 2005 Posts: 873
|
Posted: Sat Dec 24, 2005 8:07 pm Post subject: OOo 2.0.1 (Linux) - Constant string length limit confirmed |
|
|
OpenOffice.org 2.0.1 (Linux) - Constant string length limit confirmed
| Quote: | | OK, all the tests you showed for the continuation character and comments are working just the same for me..But I am also on WinXP..so hopefully a Linux person will check in also. |
I checked the code using OpenOffice.org 2.0.1 (Linux). My results are the same as Drew Jensen's. Constants show an error when the string length limit is exceeded. |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1145 Location: France
|
Posted: Sun Dec 25, 2005 1:03 am Post subject: |
|
|
OK, the constant bug is related only to the concatenation character ( & or + )
Simplest example, adding a null string | Code: | Sub Main
const a = "12345678901234567890123456789012345678901234567890123456789012345678901234567890" & ""
print a
End Sub |
If you suppress one character the syntax error disappears.
If you suppress the & "" the syntax error disappears.
If you construct the string with concatenation of substrings on several lines you get a syntax error for more than 79 characters in total.
So now we have two different bugs:
- comment lines ending with the continuation character
- long string constants created with concatenation
any more bugs around ? |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1145 Location: France
|
Posted: Sun Dec 25, 2005 1:23 am Post subject: |
|
|
The bug "continuation character in comment" produces an error with Xray 5.1 when you are trying to display the API documentation.
There is a compilation error in module Mod4, line 82. | Code: | | if alpha = -1 then alpha = 27 ' name begins with _ |
To suppress the error, suppress the comment or change it like this | Code: | | if alpha = -1 then alpha = 27 ' name begins with _ character |
In fact at runtime the error appears in the module _main because the mod4 module was not correctly compiled.
This is a typical example of a correct macro which cannot run on OOo 2.0.1. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3152 Location: Columbus, Ohio, USA
|
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1145 Location: France
|
Posted: Mon Dec 26, 2005 1:14 am Post subject: |
|
|
| pitonyak wrote: | | Have you filed a bug report on this? |
Just created:
syntax error with line continuation character IZ 59790
constants constructs are limited to 79 character length IZ 59791 |
|
| Back to top |
|
 |
|