My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
DocPara Class Reference

#include <docparser.h>

Inheritance diagram for DocPara:
CompAccept< DocPara > DocNode

Public Member Functions

 DocPara (DocNode *parent)
 
int parse ()
 
Kind kind () const
 
bool isEmpty () const
 
void accept (DocVisitor *v)
 
void markFirst (bool v=TRUE)
 
void markLast (bool v=TRUE)
 
bool isFirst () const
 
bool isLast () const
 
int handleCommand (const QCString &cmdName)
 
int handleHtmlStartTag (const QCString &tagName, const HtmlAttribList &tagHtmlAttribs)
 
int handleHtmlEndTag (const QCString &tagName)
 
int handleSimpleSection (DocSimpleSect::Type t, bool xmlContext=FALSE)
 
int handleXRefItem ()
 
int handleParamSection (const QCString &cmdName, DocParamSect::Type t, bool xmlContext, int direction)
 
void handleIncludeOperator (const QCString &cmdName, DocIncOperator::Type t)
 
void handleImage (const QCString &cmdName)
 
template<class T >
void handleFile (const QCString &cmdName)
 
void handleInclude (const QCString &cmdName, DocInclude::Type t)
 
void handleLink (const QCString &cmdName, bool isJavaLink)
 
void handleCite ()
 
void handleRef (const QCString &cmdName)
 
void handleSection (const QCString &cmdName)
 
void handleInheritDoc ()
 
void handleVhdlFlow ()
 
int handleStartCode ()
 
int handleHtmlHeader (const HtmlAttribList &tagHtmlAttribs, int level)
 
bool injectToken (int tok, const QCString &tokText)
 
- Public Member Functions inherited from CompAccept< DocPara >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocPara *obj, DocVisitor *v)
 
const QList< DocNode > & children () const
 
QList< DocNode > & children ()
 
- Public Member Functions inherited from DocNode
 DocNode ()
 
virtual ~DocNode ()
 
DocNodeparent () const
 
void setParent (DocNode *parent)
 
bool isPreformatted () const
 

Private Attributes

QCString m_sectionId
 
bool m_isFirst
 
bool m_isLast
 

Additional Inherited Members

- Public Types inherited from DocNode
enum  Kind {
  Kind_Root = 0, Kind_Word = 1, Kind_WhiteSpace = 2, Kind_Para = 3,
  Kind_AutoList = 4, Kind_AutoListItem = 5, Kind_Symbol = 6, Kind_URL = 7,
  Kind_StyleChange = 8, Kind_SimpleSect = 9, Kind_Title = 10, Kind_SimpleList = 11,
  Kind_SimpleListItem = 12, Kind_Section = 13, Kind_Verbatim = 14, Kind_XRefItem = 15,
  Kind_HtmlList = 16, Kind_HtmlListItem = 17, Kind_HtmlDescList = 18, Kind_HtmlDescData = 19,
  Kind_HtmlDescTitle = 20, Kind_HtmlTable = 21, Kind_HtmlRow = 22, Kind_HtmlCell = 23,
  Kind_HtmlCaption = 24, Kind_LineBreak = 25, Kind_HorRuler = 26, Kind_Anchor = 27,
  Kind_IndexEntry = 28, Kind_Internal = 29, Kind_HRef = 30, Kind_Include = 31,
  Kind_IncOperator = 32, Kind_HtmlHeader = 33, Kind_Image = 34, Kind_DotFile = 35,
  Kind_Link = 36, Kind_Ref = 37, Kind_Formula = 38, Kind_SecRefItem = 39,
  Kind_SecRefList = 40, Kind_SimpleSectSep = 41, Kind_LinkedWord = 42, Kind_ParamSect = 43,
  Kind_ParamList = 44, Kind_InternalRef = 45, Kind_Copy = 46, Kind_Text = 47,
  Kind_MscFile = 48, Kind_HtmlBlockQuote = 49, Kind_VhdlFlow = 50, Kind_ParBlock = 51,
  Kind_DiaFile = 52
}
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 
- Protected Attributes inherited from CompAccept< DocPara >
QList< DocNodem_children
 
- Protected Attributes inherited from DocNode
DocNodem_parent
 

Detailed Description

Node representing a paragraph in the documentation tree

Definition at line 1113 of file docparser.h.

Constructor & Destructor Documentation

DocPara::DocPara ( DocNode parent)
inline

Definition at line 1116 of file docparser.h.

References DocNode::m_parent, and DocNode::parent().

:
m_isFirst(FALSE), m_isLast(FALSE) { m_parent = parent; }

Member Function Documentation

void DocPara::accept ( DocVisitor v)
inlinevirtual

Acceptor function for node visitors. Part of the visitor pattern.

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 1121 of file docparser.h.

References CompAccept< T >::accept().

Referenced by DocSimpleListItem::accept().

void DocPara::handleCite ( )

Definition at line 4907 of file docparser.cpp.

References doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateCite(), doctokenizerYYsetStatePara(), g_context, g_fileName, g_token, CompAccept< DocPara >::m_children, TokenInfo::name, TokenInfo::sectionId, TK_LNKWORD, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
// get the argument of the cite command.
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint("cite"));
return;
}
if (tok==0)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
"argument of command %s\n", qPrint("cite"));
return;
}
else if (tok!=TK_WORD && tok!=TK_LNKWORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint("cite"));
return;
}
DocCite *cite = new DocCite(this,g_token->name,g_context);
m_children.append(cite);
//cite->parse();
}
int DocPara::handleCommand ( const QCString &  cmdName)

Definition at line 5318 of file docparser.cpp.

