improved commands for escaped characters

This commit is contained in:
Marko Klopcic 2013-01-13 20:02:39 +01:00
commit 32f34e16be
5 changed files with 53 additions and 21 deletions

View file

@ -18,7 +18,9 @@ const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionInd
/* All of the doxygen commands divided up by how they are parsed */
const char *simpleCommands[] = {
"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%", "\"", ".", "::", "endcond",
// the first line are escaped chars, except \~, which is a language ID command.
"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%", "\"", ".", "::",
"endcond",
"callgraph", "callergraph", "showinitializer", "hideinitializer", "internal",
"nosubgrouping", "public", "publicsection", "private", "privatesection",
"protected", "protectedsection", "tableofcontents"};

View file

@ -1114,19 +1114,26 @@ size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line)
size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line)
{
switch (line[pos]) {
case '\\': // process doxy command or escaped char
/* switch (line[pos + 1]) {
case '$':
case '@':
case '\':
case '&':
case '~':
case '<':
case '>':
case '#': \% \" \. \::
}
TODO break case if any of escaped chars */
case '\\':
case '@': {
// process doxy commands for escaped characters - handling this separately
// supports documentation text like \@someText
if ((pos + 1) < line.size()) {
string escapedChars = "$@\\&~<>#%\".";
if (escapedChars.find(line[pos + 1]) != string::npos) {
addDoxyCommand(m_tokenList, line.substr(pos + 1, 1));
pos += 2;
break;
} else if ((pos + 2) < line.size() &&
line[pos + 1] == ':' && line[pos + 2] == ':') {
// add command \:: - handling this separately supports documentation
// text like \::someText
addDoxyCommand(m_tokenList, line.substr(pos + 1, 2));
pos += 3;
break;
}
}
// handle word commands and \f[, \f$, ... commands
pos++;
// characters '$[]{}' are used in commands \f$, \f[, ...
size_t endOfWordPos = line.find_first_not_of("abcdefghijklmnopqrstuvwxyz$[]{}", pos);

View file

@ -296,7 +296,6 @@ void JavaDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translated
translatedComment += arg;
else
translatedComment += tag.typeOfEntity;
translatedComment += " ";
}
// handles tags which are the same in Doxygen and Javadoc.
@ -394,10 +393,9 @@ void JavaDocConverter::handleTagParam(DoxygenEntity& tag,
return;
translatedComment += "@param ";
translatedComment += tag.entityList.begin()->data + " ";
translatedComment += tag.entityList.begin()->data;
tag.entityList.pop_front();
handleParagraph(tag, translatedComment, dummy);
printf("cmd: %s\n", translatedComment.c_str());
}