Commit a07d3d48 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Improved handling of \internal and \endinternal

parent 84f83537
......@@ -131,6 +131,7 @@ CommandMap cmdMap[] =
{ "vhdlflow", CMD_VHDLFLOW },
{ "docbookonly", CMD_DBONLY },
{ "enddocbookonly",CMD_ENDDBONLY },
{ "endinternal", CMD_ENDINTERNAL },
{ 0, 0 },
};
......
......@@ -120,7 +120,8 @@ enum CommandType
CMD_PIPE = 90,
CMD_VHDLFLOW = 91,
CMD_DBONLY = 92,
CMD_ENDDBONLY = 93
CMD_ENDDBONLY = 93,
CMD_ENDINTERNAL = 94
};
enum HtmlTagType
......
......@@ -1023,6 +1023,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
BEGIN(HtmlComment);
}
<Comment>{B}*{CMD}"endinternal"{B}* {
addOutput("\\endinternal ");
if (!inInternalDocs)
warn(yyFileName,yyLineNr,
"found \\endinternal without matching \\internal"
......@@ -1925,6 +1926,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
}
<SkipInternal>[@\\]"endinternal"[ \t]* {
addOutput("\\endinternal ");
BEGIN(Comment);
}
<SkipInternal>[^ \\@\n]+ { // skip non-special characters
......
......@@ -3207,7 +3207,8 @@ int DocInternal::parse(int level)
retval!=RetVal_Section &&
retval!=RetVal_Subsection &&
retval!=RetVal_Subsubsection &&
retval!=RetVal_Paragraph
retval!=RetVal_Paragraph &&
retval!=RetVal_EndInternal
);
if (lastPar) lastPar->markLast();
......@@ -3229,7 +3230,7 @@ int DocInternal::parse(int level)
warn_doc_error(g_fileName,doctokenizerYYlineno,"\\internal command found inside internal section");
}
DBG(("DocInternal::parse() end\n"));
DBG(("DocInternal::parse() end: retval=%x\n",retval));
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
return retval;
......@@ -5563,6 +5564,9 @@ int DocPara::handleCommand(const QCString &cmdName)
case CMD_INTERNAL:
retval = RetVal_Internal;
break;
case CMD_ENDINTERNAL:
retval = RetVal_EndInternal;
break;
case CMD_COPYDOC: // fall through
case CMD_COPYBRIEF: // fall through
case CMD_COPYDETAILS:
......@@ -5669,7 +5673,8 @@ int DocPara::handleCommand(const QCString &cmdName)
INTERNAL_ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec ||
retval==TK_LISTITEM || retval==TK_ENDLIST || retval==TK_NEWPARA ||
retval==RetVal_Section || retval==RetVal_EndList ||
retval==RetVal_Internal || retval==RetVal_SwitchLang
retval==RetVal_Internal || retval==RetVal_SwitchLang ||
retval==RetVal_EndInternal
);
DBG(("handleCommand(%s) end retval=%x\n",qPrint(cmdName),retval));
return retval;
......@@ -6618,12 +6623,22 @@ int DocSection::parse()
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Invalid list item found");
}
if (retval==RetVal_Internal)
{
DocInternal *in = new DocInternal(this);
m_children.append(in);
retval = in->parse(m_level+1);
if (retval==RetVal_EndInternal)
{
retval=RetVal_OK;
}
}
} while (retval!=0 &&
retval!=RetVal_Internal &&
retval!=RetVal_Section &&
retval!=RetVal_Subsection &&
retval!=RetVal_Subsubsection &&
retval!=RetVal_Paragraph
retval!=RetVal_Paragraph &&
retval!=RetVal_EndInternal
);
if (lastPar) lastPar->markLast();
......@@ -6680,12 +6695,6 @@ int DocSection::parse()
retval=0; // stop parsing
}
else if (retval==RetVal_Internal)
{
DocInternal *in = new DocInternal(this);
m_children.append(in);
retval = in->parse(m_level+1);
}
else
{
}
......@@ -6695,10 +6704,11 @@ int DocSection::parse()
retval==RetVal_Subsection ||
retval==RetVal_Subsubsection ||
retval==RetVal_Paragraph ||
retval==RetVal_Internal
retval==RetVal_Internal ||
retval==RetVal_EndInternal
);
DBG(("DocSection::parse() end\n"));
DBG(("DocSection::parse() end: retval=%x\n",retval));
DocNode *n = g_nodeStack.pop();
ASSERT(n==this);
return retval;
......@@ -6834,7 +6844,13 @@ void DocRoot::parse()
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found paragraph command outside of subsubsection context!");
}
} while (retval!=0 && retval!=RetVal_Section && retval!=RetVal_Internal);
if (retval==RetVal_Internal)
{
DocInternal *in = new DocInternal(this);
m_children.append(in);
retval = in->parse(1);
}
} while (retval!=0 && retval!=RetVal_Section);
if (lastPar) lastPar->markLast();
//printf("DocRoot::parse() retval=%d %d\n",retval,RetVal_Section);
......@@ -6856,14 +6872,6 @@ void DocRoot::parse()
}
}
if (retval==RetVal_Internal)
{
DocInternal *in = new DocInternal(this);
m_children.append(in);
retval = in->parse(1);
}
handleUnclosedStyleCommands();
DocNode *n = g_nodeStack.pop();
......
......@@ -62,7 +62,8 @@ enum Tokens
RetVal_SwitchLang = 0x10012,
RetVal_CloseXml = 0x10013,
RetVal_EndBlockQuote = 0x10014,
RetVal_CopyDoc = 0x10015
RetVal_CopyDoc = 0x10015,
RetVal_EndInternal = 0x10016
};
/** @brief Data associated with a token used by the comment block parser. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment