comphelper/qa/unit/syntaxhighlighttest.cxx | 5 +++-- comphelper/source/misc/syntaxhighlight.cxx | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-)
New commits: commit a79cb836b951eb2492e43aadd2ee672b9b67b914 Author: Arnaud Versini <arnaud.vers...@libreoffice.org> Date: Sun Oct 27 15:15:30 2013 +0100 COMPHELPER: Allow empty comments in SyntaxHighlight Change-Id: I0f3d5673e28e34ed3921c930aca48f3d7574b064 Reviewed-on: https://gerrit.libreoffice.org/6450 Reviewed-by: Arnaud Versini <arnaud.vers...@libreoffice.org> Tested-by: Arnaud Versini <arnaud.vers...@libreoffice.org> diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx index 8fab067..d26b855 100644 --- a/comphelper/qa/unit/syntaxhighlighttest.cxx +++ b/comphelper/qa/unit/syntaxhighlighttest.cxx @@ -41,10 +41,11 @@ void SyntaxHighlightTest::testBasicString() aPortions.begin(), itrEnd = aPortions.end(); itr != itrEnd; ++itr) { CPPUNIT_ASSERT_EQUAL(prevEnd, itr->nBegin); - CPPUNIT_ASSERT(itr->nBegin < itr->nEnd); + //The comment is empty, so empty zone + CPPUNIT_ASSERT(itr->nBegin <= itr->nEnd); prevEnd = itr->nEnd; } - CPPUNIT_ASSERT_EQUAL(aBasicString.getLength(), prevEnd); + CPPUNIT_ASSERT_EQUAL(aBasicString.getLength() - 1, prevEnd); } CPPUNIT_TEST_SUITE_REGISTRATION(SyntaxHighlightTest); diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 83bcb59..c6340ef 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -399,16 +399,14 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, // Comment? if ( c == '\'' ) { - c = getChar(); + c = peekChar(); // Remove all characters until end of line or EOF sal_Unicode cPeek = c; while( cPeek != 0 && testCharFlags( cPeek, CHAR_EOL ) == sal_False ) { - getChar(); - cPeek = peekChar(); + cPeek = getChar(); } - reType = TT_COMMENT; } @@ -674,7 +672,7 @@ void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OU const sal_Unicode* pEndPos; // Loop over all the tokens - while( getNextToken( eType, pStartPos, pEndPos ) ) + while( getNextToken( eType, pStartPos, pEndPos ) ) { portions.push_back( HighlightPortion( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits