From 6629d93481d437ffb3dfcd9d17a0bef310c6b718 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 27 Aug 2014 00:05:06 +0200 Subject: [PATCH] Allow upper case letters and digits in Doxygen words. Although all standard Doxygen commands are composed from lower case letters and some special symbols only, custom commands can include upper case letters and digits too. Also use a symbolic constant defined once instead of repeating the same set of characters twice. --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 0f6e18943..5e1f3a5d3 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -22,6 +22,14 @@ using std::string; using std::cout; using std::endl; +// This constant defines the (only) characters valid inside a Doxygen "word". +// It includes some unusual ones because of the commands such as \f[, \f{, \f], +// \f} and \f$. +static const char* DOXYGEN_WORD_CHARS = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + "$[]{}"; + // Define static class members DoxygenParser::DoxyCommandsMap DoxygenParser::doxygenCommands; std::set DoxygenParser::doxygenSectionIndicators; @@ -1049,9 +1057,7 @@ size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) if (line[pos] == '\\' || line[pos] == '@') { // check for end commands pos++; - // characters '$[]{}' are used in commands \f$, \f[, and \f{ - size_t endOfWordPos = line.find_first_not_of( - "abcdefghijklmnopqrstuvwxyz$[]{}", pos); + size_t endOfWordPos = line.find_first_not_of( DOXYGEN_WORD_CHARS, pos); string cmd = line.substr(pos, endOfWordPos - pos); if (cmd == CMD_END_HTML_ONLY || cmd == CMD_END_VERBATIM @@ -1125,9 +1131,7 @@ bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) void DoxygenParser::processWordCommands(size_t &pos, const std::string &line) { pos++; - // characters '$[]{}' are used in commands \f$, \f[, ... - - size_t endOfWordPos = line.find_first_not_of("abcdefghijklmnopqrstuvwxyz$[]{}", pos); + size_t endOfWordPos = line.find_first_not_of(DOXYGEN_WORD_CHARS, pos); string cmd = line.substr(pos, endOfWordPos - pos); addDoxyCommand(m_tokenList, cmd);