summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Klopcic <markok3.14@gmail.com>2013-02-19 07:25:13 +0100
committerMarko Klopcic <markok3.14@gmail.com>2013-02-19 07:25:13 +0100
commit2a8b20785eebf5adb87a1e206b94eb1dedb9c380 (patch)
tree48bc6bf331cf7a2dfbf62c8144ddec90a2510ce3
parentfa8fc4baf3ccd75c19f2081ee750264c0aea7f72 (diff)
downloadswig-2a8b20785eebf5adb87a1e206b94eb1dedb9c380.tar.gz
fixed bug in handling of HTML tags, test added
-rw-r--r--Examples/test-suite/doxygen_misc_constructs.h9
-rw-r--r--Examples/test-suite/java/doxygen_misc_constructs_runme.java11
-rw-r--r--Source/DoxygenTranslator/src/DoxygenParser.cpp9
3 files changed, 24 insertions, 5 deletions
diff --git a/Examples/test-suite/doxygen_misc_constructs.h b/Examples/test-suite/doxygen_misc_constructs.h
index d25b5af15..edbea3ed5 100644
--- a/Examples/test-suite/doxygen_misc_constructs.h
+++ b/Examples/test-suite/doxygen_misc_constructs.h
@@ -64,4 +64,11 @@ void backslashB()
void backslashC()
{}
-
+/**
+ * The next line contains expression:
+ * <pre>
+ * ['retVal < 10', 'g_counter == 23 && g_mode & 3']
+ *</pre>
+ */
+void cycle()
+{}
diff --git a/Examples/test-suite/java/doxygen_misc_constructs_runme.java b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
index ae9cc442f..b14918a64 100644
--- a/Examples/test-suite/java/doxygen_misc_constructs_runme.java
+++ b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
@@ -153,7 +153,16 @@ public class doxygen_misc_constructs_runme {
" <i>with</i> old comment parser.\n" +
" @see MyClass#fun(char,float)\n" +
"");
-
+
+ wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.cycle()",
+ " The next line contains expression:\n" +
+ " <pre>\n" +
+ " ['retVal &lt; 10', 'g_counter == 23 &amp;&amp; g_mode &amp; 3']\n" +
+ " </pre>\n" +
+ "\n" +
+ "");
+
+
// and ask the parser to check comments for us
System.exit(parser.check(wantedComments));
}
diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp
index 9c07eb4cf..d270631df 100644
--- a/Source/DoxygenTranslator/src/DoxygenParser.cpp
+++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp
@@ -1120,7 +1120,7 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line)
pos = endHtmlPos;
// prepend '<' to distinguish HTML tags from doxygen commands
- if (addDoxyCommand(m_tokenList, '<' + cmd)) {
+ if (!cmd.empty() && addDoxyCommand(m_tokenList, '<' + cmd)) {
// it is a valid HTML command
if (line[pos] != '>') { // it should be HTML tag with args,
// for example <A ...>, <IMG ...>, ...
@@ -1148,7 +1148,10 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line)
m_tokenList.push_back(Token(PLAINSTRING, ""));
}
}
- pos++; // skip '>'
+
+ if (pos != string::npos) {
+ pos++; // skip '>'
+ }
} else {
// the command is not HTML supported by Doxygen, < and > will be
// replaced by HTML entities &lt; and &gt; respectively,
@@ -1164,7 +1167,7 @@ void DoxygenParser::processHtmlEntities(size_t &pos, const std::string &line)
if (endOfWordPos != string::npos) {
- if (line[endOfWordPos] == ';')
+ if (line[endOfWordPos] == ';' && (endOfWordPos - pos) > 1)
{
// if entity is not recognized by Doxygen (not in the list of
// commands) nothing is added (here and in Doxygen).