References DocSimpleSect::Attention, DocSimpleSect::Author, DocSimpleSect::Authors, DocStyleChange::Bold, DocVerbatim::children(), CMD_ADDINDEX, CMD_AMP, CMD_ANCHOR, CMD_AT, CMD_ATTENTION, CMD_AUTHOR, CMD_AUTHORS, CMD_BOLD, CMD_BSLASH, CMD_CITE, CMD_CODE, CMD_COPYBRIEF, CMD_COPYDETAILS, CMD_COPYDOC, CMD_COPYRIGHT, CMD_DATE, CMD_DBONLY, CMD_DCOLON, CMD_DIAFILE, CMD_DOLLAR, CMD_DONTINCLUDE, CMD_DOT, CMD_DOTFILE, CMD_EMPHASIS, CMD_ENDCODE, CMD_ENDDBONLY, CMD_ENDDOT, CMD_ENDHTMLONLY, CMD_ENDINTERNAL, CMD_ENDLATEXONLY, CMD_ENDLINK, CMD_ENDMANONLY, CMD_ENDMSC, CMD_ENDPARBLOCK, CMD_ENDRTFONLY, CMD_ENDSECREFLIST, CMD_ENDUML, CMD_ENDVERBATIM, CMD_ENDXMLONLY, CMD_EXCEPTION, CMD_FORMULA, CMD_GREATER, CMD_HASH, CMD_HTMLINCLUDE, CMD_HTMLONLY, CMD_IMAGE, CMD_INCLUDE, CMD_INCLUDEDOC, CMD_INCWITHLINES, CMD_INHERITDOC, CMD_INTERNAL, CMD_INTERNALREF, CMD_INVARIANT, CMD_JAVALINK, CMD_LATEXINCLUDE, CMD_LATEXONLY, CMD_LESS, CMD_LI, CMD_LINE, CMD_LINEBREAK, CMD_LINK, CMD_MANONLY, CMD_MDASH, CMD_MINUS, CMD_MSC, CMD_MSCFILE, CMD_NDASH, CMD_NOTE, CMD_PAR, CMD_PARAGRAPH, CMD_PARAM, CMD_PARBLOCK, CMD_PERCENT, CMD_PIPE, CMD_PLUS, CMD_POST, CMD_PRE, CMD_PUNT, CMD_QUOTE, CMD_REF, CMD_REMARK, CMD_RETURN, CMD_RETVAL, CMD_RTFONLY, CMD_SA, CMD_SECREFITEM, CMD_SECREFLIST, CMD_SECTION, CMD_SINCE, CMD_SKIP, CMD_SKIPLINE, CMD_SNIPPET, CMD_SNIPPETDOC, CMD_STARTCODE, CMD_STARTUML, CMD_SUBPAGE, CMD_SUBSECTION, CMD_SUBSUBSECTION, CMD_TPARAM, CMD_UNKNOWN, CMD_UNTIL, CMD_VERBATIM, CMD_VERBINCLUDE, CMD_VERSION, CMD_VHDLFLOW, CMD_WARNING, CMD_XMLONLY, CMD_XREFITEM, Mappers::cmdMapper, DocStyleChange::Code, Config_getString, DocSimpleSect::Copyright, DocSimpleSect::Date, DBG, defaultHandleTitleAndSize(), DocVerbatim::DocbookOnly, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateCode(), doctokenizerYYsetStateDbOnly(), doctokenizerYYsetStateDot(), doctokenizerYYsetStateHtmlOnly(), doctokenizerYYsetStateLatexOnly(), doctokenizerYYsetStateManOnly(), doctokenizerYYsetStateMsc(), doctokenizerYYsetStatePara(), doctokenizerYYsetStatePlantUML(), doctokenizerYYsetStatePlantUMLOpt(), doctokenizerYYsetStateRtfOnly(), doctokenizerYYsetStateVerbatim(), doctokenizerYYsetStateXmlOnly(), DocInclude::DontInclude, DocVerbatim::Dot, DocParamSect::Exception, g_context, g_exampleName, g_fileName, g_hasReturnCommand, g_inSeeBlock, g_isExample, g_nodeStack, g_token, Doxygen::globalScope, handleAnchor(), handleCite(), handleImage(), handleInclude(), handleIncludeOperator(), handleInheritDoc(), handleInternalRef(), handleLink(), handleParamSection(), handleRef(), handleSection(), handleSimpleSection(), handleStartCode(), handleStyleArgument(), handleVhdlFlow(), handleXRefItem(), DocInclude::HtmlInclude, DocVerbatim::HtmlOnly, TokenInfo::id, DocInclude::Include, DocInclude::IncludeDoc, DocInclude::IncWithLines, INTERNAL_ASSERT, DocSimpleSect::Invar, DocStyleChange::Italic, DocInclude::LatexInclude, DocVerbatim::LatexOnly, DocIncOperator::Line, CompAccept< DocPara >::m_children, DocVerbatim::ManOnly, Mapper::map(), DocVerbatim::Msc, TokenInfo::name, DocSimpleSect::Note, DocParamSect::Param, TokenInfo::paramDir, DocIndexEntry::parse(), DocInternalRef::parse(), DocSecRefList::parse(), DocParBlock::parse(), DocSimpleList::parse(), DocVerbatim::PlantUML, DocSimpleSect::Post, DocSimpleSect::Pre, DocSimpleSect::Remark, DocSimpleSect::Return, DocParamSect::RetVal, RetVal_EndInternal, RetVal_EndList, RetVal_EndParBlock, RetVal_Internal, RetVal_OK, RetVal_Paragraph, RetVal_Section, RetVal_SimpleSec, RetVal_Subsection, RetVal_Subsubsection, RetVal_SwitchLang, DocVerbatim::RtfOnly, TokenInfo::sectionId, DocSimpleSect::See, DocVerbatim::setHeight(), DocVerbatim::setText(), DocVerbatim::setWidth(), DocSimpleSect::Since, DocIncOperator::Skip, DocIncOperator::SkipLine, DocInclude::Snippet, DocInclude::SnippetDoc, DocSymbol::Sym_Amp, DocSymbol::Sym_At, DocSymbol::Sym_BSlash, DocSymbol::Sym_Dollar, DocSymbol::Sym_Dot, DocSymbol::Sym_DoubleColon, DocSymbol::Sym_Greater, DocSymbol::Sym_Hash, DocSymbol::Sym_Less, DocSymbol::Sym_Minus, DocSymbol::Sym_Percent, DocSymbol::Sym_Pipe, DocSymbol::Sym_Plus, DocSymbol::Sym_Quot, DocParamSect::TemplateParam, TK_ENDLIST, TK_LISTITEM, TK_NEWPARA, TK_WORD, DocIncOperator::Until, DocSimpleSect::User, TokenInfo::verb, DocVerbatim::Verbatim, DocInclude::VerbInclude, DocSimpleSect::Version, warn_doc_error(), DocSimpleSect::Warning, and DocVerbatim::XmlOnly.

Referenced by parse().

