Author: damjan
Date: Tue Nov 24 18:56:10 2015
New Revision: 1716234

URL: http://svn.apache.org/viewvc?rev=1716234&view=rev
Log:
#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".

Patch by: me


Added:
    openoffice/trunk/test/testuno/data/uno/sc/fvt/Basic Line as variable and 
Line Input.ods   (with props)
Modified:
    openoffice/trunk/main/basic/source/comp/token.cxx
    openoffice/trunk/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java

Modified: openoffice/trunk/main/basic/source/comp/token.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/basic/source/comp/token.cxx?rev=1716234&r1=1716233&r2=1716234&view=diff
==============================================================================
--- openoffice/trunk/main/basic/source/comp/token.cxx (original)
+++ openoffice/trunk/main/basic/source/comp/token.cxx Tue Nov 24 18:56:10 2015
@@ -557,7 +557,8 @@ SbiToken SbiTokenizer::Next()
        }
 special:
        // #i92642
-       bool bStartOfLine = (eCurTok == NIL || eCurTok == REM || eCurTok == 
EOLN);
+       bool bStartOfLine = (eCurTok == NIL || eCurTok == REM || eCurTok == 
EOLN ||
+               eCurTok == THEN || eCurTok == ELSE); // single line If
        if( !bStartOfLine && (tp->t == NAME || tp->t == LINE) )
                return eCurTok = SYMBOL;
        else if( tp->t == TEXT )

Added: openoffice/trunk/test/testuno/data/uno/sc/fvt/Basic Line as variable and 
Line Input.ods
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/data/uno/sc/fvt/Basic%20Line%20as%20variable%20and%20Line%20Input.ods?rev=1716234&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/trunk/test/testuno/data/uno/sc/fvt/Basic Line as 
variable and Line Input.ods
------------------------------------------------------------------------------
    svn:mime-type = application/vnd.oasis.opendocument.spreadsheet

Modified: 
openoffice/trunk/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java?rev=1716234&r1=1716233&r2=1716234&view=diff
==============================================================================
--- 
openoffice/trunk/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java 
(original)
+++ 
openoffice/trunk/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java 
Tue Nov 24 18:56:10 2015
@@ -81,6 +81,7 @@ public class TestFormulaDocs {
                testOneDoc( 
"uno/sc/fvt/StarBasicYearMonthDateHourMinuteSecondTests.ods");
                testOneDoc( "uno/sc/fvt/StarBasicCLng.ods");
                testOneDoc( "uno/sc/fvt/DGET on formulas.ods");
+               testOneDoc( "uno/sc/fvt/Basic Line as variable and Line 
Input.ods");
        }
 
        public void testOneDoc( String filename) throws Exception {


Reply via email to