basic/qa/cppunit/test_scanner.cxx | 38 ++++++++++++++++++++++++++++++++++++++ basic/source/comp/scanner.cxx | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-)
New commits: commit b9bda1d7916c5474aab89116757fcb7e799458b2 Author: Takeshi Abe <[email protected]> Date: Thu Jul 13 19:07:36 2017 +0900 tdf#103104 Allow line-continuation followed by a dot in BASIC as in VBA-compatibility mode. Change-Id: If263183fc1fa5742235213a8617fdf412d2a245e Reviewed-on: https://gerrit.libreoffice.org/39893 Tested-by: Jenkins <[email protected]> Reviewed-by: Takeshi Abe <[email protected]> diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx index 509a793f175a..1d6c7f37d4f2 100644 --- a/basic/qa/cppunit/test_scanner.cxx +++ b/basic/qa/cppunit/test_scanner.cxx @@ -28,6 +28,7 @@ namespace OUString text; double number; SbxDataType type; + bool ws; }; /** @@ -46,6 +47,7 @@ namespace void testNumbers(); void testDataType(); void testHexOctal(); + void testTdf103104(); // Adds code needed to register the test suite CPPUNIT_TEST_SUITE(ScannerTest); @@ -61,6 +63,7 @@ namespace CPPUNIT_TEST(testNumbers); CPPUNIT_TEST(testDataType); CPPUNIT_TEST(testHexOctal); + CPPUNIT_TEST(testTdf103104); // End of test suite definition CPPUNIT_TEST_SUITE_END(); @@ -87,6 +90,7 @@ namespace symbol.text = scanner.GetSym(); symbol.number = scanner.GetDbl(); symbol.type = scanner.GetType(); + symbol.ws = scanner.WhiteSpace(); symbols.push_back(symbol); } errors = scanner.GetErrors(); @@ -850,6 +854,40 @@ namespace CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); } + void ScannerTest::testTdf103104() + { + const OUString source1("asdf _\n asdf"); + const OUString source2("asdf. _\n asdf"); + const OUString source3("asdf _\n .asdf"); + + std::vector<Symbol> symbols; + + symbols = getSymbols(source1); + CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); + CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); + CPPUNIT_ASSERT_EQUAL(asdf, symbols[1].text); + CPPUNIT_ASSERT(symbols[1].ws); + CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); + + symbols = getSymbols(source2); + CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); + CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); + CPPUNIT_ASSERT_EQUAL(dot, symbols[1].text); + CPPUNIT_ASSERT(!symbols[1].ws); + CPPUNIT_ASSERT_EQUAL(asdf, symbols[2].text); + CPPUNIT_ASSERT(symbols[2].ws); + CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); + + symbols = getSymbols(source3); + CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); + CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); + CPPUNIT_ASSERT_EQUAL(dot, symbols[1].text); + CPPUNIT_ASSERT(!symbols[1].ws); + CPPUNIT_ASSERT_EQUAL(asdf, symbols[2].text); + CPPUNIT_ASSERT(!symbols[2].ws); + CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); + } + // Put the test suite in the registry CPPUNIT_TEST_SUITE_REGISTRATION(ScannerTest); } // namespace diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 48072debbd15..0cf8ed49c6b3 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -626,7 +626,7 @@ eoln: { pLine = nullptr; bool bRes = NextSym(); - if( bVBASupportOn && aSym.startsWith(".") ) + if( aSym.startsWith(".") ) { // object _ // .Method _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
