Commit 47d60ae8 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

C++: Consider '^//[/!][^\n]*' as doxygen comment



Now everything following '///' or '//!' is a doxygen comment.

This simplification fixes also the bug ('\n' was considered as part of
the doxygen comment and led to strange highlighting).

Task-number: QTCREATORBUG-8921

Change-Id: I6dae3b80ec11400f2f623897257782a80860a7f3
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 29055f9f
......@@ -368,11 +368,7 @@ void Lexer::scan_helper(Token *tok)
if (_yychar == '/' || _yychar == '!') {
yyinp();
if (_yychar == '<' || _yychar != '/') {
yyinp();
doxy = true;
}
doxy = true;
}
while (_yychar && _yychar != '\n')
......
......@@ -65,7 +65,7 @@ void tst_SimpleLexer::doxygen_comments()
Token expectedToken; // Create a Token in order to spell the token kind
expectedToken.f.kind = expectedTokenKind;
// qDebug("Comparing (i=%d): \"%s\" \"%s\"", i, token.spell(), expectedToken.spell());
QCOMPARE(token.spell(), expectedToken.spell());
QCOMPARE(token.kind(), expectedTokenKind);
}
QVERIFY2(i == expectedTokenKindList.size(), "Less tokens than expected.");
}
......@@ -83,7 +83,7 @@ void tst_SimpleLexer::doxygen_comments_data()
QTest::newRow(source) << source << expectedTokenKindList;
source = "//// comment";
expectedTokenKindList = QList<unsigned>() << T_CPP_COMMENT;
expectedTokenKindList = QList<unsigned>() << T_CPP_DOXY_COMMENT;
QTest::newRow(source) << source << expectedTokenKindList;
source = "/// comment";
......@@ -105,6 +105,13 @@ void tst_SimpleLexer::doxygen_comments_data()
source = "///\n";
expectedTokenKindList = QList<unsigned>() << T_CPP_DOXY_COMMENT;
QTest::newRow(source) << source << expectedTokenKindList;
source = "///\n"
"int i;";
expectedTokenKindList = QList<unsigned>()
<< T_CPP_DOXY_COMMENT
<< T_INT << T_IDENTIFIER << T_SEMICOLON;
QTest::newRow(source) << source << expectedTokenKindList;
}
QTEST_APPLESS_MAIN(tst_SimpleLexer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment