fixed handling of quoted text adn standalone backslash and @
This commit is contained in:
parent
43eeb4528c
commit
8de06366cf
7 changed files with 61 additions and 25 deletions
|
|
@ -27,7 +27,7 @@ void isNoSpaceValidC()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backslash following\c word is a valid doxygen command. Output contains
|
* Backslash following\c word is a valid doxygen command. Output contains
|
||||||
* 'followingword' with 'word' in 'code' font.
|
* 'followingword' with 'word' in code font.
|
||||||
*/
|
*/
|
||||||
void backslashA()
|
void backslashA()
|
||||||
{}
|
{}
|
||||||
|
|
@ -41,12 +41,13 @@ void backslashA()
|
||||||
* Doxy command without trailing \cspace space is ignored - nothing appears
|
* Doxy command without trailing \cspace space is ignored - nothing appears
|
||||||
* on output. Standalone \ and '\' get to output.
|
* on output. Standalone \ and '\' get to output.
|
||||||
* Standalone @ and '@' get to output.
|
* Standalone @ and '@' get to output.
|
||||||
|
* Commands "in quoted \b strings are treated as plain text".
|
||||||
* Commands not recognized by Doxygen \blah @blah are ignored.
|
* Commands not recognized by Doxygen \blah @blah are ignored.
|
||||||
* Backslashes in DOS paths d:\xyz\c\myfile and
|
* Backslashes in DOS paths d:\xyz\qwe\myfile and words
|
||||||
* words following them do not appear on output, we must quote them with
|
* following them do not appear on output, we must quote them with
|
||||||
* double quotes: "d:\xyz\c\myfile", "@something". single quotes do not help:
|
* double quotes: "d:\xyz\qwe\myfile", "@something". Single quotes do not help:
|
||||||
* 'd:\xyz\c\myfile'. Escaping works: d:\\xyz\\c\\myfile. Unix
|
* 'd:\xyz\qwe\myfile'. Escaping works: d:\\xyz\\qwe\\myfile. Unix
|
||||||
* paths of course have no such problems: /xyz/c/myfile
|
* paths of course have no such problems: /xyz/qwe/myfile
|
||||||
* Commands for escaped symbols:
|
* Commands for escaped symbols:
|
||||||
* \$ \@ \\ \& \~ \< \> \# \% \" \. \:: \@text \::text
|
* \$ \@ \\ \& \~ \< \> \# \% \" \. \:: \@text \::text
|
||||||
*/
|
*/
|
||||||
|
|
@ -56,14 +57,8 @@ void backslashB()
|
||||||
/**
|
/**
|
||||||
* Backslash e at end of \e line froze SWIG \e
|
* Backslash e at end of \e line froze SWIG \e
|
||||||
* with old comment parser.
|
* with old comment parser.
|
||||||
* \arg some list item
|
|
||||||
*/
|
*/
|
||||||
void backslashC()
|
void backslashC()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void htmlTags()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,8 @@ public class commentParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!actualStr.equals(wantedStr)) {
|
if (!actualStr.equals(wantedStr)) {
|
||||||
System.out.println("Documentation comments for " + e.getKey() + " do not match!");
|
System.out.println("\n\n////////////////////////////////////////////////////////////////////////");
|
||||||
|
System.out.println("Documentation comments for '" + e.getKey() + "' do not match!");
|
||||||
String expectedFileName = "expected.txt";
|
String expectedFileName = "expected.txt";
|
||||||
String gotFileName = "got.txt";
|
String gotFileName = "got.txt";
|
||||||
System.out.println("Output is also saved to files '" + expectedFileName +
|
System.out.println("Output is also saved to files '" + expectedFileName +
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class doxygen_misc_constructs_runme {
|
||||||
" return reference to self, so we can use it like this: \n" +
|
" return reference to self, so we can use it like this: \n" +
|
||||||
" <pre> \n" +
|
" <pre> \n" +
|
||||||
" CConnectionConfig config = new CConnectionConfig(); \n" +
|
" CConnectionConfig config = new CConnectionConfig(); \n" +
|
||||||
" config.discoveryPort(5534).dllPath(\"C: \\ yWinIDEA \\ onnect.dll\").id(\"main\"); \n" +
|
" config.discoveryPort(5534).dllPath(\"C:\\\\myWinIDEA\\\\connect.dll\").id(\"main\"); \n" +
|
||||||
" </pre> \n" +
|
" </pre> \n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
" All parameters are optional. Set only what is required, default values are \n" +
|
" All parameters are optional. Set only what is required, default values are \n" +
|
||||||
|
|
@ -130,21 +130,31 @@ public class doxygen_misc_constructs_runme {
|
||||||
"");
|
"");
|
||||||
|
|
||||||
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashA()",
|
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashA()",
|
||||||
" Backslash following<code>word</code> is valid doxygen command. Output contains \n" +
|
" Backslash following<code>word</code> is a valid doxygen command. Output contains\n" +
|
||||||
" 'followingword' with word in 'code' font. \n" +
|
" 'followingword' with 'word' in code font. \n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
"");
|
"");
|
||||||
|
|
||||||
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashB()",
|
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashB()",
|
||||||
" Doxy command without trailing cspace space is ignored. Standalone \n" +
|
" Doxy command without trailing space is ignored - nothing appears\n" +
|
||||||
" \\ and '\\' get to output. Commands not recognized by Doxygen \n" +
|
" on output. Standalone \\ and '\\' get to output. \n" +
|
||||||
" are ignored. Backslashes in DOS paths d: and words \n" +
|
" Standalone @ and '@' get to output. \n" +
|
||||||
|
" Commands \"in quoted \\b strings are treated as plain text\". \n" +
|
||||||
|
" Commands not recognized by Doxygen are ignored. \n" +
|
||||||
|
" Backslashes in DOS paths d: and words \n" +
|
||||||
" following them do not appear on output, we must quote them with \n" +
|
" following them do not appear on output, we must quote them with \n" +
|
||||||
" double quotes: \"d:\\xyz\\c\\myfile\", single quotes do not help: \n" +
|
" double quotes: \"d:\\xyz\\qwe\\myfile\", \"@something\". Single quotes do not help: \n" +
|
||||||
" 'd: '. Escaping works: d:\\xyz\\c\\myfile. Unix \n" +
|
" 'd: '. Escaping works: d:\\xyz\\qwe\\myfile. Unix \n" +
|
||||||
" paths of course have no such problems: /xyz/c/myfile \n" +
|
" paths of course have no such problems: /xyz/qwe/myfile \n" +
|
||||||
|
" Commands for escaped symbols:\n" +
|
||||||
|
" $ @ \\ & ~ < > # % " . :: @text ::text" +
|
||||||
" \n");
|
" \n");
|
||||||
|
|
||||||
|
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashC()",
|
||||||
|
" Backslash e at end of <i>line</i> froze SWIG\n" +
|
||||||
|
" <i>with</i> old comment parser.\n" +
|
||||||
|
"");
|
||||||
|
|
||||||
// and ask the parser to check comments for us
|
// and ask the parser to check comments for us
|
||||||
System.exit(parser.check(wantedComments));
|
System.exit(parser.check(wantedComments));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ public class doxygen_translate_all_tags_runme {
|
||||||
|
|
||||||
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func04(int)",
|
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func04(int)",
|
||||||
" @exception SuperError \n" +
|
" @exception SuperError \n" +
|
||||||
|
" \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
|
||||||
|
" \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
|
||||||
|
" \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \n" +
|
||||||
" This will only appear in hmtl \n");
|
" This will only appear in hmtl \n");
|
||||||
|
|
||||||
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func05(int)",
|
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func05(int)",
|
||||||
|
|
|
||||||
|
|
@ -1167,6 +1167,16 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line)
|
||||||
// process doxy commands for escaped characters - handling this separately
|
// process doxy commands for escaped characters - handling this separately
|
||||||
// supports documentation text like \@someText
|
// supports documentation text like \@someText
|
||||||
if ((pos + 1) < line.size()) {
|
if ((pos + 1) < line.size()) {
|
||||||
|
|
||||||
|
// \ and @ with trailing whitespace or quoted get to output as plain string
|
||||||
|
string whitespaces = " '\t\n";
|
||||||
|
if (whitespaces.find(line[pos + 1]) != string::npos) {
|
||||||
|
m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, 1)));
|
||||||
|
pos++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// these chars can be escaped for doxygen
|
||||||
string escapedChars = "$@\\&~<>#%\".";
|
string escapedChars = "$@\\&~<>#%\".";
|
||||||
if (escapedChars.find(line[pos + 1]) != string::npos) {
|
if (escapedChars.find(line[pos + 1]) != string::npos) {
|
||||||
addDoxyCommand(m_tokenList, line.substr(pos + 1, 1));
|
addDoxyCommand(m_tokenList, line.substr(pos + 1, 1));
|
||||||
|
|
@ -1281,6 +1291,11 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line)
|
||||||
pos = endOfWordPos;
|
pos = endOfWordPos;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '"':
|
||||||
|
m_isInQuotedString = true;
|
||||||
|
m_tokenList.push_back(Token(PLAINSTRING, "\""));
|
||||||
|
pos++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
m_tokenListIt = m_tokenList.end();
|
m_tokenListIt = m_tokenList.end();
|
||||||
printListError(WARN_DOXYGEN_COMMAND_ERROR, "Unknown special character: " + line[pos]);
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "Unknown special character: " + line[pos]);
|
||||||
|
|
@ -1298,6 +1313,7 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment,
|
||||||
int fileLine)
|
int fileLine)
|
||||||
{
|
{
|
||||||
m_isVerbatimText = false;
|
m_isVerbatimText = false;
|
||||||
|
m_isInQuotedString = false;
|
||||||
m_tokenList.clear();
|
m_tokenList.clear();
|
||||||
m_fileLineNo = fileLine;
|
m_fileLineNo = fileLine;
|
||||||
m_fileName = fileName;
|
m_fileName = fileName;
|
||||||
|
|
@ -1329,17 +1345,24 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment,
|
||||||
|
|
||||||
while (pos != string::npos) {
|
while (pos != string::npos) {
|
||||||
// find the end of the word
|
// find the end of the word
|
||||||
size_t doxyCmdOrHtmlTagPos = line.find_first_of("\\@<>& \t", pos);
|
size_t doxyCmdOrHtmlTagPos = line.find_first_of("\\@<>&\" \t", pos);
|
||||||
if (doxyCmdOrHtmlTagPos != pos) {
|
if (doxyCmdOrHtmlTagPos != pos) {
|
||||||
// plain text found
|
// plain text found
|
||||||
m_tokenList.push_back(Token(PLAINSTRING,
|
m_tokenList.push_back(Token(PLAINSTRING,
|
||||||
line.substr(pos, doxyCmdOrHtmlTagPos - pos)));
|
line.substr(pos, doxyCmdOrHtmlTagPos - pos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = doxyCmdOrHtmlTagPos;
|
pos = doxyCmdOrHtmlTagPos;
|
||||||
if (pos != string::npos) {
|
if (pos != string::npos) {
|
||||||
if (m_isVerbatimText) {
|
if (m_isVerbatimText) {
|
||||||
pos = processVerbatimText(pos, line);
|
pos = processVerbatimText(pos, line);
|
||||||
|
} else if (m_isInQuotedString) {
|
||||||
|
if (line[pos] == '"') {
|
||||||
|
m_isInQuotedString = false;
|
||||||
|
}
|
||||||
|
m_tokenList.push_back(Token(PLAINSTRING,
|
||||||
|
line.substr(pos, 1)));
|
||||||
|
pos++;
|
||||||
} else {
|
} else {
|
||||||
pos = processNormalComment(pos, line);
|
pos = processNormalComment(pos, line);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ private:
|
||||||
static std::set<std::string> doxygenSectionIndicators;
|
static std::set<std::string> doxygenSectionIndicators;
|
||||||
|
|
||||||
bool m_isVerbatimText; // used to handle \htmlonly and \verbatim commands
|
bool m_isVerbatimText; // used to handle \htmlonly and \verbatim commands
|
||||||
|
bool m_isInQuotedString;
|
||||||
|
|
||||||
std::string m_fileName;
|
std::string m_fileName;
|
||||||
int m_fileLineNo;
|
int m_fileLineNo;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ void JavaDocConverter::fillStaticTables() {
|
||||||
* entities must be translated - remain in Java, something meaningfull in Python (<, ...)
|
* entities must be translated - remain in Java, something meaningfull in Python (<, ...)
|
||||||
*
|
*
|
||||||
* - enum inside class is missing comment
|
* - enum inside class is missing comment
|
||||||
|
* - crash if link in @see tag is split to two lines
|
||||||
|
* - whitespaces in tests
|
||||||
|
* - Python
|
||||||
* - '\' not representing doxygen commands
|
* - '\' not representing doxygen commands
|
||||||
* - add comments also to auto-generated methods lilke equals(), delete() in Java,
|
* - add comments also to auto-generated methods lilke equals(), delete() in Java,
|
||||||
* and methods for std::vector(), ...
|
* and methods for std::vector(), ...
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue