--- doxygen-1.4.7_old/src/docparser.cpp	2006-05-07 13:02:30.000000000 -0500
+++ doxygen-1.4.7/src/docparser.cpp	2007-03-15 13:28:51.000000000 -0500
@@ -662,7 +662,11 @@
 static int handleStyleArgument(DocNode *parent,QList<DocNode> &children,
                                const QString &cmdName)
 {
-  DBG(("handleStyleArgument(%s)\n",cmdName.data()));
+  static int nest=0;
+  static int reparse_tok=0;
+  bool first=(nest==0?TRUE:FALSE);
+  int myNest = ++nest;
+  DBG(("handleStyleArgument(%s), nest=%d\n",cmdName.data(),nest));
   QString tokenName = g_token->name;
   int tok=doctokenizerYYlex();
   if (tok!=TK_WHITESPACE)
@@ -683,7 +687,9 @@
         g_token->name.find(specialChar)!=-1)
     {
       // special character that ends the markup command
-      return tok;
+      reparse_tok=tok;
+  DBG(("handleStyleArgument(%s) reparse tok=%x nest=%d\n",cmdName.data(),tok,nest));
+      return (nest > 1) ? RetVal_Nested : tok;
     }
     if (!defaultHandleToken(parent,tok,children))
     {
@@ -711,8 +717,25 @@
       }
       break;
     }
+    else if (nest > myNest) // stop parsing if a nested command already ate all tokens
+    {
+      break;
+    }
+  }
+  if (first) nest=0; // if we are first, reset nest when we exit
+  if (reparse_tok)
+  {
+  DBG(("handleStyleArgument(%s) reparse tok=%x first=%d\n",cmdName.data(),tok,first));
+    // if the upper level found a special end-markup token, we must propogate it
+    if (first)
+    {
+        tok=reparse_tok;
+        reparse_tok=0;
   }
-  DBG(("handleStyleArgument(%s) end tok=%x\n",cmdName.data(),tok));
+    return first?tok:RetVal_Nested;
+  }
+  DBG(("handleStyleArgument(%s) end tok=%x nest=%d\n",cmdName.data(),tok,nest));
+  if (nest) return RetVal_Nested;
   return (tok==TK_NEWPARA || tok==TK_LISTITEM || tok==TK_ENDLIST
          ) ? tok : RetVal_OK;
 }
@@ -1014,7 +1037,7 @@
             children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,TRUE));
             tok=handleStyleArgument(parent,children,tokenName);
             children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,FALSE));
-            if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
+            if (tok!=TK_WORD&&tok!=RetVal_Nested) children.append(new DocWhiteSpace(parent," "));
             if (tok==TK_NEWPARA) goto handlepara;
             else if (tok==TK_WORD || tok==TK_HTMLTAG)
             {
@@ -1028,7 +1051,7 @@
             children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Bold,TRUE));
             tok=handleStyleArgument(parent,children,tokenName);
             children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Bold,FALSE));
-            if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
+            if (tok!=TK_WORD&&tok!=RetVal_Nested) children.append(new DocWhiteSpace(parent," "));
             if (tok==TK_NEWPARA) goto handlepara;
             else if (tok==TK_WORD || tok==TK_HTMLTAG)
             {
@@ -1042,7 +1065,7 @@
             children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Code,TRUE));
             tok=handleStyleArgument(parent,children,tokenName);
             children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Code,FALSE));
-            if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
+            if (tok!=TK_WORD&&tok!=RetVal_Nested) children.append(new DocWhiteSpace(parent," "));
             if (tok==TK_NEWPARA) goto handlepara;
             else if (tok==TK_WORD || tok==TK_HTMLTAG)
             {
@@ -4123,19 +4166,22 @@
       m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,TRUE));
       retval=handleStyleArgument(this,m_children,cmdName);
       m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,FALSE));
-      if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
+      if (retval!=TK_WORD&&retval!=RetVal_Nested) m_children.append(new DocWhiteSpace(this," "));
+      if (retval==RetVal_Nested) retval=RetVal_OK;
       break;
     case CMD_BOLD:
       m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,TRUE));
       retval=handleStyleArgument(this,m_children,cmdName);
       m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,FALSE));
-      if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
+      if (retval!=TK_WORD&&retval!=RetVal_Nested) m_children.append(new DocWhiteSpace(this," "));
+      if (retval==RetVal_Nested) retval=RetVal_OK;
       break;
     case CMD_CODE:
       m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Code,TRUE));
       retval=handleStyleArgument(this,m_children,cmdName);
       m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Code,FALSE));
-      if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
+      if (retval!=TK_WORD&&retval!=RetVal_Nested) m_children.append(new DocWhiteSpace(this," "));
+      if (retval==RetVal_Nested) retval=RetVal_OK;
       break;
     case CMD_BSLASH:
       m_children.append(new DocSymbol(this,DocSymbol::BSlash));
@@ -4700,7 +4752,8 @@
           m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,TRUE));
           retval=handleStyleArgument(this,m_children,paramName);
           m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,FALSE));
-          if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
+          if (retval!=TK_WORD&&retval!=RetVal_Nested) m_children.append(new DocWhiteSpace(this," "));
+          if (retval==RetVal_Nested) retval=RetVal_OK;
         }
         else
         {
