Apache OpenOffice (AOO) Bugzilla – Issue 117960
Basic: Line Input doesn't work in single-line If
Last modified: 2017-05-20 09:31:59 UTC
Created attachment 76464 [details] Open Office Basic Macros code The following Oracle Open Office Basic line (see code in attachment): If Not(EoF(iFic)) Then Line Input #iFic, sRes give a compilation error in OOO 3.3.0, but not with previous version for example our production version Staroffice 9.2. Error: Syntax Error BASIC Unexpected Symbol: Input. Changing to: If Not(EoF(iFic)) Then Line Input #iFic, sRes End If is OK, but as we have thousands of subroutines to migrate ! We expected that the macros code is compatible between 3.2 and 3.3 and that we don't need to review all the libraries. Thank is advance for feedback
getting rid of value "enhancement" for field "severity". For enhancement the field "issue type" shall be used.
This is a regression probably caused by the patch for #92642 (linked to that bug).
Created attachment 85151 [details] Hack to restore LINE parsing as a token This patch treats "Line" as a LINE token, not a SYMBOL. Issue 92642 added the ability to use "Line" (and others) as a variable or object name, something allowed in VBA. In doing so, it seems to have regressed the ability to use "Line Input ..." in a single-line "If". But my patch here will restore that, at the cost of regressing the ability to name variables and objects "Line". The real solution is to dig deeper and find a way to do both by disambiguating the SYMBOL later.
All of these need to work: Line = 123 MsgBox Line iFic = FreeFile() Open "/tmp/result.txt" For Input As #iFic If Not(EoF(iFic)) Then Line Input #iFic, sRes Line Input #iFic, sRes Close #iFic
Fixed it properly in r1716234, resolving fixed. Commit message with details was: #i117960# Basic: Line Input doesn't work in single-line If i92642 added the ability to use certain keywords as variable names (eg. name = 1, line = "hi"), but also caused a regression where "Line Input" is broken in single-line If statements. This patch fixes that by allowing Then and Else to also be the start-of-line tokens expected to immediately preceed the "Line" token in order for that "Line" token to be recognized a keyword instead of a variable name. Also added FVT spreadsheet tests for "Line" as both a variable name and as "Line Input".