Issue 77338

Summary: 2 or more numerical labels cause compile error in OpenOffice.org Basic
Product: General Reporter: hba <biczoa>
Component: uiAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, kpalagin
Version: OOo 2.2   
Target Milestone: ---   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description hba 2007-05-14 10:23:49 UTC
Steps to reproduce the behaviour in OOo-dev 2.2.0:

1) Start an OpenOffice.org application (eg Writer or Calc).
2) Open the OOo-dev Basic Macros dialog (Tools/Macros/Organize Macros/OOo-dev 
Basic).
3) Create a new macro in the new document.
4) Create a new module in the new document.
5) Edit the Main macro of this module in the macro editor so that it looks 
like this:

Sub Main
1:
2:
End Sub

6) Try to compile or run the sub (or just close the Basic window and open it 
again).
7) A message box with the following error message appears:

BASIC syntax error.
Label $(ARG1) already defined.

The behaviour could be reproduced in:
  i) OOo-dev 2.2.0
 ii) OOo 2.2 FSF.hu Build 2
iii) OOo 2.1 FSF.hu

The error message in the Hungarian builds (only included here to aid Hungarian 
searches):

BASIC szintaktikai hiba.
A címke már létezik $(ARG1).

Remarks
1) One numerical label (with or without further non-numerical labels) doesn't 
cause the error.
2) More code doesn't seem to prevent the error.
3) This issue could be divided into 2 sub-issues:
   i) Not accepting 2 or more numerical labels.
   ii) Displaying $(ARG1) instead of the actual label name.
4) This issue may make VBA macro conversion a bit more difficult.
5) Quick fix: replace numerical labels with non-numerical labels.

For this, you can use the following regular expression and replace string:

Search for:

\<([0-9]+)\>

Replace with:

label_&

(This didn't work for me in the Find and Replace function of the Basic editor,
try the Find and Replace function of OpenOffice.org Writer instead.)
Comment 1 thorsten.martens 2007-05-14 11:33:04 UTC
TM->JSK: please have a look.
Comment 2 hba 2007-05-14 14:31:59 UTC
Sorry for the mistake, the intended steps are of course:

3) Create a new module in the new document.
4) (You don't have to create Sub Main since it is created automatically.)
Comment 3 hba 2007-05-22 15:54:16 UTC
I'm sorry for the long description.
Below is a brief version to aide easy confirmation.

Write any OOo Basic code containing two or more numerical labels (with or 
without colons) and it won't compile.
The simplest sub to demonstrate the effect:

Sub Main
1
2
End Sub
Comment 4 kpalagin 2007-06-10 16:18:38 UTC
Confirming with OO2.2 on WinXP - 
"Sub Main
1
2
End Sub"
produces error message 
"Basic syntax error.
Label $(ARG1) already defined".
Comment 5 joerg.skottke 2008-06-17 09:56:03 UTC
To AB, set target 3.x
Comment 6 ab 2008-08-01 11:29:14 UTC
STARTED
Comment 7 Marcus 2017-05-20 10:47:44 UTC
Reset assigne to the default "issues@openoffice.apache.org".