{
DBG(("handleCommand(%s)\n",qPrint(cmdName)));
int retval = RetVal_OK;
int cmdId = Mappers::cmdMapper->map(cmdName);
switch (cmdId)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Found unknown command `\\%s'",qPrint(cmdName));
break;
retval=handleStyleArgument(this,m_children,cmdName);
if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
break;
case CMD_BOLD:
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," "));
break;
case CMD_CODE:
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," "));
break;
case CMD_BSLASH:
break;
case CMD_AT:
break;
case CMD_LESS:
break;
break;
case CMD_AMP:
break;
case CMD_DOLLAR:
break;
case CMD_HASH:
break;
case CMD_PIPE:
break;
case CMD_DCOLON:
break;
break;
case CMD_NDASH:
break;
case CMD_MDASH:
break;
case CMD_QUOTE:
break;
case CMD_PUNT:
break;
case CMD_PLUS:
break;
case CMD_MINUS:
break;
case CMD_SA:
g_inSeeBlock=FALSE;
break;
case CMD_RETURN:
break;
case CMD_AUTHOR:
break;
break;
break;
case CMD_SINCE:
break;
case CMD_DATE:
break;
case CMD_NOTE:
break;
break;
case CMD_PRE:
break;
case CMD_POST:
break;
break;
break;
case CMD_REMARK:
break;
break;
case CMD_PAR:
break;
case CMD_LI:
{
m_children.append(sl);
retval = sl->parse();
}
break;
{
handleSection(cmdName);
retval = RetVal_Section;
}
break;
{
handleSection(cmdName);
}
break;
{
handleSection(cmdName);
}
break;
{
handleSection(cmdName);
retval = RetVal_Paragraph;
}
break;
{
retval = handleStartCode();
}
break;
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"htmlonly section ended without end marker");
}
break;
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"manonly section ended without end marker");
}
break;
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"rtfonly section ended without end marker");
}
break;
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"latexonly section ended without end marker");
}
break;
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"xmlonly section ended without end marker");
}
break;
case CMD_DBONLY:
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker",doctokenizerYYlineno);
}
break;
{
retval = doctokenizerYYlex();
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"verbatim section ended without end marker");
}
break;
case CMD_DOT:
{
QCString width,height;
defaultHandleTitleAndSize(CMD_DOT,dv,dv->children(),width,height);
retval = doctokenizerYYlex();
dv->setWidth(width);
dv->setHeight(height);
m_children.append(dv);
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"dot section ended without end marker");
}
break;
case CMD_MSC:
{
QCString width,height;
defaultHandleTitleAndSize(CMD_MSC,dv,dv->children(),width,height);
retval = doctokenizerYYlex();
dv->setWidth(width);
dv->setHeight(height);
m_children.append(dv);
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"msc section ended without end marker");
}
break;
{
static QCString jarPath = Config_getString(PLANTUML_JAR_PATH);
retval = doctokenizerYYlex();
QCString plantFile(g_token->sectionId);
QCString width,height;
retval = doctokenizerYYlex();
dv->setWidth(width);
dv->setHeight(height);
if (jarPath.isEmpty())
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"ignoring \\startuml command because PLANTUML_JAR_PATH is not set");
delete dv;
}
else
{
m_children.append(dv);
}
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"startuml section ended without end marker");
}
break;
break;
case CMD_ENDDOT:
case CMD_ENDMSC:
case CMD_ENDUML:
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
break;
case CMD_PARAM:
break;
case CMD_TPARAM:
break;
case CMD_RETVAL:
break;
break;
retval = handleXRefItem();
break;
{
DocLineBreak *lb = new DocLineBreak(this);
m_children.append(lb);
}
break;
case CMD_ANCHOR:
{
DocAnchor *anchor = handleAnchor(this);
if (anchor)
{
m_children.append(anchor);
}
}
break;
{
DocIndexEntry *ie = new DocIndexEntry(this,
m_children.append(ie);
retval = ie->parse();
}
break;
retval = RetVal_Internal;
break;
break;
{
DocParBlock *block = new DocParBlock(this);
m_children.append(block);
retval = block->parse();
}
break;
case CMD_COPYDOC: // fall through
case CMD_COPYBRIEF: // fall through
//retval = RetVal_CopyDoc;
// these commands should already be resolved by processCopyDoc()
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
case CMD_SKIP:
break;
case CMD_UNTIL:
break;
break;
case CMD_LINE:
break;
case CMD_IMAGE:
handleImage(cmdName);
break;
handleFile<DocDotFile>(cmdName);
break;
break;
handleFile<DocMscFile>(cmdName);
break;
handleFile<DocDiaFile>(cmdName);
break;
case CMD_LINK:
handleLink(cmdName,FALSE);
break;
handleLink(cmdName,TRUE);
break;
case CMD_CITE:
break;
case CMD_REF: // fall through
handleRef(cmdName);
break;
{
DocSecRefList *list = new DocSecRefList(this);
m_children.append(list);
list->parse();
}
break;
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
break;
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
break;
{
DocFormula *form=new DocFormula(this,g_token->id);
m_children.append(form);
}
break;
//case CMD_LANGSWITCH:
// retval = handleLanguageSwitch();
// break;
//warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
{
if (ref)
{
m_children.append(ref);
ref->parse();
}
}
break;
break;
default:
// we should not get here!
ASSERT(0);
break;
}
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 ||
);
DBG(("handleCommand(%s) end retval=%x\n",qPrint(cmdName),retval));
return retval;
}
template<class T >
void DocPara::handleFile ( const QCString &  cmdName)

Definition at line 5066 of file docparser.cpp.

References doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateFile(), doctokenizerYYsetStatePara(), g_context, g_fileName, g_token, CompAccept< DocPara >::m_children, TokenInfo::name, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

{
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
QCString name = g_token->name;
T *df = new T(this,name,g_context);
m_children.append(df);
df->parse();
}
int DocPara::handleHtmlEndTag ( const QCString &  tagName)

Definition at line 6205 of file docparser.cpp.

References DocStyleChange::Bold, DocStyleChange::Center, DocStyleChange::Code, DBG, DocStyleChange::Div, doctokenizerYYlineno, doctokenizerYYsetInsidePre(), g_fileName, handleStyleLeave(), HTML_A, HTML_BLOCKQUOTE, HTML_BOLD, HTML_BR, HTML_CAPTION, HTML_CENTER, HTML_CODE, HTML_DD, HTML_DIV, HTML_DL, HTML_DT, HTML_EMPHASIS, HTML_H1, HTML_H2, HTML_H3, HTML_H4, HTML_H5, HTML_H6, HTML_HR, HTML_IMG, HTML_LI, HTML_OL, HTML_P, HTML_PRE, HTML_SMALL, HTML_SPAN, HTML_SUB, HTML_SUP, HTML_TABLE, HTML_TD, HTML_TH, HTML_TR, HTML_UL, HTML_UNKNOWN, Mappers::htmlTagMapper, insideLI(), insideOL(), insideUL(), DocStyleChange::Italic, CompAccept< DocPara >::m_children, Mapper::map(), DocStyleChange::Preformatted, RetVal_CloseXml, RetVal_EndBlockQuote, RetVal_EndDesc, RetVal_EndList, RetVal_EndTable, RetVal_OK, DocNode::setInsidePreformatted(), DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Subscript, DocStyleChange::Superscript, TK_NEWPARA, warn_doc_error(), XML_C, XML_DESCRIPTION, XML_EXAMPLE, XML_EXCEPTION, XML_INCLUDE, XML_INHERITDOC, XML_ITEM, XML_LIST, XML_LISTHEADER, XML_PARA, XML_PARAM, XML_PARAMREF, XML_PERMISSION, XML_REMARKS, XML_RETURNS, XML_SEE, XML_SEEALSO, XML_SUMMARY, XML_TERM, XML_TYPEPARAM, XML_TYPEPARAMREF, and XML_VALUE.

Referenced by parse().

{
DBG(("handleHtmlEndTag(%s)\n",qPrint(tagName)));
int tagId = Mappers::htmlTagMapper->map(tagName);
int retval=RetVal_OK;
switch (tagId)
{
case HTML_UL:
if (!insideUL(this))
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found </ul> tag without matching <ul>");
}
else
{
}
break;
case HTML_OL:
if (!insideOL(this))
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found </ol> tag without matching <ol>");
}
else
{
}
break;
case HTML_LI:
if (!insideLI(this))
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found </li> tag without matching <li>");
}
else
{
// ignore </li> tags
}
break;
break;
//case HTML_PRE:
// if (!insidePRE(this))
// {
// warn_doc_error(g_fileName,doctokenizerYYlineno,"found </pre> tag without matching <pre>");
// }
// else
// {
// retval=RetVal_EndPre;
// }
// break;
case HTML_BOLD:
break;
case HTML_CODE:
break;
break;
case HTML_DIV:
break;
case HTML_SPAN:
break;
case HTML_SUB:
break;
case HTML_SUP:
break;
break;
case HTML_SMALL:
break;
case HTML_PRE:
break;
case HTML_P:
retval=TK_NEWPARA;
break;
case HTML_DL:
break;
case HTML_DT:
// ignore </dt> tag
break;
case HTML_DD:
// ignore </dd> tag
break;
case HTML_TABLE:
break;
case HTML_TR:
// ignore </tr> tag
break;
case HTML_TD:
// ignore </td> tag
break;
case HTML_TH:
// ignore </th> tag
break;
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </caption> found");
break;
case HTML_BR:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal </br> tag found\n");
break;
case HTML_H1:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h1> found");
break;
case HTML_H2:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h2> found");
break;
case HTML_H3:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h3> found");
break;
case HTML_H4:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h4> found");
break;
case HTML_H5:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h5> found");
break;
case HTML_H6:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h6> found");
break;
case HTML_IMG:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </img> found");
break;
case HTML_HR:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </hr> found");
break;
case HTML_A:
//warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </a> found");
// ignore </a> tag (can be part of <a name=...></a>
break;
case XML_TERM:
//m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,FALSE));
break;
case XML_PARA:
case XML_VALUE:
case XML_PARAM:
case XML_LIST:
case XML_SEE:
retval = RetVal_CloseXml;
break;
case XML_C:
break;
case XML_ITEM:
// These tags are defined in .Net but are currently unsupported
break;
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported xml/html tag </%s> found", qPrint(tagName));
m_children.append(new DocWord(this,"</"+tagName+">"));
break;
default:
// we should not get here!
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end tag %s\n",qPrint(tagName));
ASSERT(0);
break;
}
return retval;
}
int DocPara::handleHtmlHeader ( const HtmlAttribList tagHtmlAttribs,
int  level 
)

Definition at line 5247 of file docparser.cpp.

References CompAccept< DocPara >::m_children, DocHtmlHeader::parse(), RetVal_OK, and TK_NEWPARA.

Referenced by handleHtmlStartTag().

{
DocHtmlHeader *header = new DocHtmlHeader(this,tagHtmlAttribs,level);
m_children.append(header);
int retval = header->parse();
return (retval==RetVal_OK) ? TK_NEWPARA : retval;
}
int DocPara::handleHtmlStartTag ( const QCString &  tagName,
const HtmlAttribList tagHtmlAttribs 
)

Definition at line 5820 of file docparser.cpp.

References DocSimpleSect::appendLinkWord(), TokenInfo::attribs, DocStyleChange::Bold, DocStyleChange::Center, DocStyleChange::Code, Config_getBool, DBG, DocStyleChange::Div, doctokenizerYYlineno, doctokenizerYYsetInsidePre(), doctokenizerYYsetStatePara(), doctokenizerYYsetStateXmlCode(), TokenInfo::emptyTag, DocParamSect::Exception, findAttribute(), g_fileName, g_hasReturnCommand, g_inSeeBlock, g_nodeStack, g_token, g_xmlComment, handleAHref(), handleHtmlHeader(), handleImg(), handleInheritDoc(), handleLinkedWord(), handleParamSection(), handleSimpleSection(), handleStartCode(), handleStyleEnter(), HTML_A, HTML_BLOCKQUOTE, HTML_BOLD, HTML_BR, HTML_CAPTION, HTML_CENTER, HTML_CODE, HTML_DD, HTML_DIV, HTML_DL, HTML_DT, HTML_EMPHASIS, HTML_H1, HTML_H2, HTML_H3, HTML_H4, HTML_H5, HTML_H6, HTML_HR, HTML_IMG, HTML_LI, HTML_OL, HTML_P, HTML_PRE, HTML_SMALL, HTML_SPAN, HTML_SUB, HTML_SUP, HTML_TABLE, HTML_TD, HTML_TH, HTML_TR, HTML_UL, HTML_UNKNOWN, Mappers::htmlTagMapper, insideOL(), insideTable(), insideUL(), DocStyleChange::Italic, DocNode::kind(), DocNode::Kind_SimpleSect, CompAccept< DocPara >::m_children, Mapper::map(), TokenInfo::name, DocHtmlList::Ordered, DocParamSect::Param, DocLink::parse(), DocHtmlDescList::parse(), DocHtmlList::parse(), DocHtmlTable::parse(), DocHtmlBlockQuote::parse(), DocHtmlList::parseXml(), DocHtmlTable::parseXml(), DocStyleChange::Preformatted, DocSimpleSect::Return, RetVal_DescTitle, RetVal_ListItem, RetVal_OK, RetVal_TableCell, RetVal_TableHCell, RetVal_TableRow, DocSimpleSect::See, DocNode::setInsidePreformatted(), DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Subscript, DocStyleChange::Superscript, DocParamSect::TemplateParam, TK_NEWPARA, TK_WORD, HtmlAttribList::toString(), unescapeCRef(), DocHtmlList::Unordered, warn_doc_error(), XML_C, XML_CmdMask, XML_DESCRIPTION, XML_EXAMPLE, XML_EXCEPTION, XML_INCLUDE, XML_INHERITDOC, XML_ITEM, XML_LIST, XML_LISTHEADER, XML_PARA, XML_PARAM, XML_PARAMREF, XML_PERMISSION, XML_REMARKS, XML_RETURNS, XML_SEE, XML_SEEALSO, XML_SUMMARY, XML_TERM, XML_TYPEPARAM, XML_TYPEPARAMREF, and XML_VALUE.

Referenced by parse().

{
DBG(("handleHtmlStartTag(%s,%d)\n",qPrint(tagName),tagHtmlAttribs.count()));
int retval=RetVal_OK;
int tagId = Mappers::htmlTagMapper->map(tagName);
if (g_token->emptyTag && !(tagId&XML_CmdMask) &&
tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"HTML tags may not use the 'empty tag' XHTML syntax.");
}
switch (tagId)
{
case HTML_UL:
{
DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Unordered);
m_children.append(list);
retval=list->parse();
}
break;
case HTML_OL:
{
DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Ordered);
m_children.append(list);
retval=list->parse();
}
break;
case HTML_LI:
if (!insideUL(this) && !insideOL(this))
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"lonely <li> tag found");
}
else
{
}
break;
case HTML_BOLD:
break;
case HTML_CODE:
if (/*getLanguageFromFileName(g_fileName)==SrcLangExt_CSharp ||*/ g_xmlComment)
// for C# source or inside a <summary> or <remark> section we
// treat <code> as an XML tag (so similar to @code)
{
retval = handleStartCode();
}
else // normal HTML markup
{
}
break;
break;
case HTML_DIV:
break;
case HTML_SPAN:
break;
case HTML_SUB:
break;
case HTML_SUP:
break;
break;
case HTML_SMALL:
break;
case HTML_PRE:
break;
case HTML_P:
retval=TK_NEWPARA;
break;
case HTML_DL:
{
DocHtmlDescList *list = new DocHtmlDescList(this,tagHtmlAttribs);
m_children.append(list);
retval=list->parse();
}
break;
case HTML_DT:
retval = RetVal_DescTitle;
break;
case HTML_DD:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag <dd> found");
break;
case HTML_TABLE:
{
DocHtmlTable *table = new DocHtmlTable(this,tagHtmlAttribs);
m_children.append(table);
retval=table->parse();
}
break;
case HTML_TR:
retval = RetVal_TableRow;
break;
case HTML_TD:
retval = RetVal_TableCell;
break;
case HTML_TH:
break;
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag <caption> found");
break;
case HTML_BR:
{
DocLineBreak *lb = new DocLineBreak(this);
m_children.append(lb);
}
break;
case HTML_HR:
{
DocHorRuler *hr = new DocHorRuler(this);
m_children.append(hr);
}
break;
case HTML_A:
retval=handleAHref(this,m_children,tagHtmlAttribs);
break;
case HTML_H1:
retval=handleHtmlHeader(tagHtmlAttribs,1);
break;
case HTML_H2:
retval=handleHtmlHeader(tagHtmlAttribs,2);
break;
case HTML_H3:
retval=handleHtmlHeader(tagHtmlAttribs,3);
break;
case HTML_H4:
retval=handleHtmlHeader(tagHtmlAttribs,4);
break;
case HTML_H5:
retval=handleHtmlHeader(tagHtmlAttribs,5);
break;
case HTML_H6:
retval=handleHtmlHeader(tagHtmlAttribs,6);
break;
case HTML_IMG:
{
handleImg(this,m_children,tagHtmlAttribs);
}
break;
{
DocHtmlBlockQuote *block = new DocHtmlBlockQuote(this,tagHtmlAttribs);
m_children.append(block);
retval = block->parse();
}
break;
// fall through
case XML_VALUE:
case XML_PARA:
if (!m_children.isEmpty())
{
retval = TK_NEWPARA;
}
break;
if (insideTable(this))
{
}
break;
case XML_C:
break;
case XML_PARAM:
{
QCString paramName;
if (findAttribute(tagHtmlAttribs,"name",&paramName))
{
if (paramName.isEmpty())
{
if (Config_getBool(WARN_NO_PARAMDOC))
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"empty 'name' attribute for <param%s> tag.",tagId==XML_PARAM?"":"type");
}
}
else
{
retval = handleParamSection(paramName,
TRUE);
}
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <param%s> tag.",tagId==XML_PARAM?"":"type");
}
}
break;
{
QCString paramName;
if (findAttribute(tagHtmlAttribs,"name",&paramName))
{
//printf("paramName=%s\n",paramName.data());
m_children.append(new DocWord(this,paramName));
if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <param%sref> tag.",tagId==XML_PARAMREF?"":"type");
}
}
break;
{
QCString exceptName;
if (findAttribute(tagHtmlAttribs,"cref",&exceptName))
{
unescapeCRef(exceptName);
retval = handleParamSection(exceptName,DocParamSect::Exception,TRUE);
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <exception> tag.");
}
}
break;
case XML_ITEM:
if (insideTable(this))
{
}
else if (insideUL(this) || insideOL(this))
{
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"lonely <item> tag found");
}
break;
break;
case XML_TERM:
//m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,TRUE));
if (insideTable(this))
{
}
break;
case XML_SEE:
// I'm not sure if <see> is the same as <seealso> or if it
// should you link a member without producing a section. The
// C# specification is extremely vague about this (but what else
// can we expect from Microsoft...)
{
QCString cref;
//printf("XML_SEE: empty tag=%d\n",g_token->emptyTag);
if (findAttribute(tagHtmlAttribs,"cref",&cref))
{
unescapeCRef(cref);
if (g_token->emptyTag) // <see cref="..."/> style
{
bool inSeeBlock = g_inSeeBlock;
g_token->name = cref;
g_inSeeBlock = TRUE;
g_inSeeBlock = inSeeBlock;
}
else // <see cref="...">...</see> style
{
//DocRef *ref = new DocRef(this,cref);
//m_children.append(ref);
//ref->parse();
DocLink *lnk = new DocLink(this,cref);
m_children.append(lnk);
QCString leftOver = lnk->parse(FALSE,TRUE);
if (!leftOver.isEmpty())
{
m_children.append(new DocWord(this,leftOver));
}
}
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <see> tag.");
}
}
break;
{
QCString cref;
if (findAttribute(tagHtmlAttribs,"cref",&cref))
{
unescapeCRef(cref);
// Look for an existing "see" section
QListIterator<DocNode> cli(m_children);
DocNode *n;
for (cli.toFirst();(n=cli.current());++cli)
{
if (n->kind()==Kind_SimpleSect && ((DocSimpleSect *)n)->type()==DocSimpleSect::See)
{
ss = (DocSimpleSect *)n;
}
}
if (!ss) // start new section
{
m_children.append(ss);
}
ss->appendLinkWord(cref);
retval = RetVal_OK;
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <seealso> tag.");
}
}
break;
case XML_LIST:
{
QCString type;
findAttribute(tagHtmlAttribs,"type",&type);
HtmlAttribList emptyList;
if (type=="number")
{
}
if (type=="table")
{
DocHtmlTable *table = new DocHtmlTable(this,emptyList);
m_children.append(table);
retval=table->parseXml();
}
else
{
DocHtmlList *list = new DocHtmlList(this,emptyList,listType);
m_children.append(list);
retval=list->parseXml();
}
}
break;
// These tags are defined in .Net but are currently unsupported
break;
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported xml/html tag <%s> found", qPrint(tagName));
m_children.append(new DocWord(this, "<"+tagName+tagHtmlAttribs.toString()+">"));
break;
break;
default:
// we should not get here!
ASSERT(0);
break;
}
return retval;
}
void DocPara::handleImage ( const QCString &  cmdName)

Definition at line 5014 of file docparser.cpp.

References DocImage::DocBook, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateFile(), doctokenizerYYsetStatePara(), findAndCopyImage(), g_fileName, g_token, DocImage::Html, DocImage::Latex, CompAccept< DocPara >::m_children, TokenInfo::name, DocImage::parse(), DocImage::Rtf, TK_LNKWORD, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
if (tok!=TK_WORD && tok!=TK_LNKWORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
QCString imgType = g_token->name.lower();
if (imgType=="html") t=DocImage::Html;
else if (imgType=="latex") t=DocImage::Latex;
else if (imgType=="docbook") t=DocImage::DocBook;
else if (imgType=="rtf") t=DocImage::Rtf;
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"image type %s specified as the first argument of "
"%s is not valid",
qPrint(imgType),qPrint(cmdName));
return;
}
if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
HtmlAttribList attrList;
DocImage *img = new DocImage(this,attrList,findAndCopyImage(g_token->name,t),t);
m_children.append(img);
img->parse();
}
void DocPara::handleInclude ( const QCString &  cmdName,
DocInclude::Type  t 
)

Definition at line 5150 of file docparser.cpp.

References DBG, docParserPopContext(), docParserPushContext(), doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateFile(), doctokenizerYYsetStatePara(), doctokenizerYYsetStateSnippet(), extractBlock(), g_context, g_exampleName, g_fileName, g_isExample, g_token, DocInclude::IncludeDoc, internalValidatingParseDoc(), lineBlock(), CompAccept< DocPara >::m_children, TokenInfo::name, DocInclude::parse(), readTextFileByName(), DocInclude::Snippet, DocInclude::SnippetDoc, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
DBG(("handleInclude(%s)\n",qPrint(cmdName)));
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
if (tok==0)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
"argument of command %s",qPrint(cmdName));
return;
}
else if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
QCString fileName = g_token->name;
QCString blockId;
{
if (fileName == "this") fileName=g_fileName;
if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected block identifier, but found token %s instead while parsing the %s command",
tokToString(tok),qPrint(cmdName));
return;
}
blockId = "["+g_token->name+"]";
}
// This is the only place to handle the \includedoc and \snippetdoc commands,
// as the content is included here as if it is really here.
{
QCString inc_text;
int inc_line = 1;
readTextFileByName(fileName,inc_text);
{
inc_line = lineBlock(inc_text, blockId);
inc_text = extractBlock(inc_text, blockId);
}
g_fileName = fileName;
}
else
{
DocInclude *inc = new DocInclude(this,fileName,g_context,t,g_isExample,g_exampleName,blockId);
m_children.append(inc);
inc->parse();
}
}
void DocPara::handleIncludeOperator ( const QCString &  cmdName,
DocIncOperator::Type  t 
)

Definition at line 4961 of file docparser.cpp.

References DBG, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStatePara(), doctokenizerYYsetStatePattern(), g_context, g_exampleName, g_fileName, g_isExample, g_token, isFirst(), DocNode::kind(), DocNode::Kind_IncOperator, DocNode::Kind_WhiteSpace, CompAccept< DocPara >::m_children, DocIncOperator::markFirst(), DocIncOperator::markLast(), TokenInfo::name, DocIncOperator::parse(), TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
DBG(("handleIncludeOperator(%s)\n",qPrint(cmdName)));
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
if (tok==0)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
"argument of command %s", qPrint(cmdName));
return;
}
else if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
QListIterator<DocNode> it(m_children);
DocNode *n1 = it.toLast();
--it;
DocNode *n2 = n1!=0 ? it.current() : 0;
bool isFirst = n1==0 || // no last node
) || // last node is not operator or whitespace
); // previous not is not operator
op->markFirst(isFirst);
op->markLast(TRUE);
if (n1!=0 && n1->kind()==DocNode::Kind_IncOperator)
{
((DocIncOperator *)n1)->markLast(FALSE);
}
else if (n1!=0 && n1->kind()==DocNode::Kind_WhiteSpace &&
)
{
((DocIncOperator *)n2)->markLast(FALSE);
}
m_children.append(op);
op->parse();
}
void DocPara::handleInheritDoc ( )

Definition at line 5289 of file docparser.cpp.

References MemberDef::briefDescription(), docParserPopContext(), docParserPushContext(), MemberDef::documentation(), g_context, g_copyStack, g_memberDef, g_nodeStack, g_styleStack, Definition::getOuterScope(), Doxygen::globalScope, internalValidatingParseDoc(), CompAccept< DocPara >::m_children, Definition::name(), and MemberDef::reimplements().

Referenced by handleCommand(), and handleHtmlStartTag().

{
if (g_memberDef) // inheriting docs from a member
{
if (reMd) // member from which was inherited.
{
//printf("{InheritDocs:%s=>%s}\n",g_memberDef->qualifiedName().data(),reMd->qualifiedName().data());
{
}
g_styleStack.clear();
g_nodeStack.clear();
g_copyStack.append(reMd);
g_copyStack.remove(reMd);
g_memberDef = thisMd;
}
}
}
void DocPara::handleLink ( const QCString &  cmdName,
bool  isJavaLink 
)

Definition at line 5097 of file docparser.cpp.

References doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateLink(), doctokenizerYYsetStatePara(), g_fileName, g_token, CompAccept< DocPara >::m_children, TokenInfo::name, DocLink::parse(), TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"%s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
DocLink *lnk = new DocLink(this,g_token->name);
m_children.append(lnk);
QCString leftOver = lnk->parse(isJavaLink);
if (!leftOver.isEmpty())
{
m_children.append(new DocWord(this,leftOver));
}
}
int DocPara::handleParamSection ( const QCString &  cmdName,
DocParamSect::Type  t,
bool  xmlContext = FALSE,
int  direction = DocParamSect::Unspecified 
)

Definition at line 4885 of file docparser.cpp.

References DocNode::Kind_ParamSect, CompAccept< DocPara >::m_children, DocParamSect::parse(), RetVal_OK, and TK_NEWPARA.

Referenced by handleCommand(), and handleHtmlStartTag().

{
DocParamSect *ps=0;
if (!m_children.isEmpty() && // previous element
m_children.getLast()->kind()==Kind_ParamSect && // was a param sect
((DocParamSect *)m_children.getLast())->type()==t) // of same type
{
// append to previous section
ps=(DocParamSect *)m_children.getLast();
}
else // start new section
{
ps=new DocParamSect(this,t);
m_children.append(ps);
}
int rv=ps->parse(cmdName,xmlContext,(DocParamSect::Direction)direction);
return (rv!=TK_NEWPARA) ? rv : RetVal_OK;
}
void DocPara::handleRef ( const QCString &  cmdName)

Definition at line 5124 of file docparser.cpp.

References DBG, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStatePara(), doctokenizerYYsetStateRef(), g_context, g_fileName, g_token, CompAccept< DocPara >::m_children, TokenInfo::name, DocRef::parse(), TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
DBG(("handleRef(%s)\n",qPrint(cmdName)));
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
tok=doctokenizerYYlex(); // get the reference id
DocRef *ref=0;
if (tok!=TK_WORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
goto endref;
}
ref = new DocRef(this,g_token->name,g_context);
m_children.append(ref);
ref->parse();
endref:
}
void DocPara::handleSection ( const QCString &  cmdName)

Definition at line 5218 of file docparser.cpp.

References doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStatePara(), doctokenizerYYsetStateSkipTitle(), g_fileName, g_token, TokenInfo::name, TokenInfo::sectionId, TK_LNKWORD, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by handleCommand().

{
// get the argument of the section command.
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return;
}
if (tok==0)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
"argument of command %s\n", qPrint(cmdName));
return;
}
else if (tok!=TK_WORD && tok!=TK_LNKWORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(cmdName));
return;
}
}
int DocPara::handleSimpleSection ( DocSimpleSect::Type  t,
bool  xmlContext = FALSE 
)

Definition at line 4855 of file docparser.cpp.

References DocNode::Kind_SimpleSect, CompAccept< DocPara >::m_children, DocSimpleSect::parse(), DocSimpleSect::parseXml(), RetVal_OK, TK_NEWPARA, and DocSimpleSect::User.

Referenced by handleCommand(), and handleHtmlStartTag().

{
bool needsSeparator = FALSE;
if (!m_children.isEmpty() && // previous element
m_children.getLast()->kind()==Kind_SimpleSect && // was a simple sect
((DocSimpleSect *)m_children.getLast())->type()==t && // of same type
t!=DocSimpleSect::User) // but not user defined
{
// append to previous section
ss=(DocSimpleSect *)m_children.getLast();
needsSeparator = TRUE;
}
else // start new section
{
ss=new DocSimpleSect(this,t);
m_children.append(ss);
}
int rv = RetVal_OK;
if (xmlContext)
{
return ss->parseXml();
}
else
{
rv = ss->parse(t==DocSimpleSect::User,needsSeparator);
}
return (rv!=TK_NEWPARA) ? rv : RetVal_OK;
}
int DocPara::handleStartCode ( )

Definition at line 5264 of file docparser.cpp.

References DocVerbatim::Code, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStatePara(), g_context, g_exampleName, g_fileName, g_isExample, g_token, g_xmlComment, CompAccept< DocPara >::m_children, TokenInfo::name, stripIndentation(), substitute(), TokenInfo::verb, and warn_doc_error().

Referenced by handleCommand(), and handleHtmlStartTag().

{
int retval = doctokenizerYYlex();
QCString lang = g_token->name;
if (!lang.isEmpty() && lang.at(0)!='.')
{
lang="."+lang;
}
{
g_token->verb = substitute(substitute(g_token->verb,"&lt;","<"),"&gt;",">");
}
// search for the first non-whitespace line, index is stored in li
int i=0,li=0,l=g_token->verb.length();
while (i<l && (g_token->verb.at(i)==' ' || g_token->verb.at(i)=='\n'))
{
if (g_token->verb.at(i)=='\n') li=i+1;
i++;
}
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"code section ended without end marker");
return retval;
}
void DocPara::handleVhdlFlow ( )

Definition at line 5090 of file docparser.cpp.

References CompAccept< DocPara >::m_children, and DocVhdlFlow::parse().

Referenced by handleCommand().

{
DocVhdlFlow *vf = new DocVhdlFlow(this);
m_children.append(vf);
vf->parse();
}
int DocPara::handleXRefItem ( )
bool DocPara::injectToken ( int  tok,
const QCString &  tokText 
)

Definition at line 5258 of file docparser.cpp.

References defaultHandleToken(), g_token, CompAccept< DocPara >::m_children, and TokenInfo::name.

Referenced by DocSimpleSect::appendLinkWord().

{
g_token->name = tokText;
return defaultHandleToken(this,tok,m_children);
}
bool DocPara::isEmpty ( ) const
inline
bool DocPara::isFirst ( ) const
inline

Definition at line 1124 of file docparser.h.

References m_isFirst.

Referenced by handleIncludeOperator().

{ return m_isFirst; }
bool DocPara::isLast ( ) const
inline

Definition at line 1125 of file docparser.h.

References m_isLast.

Referenced by ManDocVisitor::visitPost(), RTFDocVisitor::visitPost(), and LatexDocVisitor::visitPost().

{ return m_isLast; }
Kind DocPara::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 1119 of file docparser.h.

References DocNode::Kind_Para.

Referenced by parse().

{ return Kind_Para; }
void DocPara::markFirst ( bool  v = TRUE)
inline
void DocPara::markLast ( bool  v = TRUE)
inline
int DocPara::parse ( )

Definition at line 6389 of file docparser.cpp.

References TokenInfo::attribs, TokenInfo::chars, CMD_LI, Mappers::cmdMapper, DBG, DocSymbol::decodeSymbol(), doctokenizerYYlex(), doctokenizerYYlineno, TokenInfo::endTag, g_fileName, g_nodeStack, g_token, handleCommand(), handleHtmlEndTag(), handleHtmlStartTag(), handleInitialStyleCommands(), handleLinkedWord(), handlePendingStyleCommands(), TokenInfo::indent, DocAutoList::indent(), insidePRE(), INTERNAL_ASSERT, TokenInfo::isEMailAddr, TokenInfo::isEnumList, DocNode::kind(), kind(), DocNode::Kind_AutoList, DocNode::Kind_AutoListItem, DocNode::Kind_HtmlBlockQuote, DocNode::Kind_HtmlDescList, DocNode::Kind_HtmlHeader, DocNode::Kind_HtmlList, DocNode::Kind_HtmlTable, DocNode::Kind_ParamSect, DocNode::Kind_SimpleList, DocNode::Kind_SimpleListItem, DocNode::Kind_SimpleSect, DocNode::Kind_XRefItem, CompAccept< DocPara >::m_children, Mapper::map(), TokenInfo::name, DocNode::parent(), DocAutoList::parse(), DocSimpleSect::parseRcs(), DocSimpleSect::Rcs, RetVal_ListItem, RetVal_OK, RetVal_SimpleSec, SIMPLESECT_BIT, TokenInfo::simpleSectName, TokenInfo::simpleSectText, DocSymbol::Sym_Unknown, TokenInfo::text, TK_COMMAND, TK_ENDLIST, TK_HTMLTAG, TK_LISTITEM, TK_LNKWORD, TK_NEWPARA, TK_RCSTAG, TK_SYMBOL, TK_URL, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by internalValidatingParseDoc(), DocAutoListItem::parse(), DocSection::parse(), DocInternal::parse(), DocParBlock::parse(), DocSimpleSect::parse(), DocParamList::parse(), DocSimpleListItem::parse(), DocHtmlListItem::parse(), DocHtmlDescData::parse(), DocHtmlCell::parse(), DocHtmlBlockQuote::parse(), DocRoot::parse(), DocSimpleSect::parseXml(), DocParamList::parseXml(), DocHtmlListItem::parseXml(), and DocHtmlCell::parseXml().

{
DBG(("DocPara::parse() start\n"));
g_nodeStack.push(this);
// handle style commands "inherited" from the previous paragraph
int tok;
int retval=0;
while ((tok=doctokenizerYYlex())) // get the next token
{
reparsetoken:
DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno));
if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL ||
tok==TK_COMMAND || tok==TK_HTMLTAG
)
{
DBG((" name=%s",qPrint(g_token->name)));
}
DBG(("\n"));
switch(tok)
{
case TK_WORD:
m_children.append(new DocWord(this,g_token->name));
break;
case TK_LNKWORD:
break;
case TK_URL:
break;
{
// prevent leading whitespace and collapse multiple whitespace areas
if (insidePRE(this) || // all whitespace is relevant
(
// remove leading whitespace
!m_children.isEmpty() &&
// and whitespace after certain constructs
(k=m_children.getLast()->kind())!=DocNode::Kind_HtmlDescList &&
/*k!=DocNode::Kind_Verbatim &&*/
)
)
{
m_children.append(new DocWhiteSpace(this,g_token->chars));
}
}
break;
{
DBG(("found list item at %d parent=%d\n",g_token->indent,parent()->kind()));
while (n && n->kind()!=DocNode::Kind_AutoList) n=n->parent();
if (n) // we found an auto list up in the hierarchy
{
DBG(("previous list item at %d\n",al->indent()));
if (al->indent()>=g_token->indent)
// new item at the same or lower indent level
{
retval=TK_LISTITEM;
goto endparagraph;
}
}
// determine list depth
int depth = 0;
n=parent();
while(n)
{
if (n->kind() == DocNode::Kind_AutoList &&
((DocAutoList*)n)->isEnumList()) depth++;
n=n->parent();
}
// first item or sub list => create new list
DocAutoList *al=0;
do
{
al = new DocAutoList(this,g_token->indent,
m_children.append(al);
retval = al->parse();
} while (retval==TK_LISTITEM && // new list
al->indent()==g_token->indent // at same indent level
);
// check the return value
if (retval==RetVal_SimpleSec) // auto list ended due to simple section command
{
// Reparse the token that ended the section at this level,
// so a new simple section will be started at this level.
// This is the same as unputting the last read token and continuing.
if (g_token->name.left(4)=="rcs:") // RCS section
{
g_token->name = g_token->name.mid(4);
tok = TK_RCSTAG;
}
else // other section
{
tok = TK_COMMAND;
}
DBG(("reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
}
else if (retval==TK_ENDLIST)
{
if (al->indent()>g_token->indent) // end list
{
goto endparagraph;
}
else // continue with current paragraph
{
}
}
else // paragraph ended due to TK_NEWPARA, TK_LISTITEM, or EOF
{
goto endparagraph;
}
}
break;
case TK_ENDLIST:
DBG(("Found end of list inside of paragraph at line %d\n",doctokenizerYYlineno));
{
if (al->indent()>=g_token->indent)
{
// end of list marker ends this paragraph
retval=TK_ENDLIST;
goto endparagraph;
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"End of list marker found "
"has invalid indent level");
}
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"End of list marker found without any preceding "
"list items");
}
break;
case TK_COMMAND:
{
// see if we have to start a simple section
while (n &&
)
{
n=n->parent();
}
if (cmd&SIMPLESECT_BIT)
{
if (n) // already in a simple section
{
// simple section cannot start in this paragraph, need
// to unwind the stack and remember the command.
goto endparagraph;
}
}
// see if we are in a simple list
n=parent();
while (n && n->kind()!=DocNode::Kind_SimpleListItem) n=n->parent();
if (n)
{
if (cmd==CMD_LI)
{
goto endparagraph;
}
}
// handle the command
DBG(("handleCommand returns %x\n",retval));
// check the return value
if (retval==RetVal_SimpleSec)
{
// Reparse the token that ended the section at this level,
// so a new simple section will be started at this level.
// This is the same as unputting the last read token and continuing.
if (g_token->name.left(4)=="rcs:") // RCS section
{
g_token->name = g_token->name.mid(4);
tok = TK_RCSTAG;
}
else // other section
{
tok = TK_COMMAND;
}
DBG(("reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
}
else if (retval==RetVal_OK)
{
// the command ended normally, keep scanning for new tokens.
retval = 0;
}
else if (retval>0 && retval<RetVal_OK)
{
// the command ended with a new command, reparse this token
tok = retval;
goto reparsetoken;
}
else // end of file, end of paragraph, start or end of section
// or some auto list marker
{
goto endparagraph;
}
}
break;
case TK_HTMLTAG:
{
if (!g_token->endTag) // found a start tag
{
}
else // found an end tag
{
}
if (retval==RetVal_OK)
{
// the command ended normally, keep scanner for new tokens.
retval = 0;
}
else
{
goto endparagraph;
}
}
break;
case TK_SYMBOL:
{
{
m_children.append(new DocSymbol(this,s));
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
qPrint(g_token->name));
}
break;
}
case TK_NEWPARA:
retval=TK_NEWPARA;
goto endparagraph;
case TK_RCSTAG:
{
while (n &&
)
{
n=n->parent();
}
if (n) // already in a simple section
{
// simple section cannot start in this paragraph, need
// to unwind the stack and remember the command.
goto endparagraph;
}
// see if we are in a simple list
m_children.append(ss);
ss->parseRcs();
}
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,
"Found unexpected token (id=%x)\n",tok);
break;
}
}
retval=0;
endparagraph:
DocNode *n = g_nodeStack.pop();
ASSERT(n==this);
DBG(("DocPara::parse() end retval=%x\n",retval));
INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM ||
retval==TK_ENDLIST || retval>RetVal_OK
);
return retval;
}

Member Data Documentation

bool DocPara::m_isFirst
private

Definition at line 1152 of file docparser.h.

Referenced by isFirst(), and markFirst().

bool DocPara::m_isLast
private

Definition at line 1153 of file docparser.h.

Referenced by isLast(), and markLast().

QCString DocPara::m_sectionId
private

Definition at line 1151 of file docparser.h.


The documentation for this class was generated from the following files: