Revert "COMPHELPER: Allow empty comments in SyntaxHighlight"
This reverts commit a79cb836b9
, which broke
--with-help builds again, as
strLine.copy(i->nBegin, i->nEnd-i->nBegin)
in BasicCodeTagger::tagParagraph (helpcompiler/source/BasCodeTagger.cxx) depends
on the invariant that a HighlightPortion does not extend past the source string.
Also, I see no reason for that change, as empty comments are handled just fine
already as demonstrated by the following commit...
Change-Id: I384bae9c4cf6a38d0a0a2832fa15bde82126cace
This commit is contained in:
@@ -41,11 +41,10 @@ void SyntaxHighlightTest::testBasicString()
|
|||||||
aPortions.begin(), itrEnd = aPortions.end(); itr != itrEnd; ++itr)
|
aPortions.begin(), itrEnd = aPortions.end(); itr != itrEnd; ++itr)
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT_EQUAL(prevEnd, itr->nBegin);
|
CPPUNIT_ASSERT_EQUAL(prevEnd, itr->nBegin);
|
||||||
//The comment is empty, so empty zone
|
CPPUNIT_ASSERT(itr->nBegin < itr->nEnd);
|
||||||
CPPUNIT_ASSERT(itr->nBegin <= itr->nEnd);
|
|
||||||
prevEnd = itr->nEnd;
|
prevEnd = itr->nEnd;
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT_EQUAL(aBasicString.getLength() - 1, prevEnd);
|
CPPUNIT_ASSERT_EQUAL(aBasicString.getLength(), prevEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(SyntaxHighlightTest);
|
CPPUNIT_TEST_SUITE_REGISTRATION(SyntaxHighlightTest);
|
||||||
|
@@ -399,14 +399,16 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType,
|
|||||||
// Comment?
|
// Comment?
|
||||||
if ( c == '\'' )
|
if ( c == '\'' )
|
||||||
{
|
{
|
||||||
c = peekChar();
|
c = getChar();
|
||||||
|
|
||||||
// Remove all characters until end of line or EOF
|
// Remove all characters until end of line or EOF
|
||||||
sal_Unicode cPeek = c;
|
sal_Unicode cPeek = c;
|
||||||
while( cPeek != 0 && testCharFlags( cPeek, CHAR_EOL ) == sal_False )
|
while( cPeek != 0 && testCharFlags( cPeek, CHAR_EOL ) == sal_False )
|
||||||
{
|
{
|
||||||
cPeek = getChar();
|
getChar();
|
||||||
|
cPeek = peekChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
reType = TT_COMMENT;
|
reType = TT_COMMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,7 +674,7 @@ void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OU
|
|||||||
const sal_Unicode* pEndPos;
|
const sal_Unicode* pEndPos;
|
||||||
|
|
||||||
// Loop over all the tokens
|
// Loop over all the tokens
|
||||||
while( getNextToken( eType, pStartPos, pEndPos ) )
|
while( getNextToken( eType, pStartPos, pEndPos ) )
|
||||||
{
|
{
|
||||||
portions.push_back(
|
portions.push_back(
|
||||||
HighlightPortion(
|
HighlightPortion(
|
||||||
|
Reference in New Issue
Block a user