diff --git a/Examples/test-suite/doxygen_misc_constructs.h b/Examples/test-suite/doxygen_misc_constructs.h index ab97cc81d..75a5cbba2 100644 --- a/Examples/test-suite/doxygen_misc_constructs.h +++ b/Examples/test-suite/doxygen_misc_constructs.h @@ -27,7 +27,7 @@ void isNoSpaceValidC() /** * 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() {} @@ -41,12 +41,13 @@ void backslashA() * Doxy command without trailing \cspace space is ignored - nothing appears * on 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. - * Backslashes in DOS paths d:\xyz\c\myfile and - * words following them do not appear on output, we must quote them with - * double quotes: "d:\xyz\c\myfile", "@something". single quotes do not help: - * 'd:\xyz\c\myfile'. Escaping works: d:\\xyz\\c\\myfile. Unix - * paths of course have no such problems: /xyz/c/myfile + * Backslashes in DOS paths d:\xyz\qwe\myfile and words + * following them do not appear on output, we must quote them with + * double quotes: "d:\xyz\qwe\myfile", "@something". Single quotes do not help: + * 'd:\xyz\qwe\myfile'. Escaping works: d:\\xyz\\qwe\\myfile. Unix + * paths of course have no such problems: /xyz/qwe/myfile * Commands for escaped symbols: * \$ \@ \\ \& \~ \< \> \# \% \" \. \:: \@text \::text */ @@ -56,14 +57,8 @@ void backslashB() /** * Backslash e at end of \e line froze SWIG \e * with old comment parser. - * \arg some list item */ void backslashC() {} -/** - * - */ -void htmlTags() -{} diff --git a/Examples/test-suite/java/commentParser.java b/Examples/test-suite/java/commentParser.java index f410e889f..cc40c4ac8 100644 --- a/Examples/test-suite/java/commentParser.java +++ b/Examples/test-suite/java/commentParser.java @@ -63,7 +63,8 @@ public class commentParser { } 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 gotFileName = "got.txt"; System.out.println("Output is also saved to files '" + expectedFileName + diff --git a/Examples/test-suite/java/doxygen_misc_constructs_runme.java b/Examples/test-suite/java/doxygen_misc_constructs_runme.java index c7a14f91e..073460f05 100644 --- a/Examples/test-suite/java/doxygen_misc_constructs_runme.java +++ b/Examples/test-suite/java/doxygen_misc_constructs_runme.java @@ -72,7 +72,7 @@ public class doxygen_misc_constructs_runme { " return reference to self, so we can use it like this: \n" + "
\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" +
" \n" +
" \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()",
- " Backslash followingword is valid doxygen command. Output contains \n" +
- " 'followingword' with word in 'code' font. \n" +
+ " Backslash followingword is a valid doxygen command. Output contains\n" +
+ " 'followingword' with 'word' in code font. \n" +
" \n" +
"");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashB()",
- " Doxy command without trailing cspace space is ignored. Standalone \n" +
- " \\ and '\\' get to output. Commands not recognized by Doxygen \n" +
- " are ignored. Backslashes in DOS paths d: and words \n" +
+ " Doxy command without trailing space is ignored - nothing appears\n" +
+ " on output. Standalone \\ and '\\' get to output. \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" +
- " double quotes: \"d:\\xyz\\c\\myfile\", single quotes do not help: \n" +
- " 'd: '. Escaping works: d:\\xyz\\c\\myfile. Unix \n" +
- " paths of course have no such problems: /xyz/c/myfile \n" +
+ " double quotes: \"d:\\xyz\\qwe\\myfile\", \"@something\". Single quotes do not help: \n" +
+ " 'd: '. Escaping works: d:\\xyz\\qwe\\myfile. Unix \n" +
+ " paths of course have no such problems: /xyz/qwe/myfile \n" +
+ " Commands for escaped symbols:\n" +
+ " $ @ \\ & ~ < > # % " . :: @text ::text" +
" \n");
-
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.backslashC()",
+ " Backslash e at end of line froze SWIG\n" +
+ " with old comment parser.\n" +
+ "");
+
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
diff --git a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
index aa6ed44ff..6bb56c437 100644
--- a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
+++ b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java
@@ -59,6 +59,9 @@ public class doxygen_translate_all_tags_runme {
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func04(int)",
" @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");
wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.func05(int)",
diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp
index f32c7260f..4a96fa922 100644
--- a/Source/DoxygenTranslator/src/DoxygenParser.cpp
+++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp
@@ -1167,6 +1167,16 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line)
// process doxy commands for escaped characters - handling this separately
// supports documentation text like \@someText
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 = "$@\\&~<>#%\".";
if (escapedChars.find(line[pos + 1]) != string::npos) {
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;
}
break;
+ case '"':
+ m_isInQuotedString = true;
+ m_tokenList.push_back(Token(PLAINSTRING, "\""));
+ pos++;
+ break;
default:
m_tokenListIt = m_tokenList.end();
printListError(WARN_DOXYGEN_COMMAND_ERROR, "Unknown special character: " + line[pos]);
@@ -1298,6 +1313,7 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment,
int fileLine)
{
m_isVerbatimText = false;
+ m_isInQuotedString = false;
m_tokenList.clear();
m_fileLineNo = fileLine;
m_fileName = fileName;
@@ -1329,17 +1345,24 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment,
while (pos != string::npos) {
// 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) {
// plain text found
m_tokenList.push_back(Token(PLAINSTRING,
- line.substr(pos, doxyCmdOrHtmlTagPos - pos)));
+ line.substr(pos, doxyCmdOrHtmlTagPos - pos)));
}
pos = doxyCmdOrHtmlTagPos;
if (pos != string::npos) {
if (m_isVerbatimText) {
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 {
pos = processNormalComment(pos, line);
}
diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h
index 558a85ef3..adc5c7f26 100644
--- a/Source/DoxygenTranslator/src/DoxygenParser.h
+++ b/Source/DoxygenTranslator/src/DoxygenParser.h
@@ -88,6 +88,7 @@ private:
static std::set