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.

1116  :
DocNode * parent() const
Definition: docparser.h:147
bool m_isFirst
Definition: docparser.h:1152
const bool FALSE
Definition: qglobal.h:370
DocNode * m_parent
Definition: docparser.h:163
bool m_isLast
Definition: docparser.h:1153

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.

1121 { CompAccept<DocPara>::accept(this,v); }
void accept(T *obj, DocVisitor *v)
Definition: docparser.h:177
void DocPara::handleCite ( )

Definition at line 4892 of file docparser.cpp.

4893 {
4894  // get the argument of the cite command.
4895  int tok=doctokenizerYYlex();
4896  if (tok!=TK_WHITESPACE)
4897  {
4898  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
4899  qPrint("cite"));
4900  return;
4901  }
4903  tok=doctokenizerYYlex();
4904  if (tok==0)
4905  {
4906  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
4907  "argument of command %s\n", qPrint("cite"));
4908  return;
4909  }
4910  else if (tok!=TK_WORD && tok!=TK_LNKWORD)
4911  {
4912  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
4913  tokToString(tok),qPrint("cite"));
4914  return;
4915  }
4917  DocCite *cite = new DocCite(this,g_token->name,g_context);
4918  m_children.append(cite);
4919  //cite->parse();
4920 
4922 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
void append(const type *d)
Definition: qlist.h:73
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString sectionId
Definition: doctokenizer.h:89
void doctokenizerYYsetStateCite()
TokenInfo * g_token
int doctokenizerYYlex(void)
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
int DocPara::handleCommand ( const QCString cmdName)

Definition at line 5282 of file docparser.cpp.

5283 {
5284  DBG(("handleCommand(%s)\n",qPrint(cmdName)));
5285  int retval = RetVal_OK;
5286  int cmdId = Mappers::cmdMapper->map(cmdName);
5287  switch (cmdId)
5288  {
5289  case CMD_UNKNOWN:
5290  warn_doc_error(g_fileName,doctokenizerYYlineno,"Found unknown command `\\%s'",qPrint(cmdName));
5291  break;
5292  case CMD_EMPHASIS:
5294  retval=handleStyleArgument(this,m_children,cmdName);
5296  if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
5297  break;
5298  case CMD_BOLD:
5300  retval=handleStyleArgument(this,m_children,cmdName);
5302  if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
5303  break;
5304  case CMD_CODE:
5306  retval=handleStyleArgument(this,m_children,cmdName);
5308  if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
5309  break;
5310  case CMD_BSLASH:
5312  break;
5313  case CMD_AT:
5315  break;
5316  case CMD_LESS:
5318  break;
5319  case CMD_GREATER:
5321  break;
5322  case CMD_AMP:
5324  break;
5325  case CMD_DOLLAR:
5327  break;
5328  case CMD_HASH:
5330  break;
5331  case CMD_PIPE:
5333  break;
5334  case CMD_DCOLON:
5336  break;
5337  case CMD_PERCENT:
5339  break;
5340  case CMD_NDASH:
5343  break;
5344  case CMD_MDASH:
5348  break;
5349  case CMD_QUOTE:
5351  break;
5352  case CMD_PUNT:
5354  break;
5355  case CMD_PLUS:
5357  break;
5358  case CMD_MINUS:
5360  break;
5361  case CMD_SA:
5365  break;
5366  case CMD_RETURN:
5369  break;
5370  case CMD_AUTHOR:
5372  break;
5373  case CMD_AUTHORS:
5375  break;
5376  case CMD_VERSION:
5378  break;
5379  case CMD_SINCE:
5381  break;
5382  case CMD_DATE:
5384  break;
5385  case CMD_NOTE:
5387  break;
5388  case CMD_WARNING:
5390  break;
5391  case CMD_PRE:
5393  break;
5394  case CMD_POST:
5396  break;
5397  case CMD_COPYRIGHT:
5399  break;
5400  case CMD_INVARIANT:
5402  break;
5403  case CMD_REMARK:
5405  break;
5406  case CMD_ATTENTION:
5408  break;
5409  case CMD_PAR:
5411  break;
5412  case CMD_LI:
5413  {
5414  DocSimpleList *sl=new DocSimpleList(this);
5415  m_children.append(sl);
5416  retval = sl->parse();
5417  }
5418  break;
5419  case CMD_SECTION:
5420  {
5421  handleSection(cmdName);
5422  retval = RetVal_Section;
5423  }
5424  break;
5425  case CMD_SUBSECTION:
5426  {
5427  handleSection(cmdName);
5428  retval = RetVal_Subsection;
5429  }
5430  break;
5431  case CMD_SUBSUBSECTION:
5432  {
5433  handleSection(cmdName);
5434  retval = RetVal_Subsubsection;
5435  }
5436  break;
5437  case CMD_PARAGRAPH:
5438  {
5439  handleSection(cmdName);
5440  retval = RetVal_Paragraph;
5441  }
5442  break;
5443  case CMD_STARTCODE:
5444  {
5446  retval = handleStartCode();
5447  }
5448  break;
5449  case CMD_HTMLONLY:
5450  {
5452  retval = doctokenizerYYlex();
5454  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"htmlonly section ended without end marker");
5456  }
5457  break;
5458  case CMD_MANONLY:
5459  {
5461  retval = doctokenizerYYlex();
5463  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"manonly section ended without end marker");
5465  }
5466  break;
5467  case CMD_RTFONLY:
5468  {
5470  retval = doctokenizerYYlex();
5472  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"rtfonly section ended without end marker");
5474  }
5475  break;
5476  case CMD_LATEXONLY:
5477  {
5479  retval = doctokenizerYYlex();
5481  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"latexonly section ended without end marker");
5483  }
5484  break;
5485  case CMD_XMLONLY:
5486  {
5488  retval = doctokenizerYYlex();
5490  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"xmlonly section ended without end marker");
5492  }
5493  break;
5494  case CMD_DBONLY:
5495  {
5497  retval = doctokenizerYYlex();
5499  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker",doctokenizerYYlineno);
5501  }
5502  break;
5503  case CMD_VERBATIM:
5504  {
5506  retval = doctokenizerYYlex();
5508  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"verbatim section ended without end marker");
5510  }
5511  break;
5512  case CMD_DOT:
5513  {
5516  QCString width,height;
5517  defaultHandleTitleAndSize(CMD_DOT,dv,dv->children(),width,height);
5519  retval = doctokenizerYYlex();
5520  dv->setText(g_token->verb);
5521  dv->setWidth(width);
5522  dv->setHeight(height);
5523  m_children.append(dv);
5524  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"dot section ended without end marker");
5526  }
5527  break;
5528  case CMD_MSC:
5529  {
5532  QCString width,height;
5533  defaultHandleTitleAndSize(CMD_MSC,dv,dv->children(),width,height);
5535  retval = doctokenizerYYlex();
5536  dv->setText(g_token->verb);
5537  dv->setWidth(width);
5538  dv->setHeight(height);
5539  m_children.append(dv);
5540  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"msc section ended without end marker");
5542  }
5543  break;
5544  case CMD_STARTUML:
5545  {
5546  static QCString jarPath = Config_getString("PLANTUML_JAR_PATH");
5548  retval = doctokenizerYYlex();
5549  QCString plantFile(g_token->sectionId);
5552  QCString width,height;
5553  defaultHandleTitleAndSize(CMD_STARTUML,dv,dv->children(),width,height);
5555  retval = doctokenizerYYlex();
5556  dv->setText(g_token->verb);
5557  dv->setWidth(width);
5558  dv->setHeight(height);
5559  if (jarPath.isEmpty())
5560  {
5561  warn_doc_error(g_fileName,doctokenizerYYlineno,"ignoring \\startuml command because PLANTUML_JAR_PATH is not set");
5562  delete dv;
5563  }
5564  else
5565  {
5566  m_children.append(dv);
5567  }
5568  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"startuml section ended without end marker");
5570  }
5571  break;
5572  case CMD_ENDPARBLOCK:
5573  retval=RetVal_EndParBlock;
5574  break;
5575  case CMD_ENDCODE:
5576  case CMD_ENDHTMLONLY:
5577  case CMD_ENDMANONLY:
5578  case CMD_ENDRTFONLY:
5579  case CMD_ENDLATEXONLY:
5580  case CMD_ENDXMLONLY:
5581  case CMD_ENDDBONLY:
5582  case CMD_ENDLINK:
5583  case CMD_ENDVERBATIM:
5584  case CMD_ENDDOT:
5585  case CMD_ENDMSC:
5586  case CMD_ENDUML:
5587  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
5588  break;
5589  case CMD_PARAM:
5591  break;
5592  case CMD_TPARAM:
5594  break;
5595  case CMD_RETVAL:
5596  retval = handleParamSection(cmdName,DocParamSect::RetVal);
5597  break;
5598  case CMD_EXCEPTION:
5599  retval = handleParamSection(cmdName,DocParamSect::Exception);
5600  break;
5601  case CMD_XREFITEM:
5602  retval = handleXRefItem();
5603  break;
5604  case CMD_LINEBREAK:
5605  {
5606  DocLineBreak *lb = new DocLineBreak(this);
5607  m_children.append(lb);
5608  }
5609  break;
5610  case CMD_ANCHOR:
5611  {
5612  DocAnchor *anchor = handleAnchor(this);
5613  if (anchor)
5614  {
5615  m_children.append(anchor);
5616  }
5617  }
5618  break;
5619  case CMD_ADDINDEX:
5620  {
5621  DocIndexEntry *ie = new DocIndexEntry(this,
5623  g_memberDef);
5624  m_children.append(ie);
5625  retval = ie->parse();
5626  }
5627  break;
5628  case CMD_INTERNAL:
5629  retval = RetVal_Internal;
5630  break;
5631  case CMD_ENDINTERNAL:
5632  retval = RetVal_EndInternal;
5633  break;
5634  case CMD_PARBLOCK:
5635  {
5636  DocParBlock *block = new DocParBlock(this);
5637  m_children.append(block);
5638  retval = block->parse();
5639  }
5640  break;
5641  case CMD_COPYDOC: // fall through
5642  case CMD_COPYBRIEF: // fall through
5643  case CMD_COPYDETAILS:
5644  //retval = RetVal_CopyDoc;
5645  // these commands should already be resolved by processCopyDoc()
5646  break;
5647  case CMD_INCLUDE:
5649  break;
5650  case CMD_INCWITHLINES:
5652  break;
5653  case CMD_DONTINCLUDE:
5655  break;
5656  case CMD_HTMLINCLUDE:
5658  break;
5659  case CMD_LATEXINCLUDE:
5661  break;
5662  case CMD_VERBINCLUDE:
5664  break;
5665  case CMD_SNIPPET:
5667  break;
5668  case CMD_SKIP:
5670  break;
5671  case CMD_UNTIL:
5673  break;
5674  case CMD_SKIPLINE:
5676  break;
5677  case CMD_LINE:
5679  break;
5680  case CMD_IMAGE:
5681  handleImage(cmdName);
5682  break;
5683  case CMD_DOTFILE:
5684  handleFile<DocDotFile>(cmdName);
5685  break;
5686  case CMD_VHDLFLOW:
5687  handleVhdlFlow();
5688  break;
5689  case CMD_MSCFILE:
5690  handleFile<DocMscFile>(cmdName);
5691  break;
5692  case CMD_DIAFILE:
5693  handleFile<DocDiaFile>(cmdName);
5694  break;
5695  case CMD_LINK:
5696  handleLink(cmdName,FALSE);
5697  break;
5698  case CMD_JAVALINK:
5699  handleLink(cmdName,TRUE);
5700  break;
5701  case CMD_CITE:
5702  handleCite();
5703  break;
5704  case CMD_REF: // fall through
5705  case CMD_SUBPAGE:
5706  handleRef(cmdName);
5707  break;
5708  case CMD_SECREFLIST:
5709  {
5710  DocSecRefList *list = new DocSecRefList(this);
5711  m_children.append(list);
5712  list->parse();
5713  }
5714  break;
5715  case CMD_SECREFITEM:
5716  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
5717  break;
5718  case CMD_ENDSECREFLIST:
5719  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
5720  break;
5721  case CMD_FORMULA:
5722  {
5723  DocFormula *form=new DocFormula(this,g_token->id);
5724  m_children.append(form);
5725  }
5726  break;
5727  //case CMD_LANGSWITCH:
5728  // retval = handleLanguageSwitch();
5729  // break;
5730  case CMD_INTERNALREF:
5731  //warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name));
5732  {
5733  DocInternalRef *ref = handleInternalRef(this);
5734  if (ref)
5735  {
5736  m_children.append(ref);
5737  ref->parse();
5738  }
5740  }
5741  break;
5742  case CMD_INHERITDOC:
5743  handleInheritDoc();
5744  break;
5745  default:
5746  // we should not get here!
5747  ASSERT(0);
5748  break;
5749  }
5750  INTERNAL_ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec ||
5751  retval==TK_LISTITEM || retval==TK_ENDLIST || retval==TK_NEWPARA ||
5752  retval==RetVal_Section || retval==RetVal_EndList ||
5753  retval==RetVal_Internal || retval==RetVal_SwitchLang ||
5754  retval==RetVal_EndInternal
5755  );
5756  DBG(("handleCommand(%s) end retval=%x\n",qPrint(cmdName),retval));
5757  return retval;
5758 }
void doctokenizerYYsetStateMsc()
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYsetStatePlantUML()
QList< DocNode > m_children
Definition: docparser.h:189
void handleIncludeOperator(const QCString &cmdName, DocIncOperator::Type t)
Definition: docparser.cpp:4946
void doctokenizerYYsetStatePara()
static bool g_isExample
Definition: docparser.cpp:102
int handleParamSection(const QCString &cmdName, DocParamSect::Type t, bool xmlContext, int direction)
Definition: docparser.cpp:4870
void handleInclude(const QCString &cmdName, DocInclude::Type t)
Definition: docparser.cpp:5136
void doctokenizerYYsetStatePlantUMLOpt()
bool isEmpty() const
Definition: qcstring.h:189
void doctokenizerYYsetStateXmlOnly()
static Definition * g_scope
Definition: docparser.cpp:86
void handleCite()
Definition: docparser.cpp:4892
void append(const type *d)
Definition: qlist.h:73
void handleInheritDoc()
Definition: docparser.cpp:5253
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void handleLink(const QCString &cmdName, bool isJavaLink)
Definition: docparser.cpp:5082
ParamDir paramDir
Definition: doctokenizer.h:114
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString sectionId
Definition: doctokenizer.h:89
void doctokenizerYYsetStateCode()
static bool g_hasReturnCommand
Definition: docparser.cpp:99
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
void doctokenizerYYsetStateRtfOnly()
void handleSection(const QCString &cmdName)
Definition: docparser.cpp:5182
TokenInfo * g_token
int doctokenizerYYlex(void)
void setText(const QCString &t)
Definition: docparser.h:463
static NamespaceDef * globalScope
Definition: doxygen.h:128
void doctokenizerYYsetStateVerbatim()
void setWidth(const QCString &w)
Definition: docparser.h:464
void doctokenizerYYsetStateManOnly()
void setHeight(const QCString &h)
Definition: docparser.h:465
uint count() const
Definition: qstack.h:56
static int handleStyleArgument(DocNode *parent, QList< DocNode > &children, const QCString &cmdName)
Definition: docparser.cpp:848
int handleStartCode()
Definition: docparser.cpp:5228
static DocAnchor * handleAnchor(DocNode *parent)
Definition: docparser.cpp:1218
static MemberDef * g_memberDef
Definition: docparser.cpp:101
#define INTERNAL_ASSERT(x)
Definition: docparser.cpp:68
const QList< DocNode > & children() const
Definition: docparser.h:461
void doctokenizerYYsetStateHtmlOnly()
#define Config_getString(val)
Definition: config.cpp:660
static DocInternalRef * handleInternalRef(DocNode *parent)
Definition: docparser.cpp:1196
int map(const char *n)
Definition: cmdmapper.cpp:225
int handleXRefItem()
Definition: docparser.cpp:4924
QCString verb
Definition: doctokenizer.h:96
static Mapper * cmdMapper
Definition: cmdmapper.h:219
QCString name
Definition: doctokenizer.h:77
int handleSimpleSection(DocSimpleSect::Type t, bool xmlContext=FALSE)
Definition: docparser.cpp:4840
static QCString g_context
Definition: docparser.cpp:87
void handleImage(const QCString &cmdName)
Definition: docparser.cpp:4999
static void defaultHandleTitleAndSize(const int cmd, DocNode *parent, QList< DocNode > &children, QCString &width, QCString &height)
Definition: docparser.cpp:1255
static QCString g_exampleName
Definition: docparser.cpp:103
void handleVhdlFlow()
Definition: docparser.cpp:5075
void doctokenizerYYsetStateDbOnly()
void handleRef(const QCString &cmdName)
Definition: docparser.cpp:5109
static bool g_inSeeBlock
Definition: docparser.cpp:88
void doctokenizerYYsetStateLatexOnly()
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
void doctokenizerYYsetStateDot()
#define ASSERT(x)
Definition: qglobal.h:590
template<class T >
void DocPara::handleFile ( const QCString cmdName)

Definition at line 5051 of file docparser.cpp.

5052 {
5053  int tok=doctokenizerYYlex();
5054  if (tok!=TK_WHITESPACE)
5055  {
5056  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5057  qPrint(cmdName));
5058  return;
5059  }
5061  tok=doctokenizerYYlex();
5063  if (tok!=TK_WORD)
5064  {
5065  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
5066  tokToString(tok),qPrint(cmdName));
5067  return;
5068  }
5070  T *df = new T(this,name,g_context);
5071  m_children.append(df);
5072  df->parse();
5073 }
static QCString name
Definition: declinfo.cpp:673
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
void append(const type *d)
Definition: qlist.h:73
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateFile()
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
int DocPara::handleHtmlEndTag ( const QCString tagName)

Definition at line 6164 of file docparser.cpp.

6165 {
6166  DBG(("handleHtmlEndTag(%s)\n",qPrint(tagName)));
6167  int tagId = Mappers::htmlTagMapper->map(tagName);
6168  int retval=RetVal_OK;
6169  switch (tagId)
6170  {
6171  case HTML_UL:
6172  if (!insideUL(this))
6173  {
6174  warn_doc_error(g_fileName,doctokenizerYYlineno,"found </ul> tag without matching <ul>");
6175  }
6176  else
6177  {
6178  retval=RetVal_EndList;
6179  }
6180  break;
6181  case HTML_OL:
6182  if (!insideOL(this))
6183  {
6184  warn_doc_error(g_fileName,doctokenizerYYlineno,"found </ol> tag without matching <ol>");
6185  }
6186  else
6187  {
6188  retval=RetVal_EndList;
6189  }
6190  break;
6191  case HTML_LI:
6192  if (!insideLI(this))
6193  {
6194  warn_doc_error(g_fileName,doctokenizerYYlineno,"found </li> tag without matching <li>");
6195  }
6196  else
6197  {
6198  // ignore </li> tags
6199  }
6200  break;
6201  case HTML_BLOCKQUOTE:
6202  retval=RetVal_EndBlockQuote;
6203  break;
6204  //case HTML_PRE:
6205  // if (!insidePRE(this))
6206  // {
6207  // warn_doc_error(g_fileName,doctokenizerYYlineno,"found </pre> tag without matching <pre>");
6208  // }
6209  // else
6210  // {
6211  // retval=RetVal_EndPre;
6212  // }
6213  // break;
6214  case HTML_BOLD:
6216  break;
6217  case HTML_CODE:
6219  break;
6220  case HTML_EMPHASIS:
6222  break;
6223  case HTML_DIV:
6225  break;
6226  case HTML_SPAN:
6228  break;
6229  case HTML_SUB:
6231  break;
6232  case HTML_SUP:
6234  break;
6235  case HTML_CENTER:
6237  break;
6238  case HTML_SMALL:
6240  break;
6241  case HTML_PRE:
6245  break;
6246  case HTML_P:
6247  retval=TK_NEWPARA;
6248  break;
6249  case HTML_DL:
6250  retval=RetVal_EndDesc;
6251  break;
6252  case HTML_DT:
6253  // ignore </dt> tag
6254  break;
6255  case HTML_DD:
6256  // ignore </dd> tag
6257  break;
6258  case HTML_TABLE:
6259  retval=RetVal_EndTable;
6260  break;
6261  case HTML_TR:
6262  // ignore </tr> tag
6263  break;
6264  case HTML_TD:
6265  // ignore </td> tag
6266  break;
6267  case HTML_TH:
6268  // ignore </th> tag
6269  break;
6270  case HTML_CAPTION:
6271  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </caption> found");
6272  break;
6273  case HTML_BR:
6274  warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal </br> tag found\n");
6275  break;
6276  case HTML_H1:
6277  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h1> found");
6278  break;
6279  case HTML_H2:
6280  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h2> found");
6281  break;
6282  case HTML_H3:
6283  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h3> found");
6284  break;
6285  case HTML_H4:
6286  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h4> found");
6287  break;
6288  case HTML_H5:
6289  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h5> found");
6290  break;
6291  case HTML_H6:
6292  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </h6> found");
6293  break;
6294  case HTML_IMG:
6295  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </img> found");
6296  break;
6297  case HTML_HR:
6298  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </hr> found");
6299  break;
6300  case HTML_A:
6301  //warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag </a> found");
6302  // ignore </a> tag (can be part of <a name=...></a>
6303  break;
6304 
6305  case XML_TERM:
6306  //m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,FALSE));
6307  break;
6308  case XML_SUMMARY:
6309  case XML_REMARKS:
6310  case XML_PARA:
6311  case XML_VALUE:
6312  case XML_EXAMPLE:
6313  case XML_PARAM:
6314  case XML_LIST:
6315  case XML_TYPEPARAM:
6316  case XML_RETURNS:
6317  case XML_SEE:
6318  case XML_SEEALSO:
6319  case XML_EXCEPTION:
6320  case XML_INHERITDOC:
6321  retval = RetVal_CloseXml;
6322  break;
6323  case XML_C:
6325  break;
6326  case XML_ITEM:
6327  case XML_LISTHEADER:
6328  case XML_INCLUDE:
6329  case XML_PERMISSION:
6330  case XML_DESCRIPTION:
6331  case XML_PARAMREF:
6332  case XML_TYPEPARAMREF:
6333  // These tags are defined in .Net but are currently unsupported
6334  break;
6335  case HTML_UNKNOWN:
6336  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported xml/html tag </%s> found", qPrint(tagName));
6337  m_children.append(new DocWord(this,"</"+tagName+">"));
6338  break;
6339  default:
6340  // we should not get here!
6341  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end tag %s\n",qPrint(tagName));
6342  ASSERT(0);
6343  break;
6344  }
6345  return retval;
6346 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
void setInsidePreformatted(bool p)
Definition: docparser.h:162
int map(const char *n)
Definition: cmdmapper.cpp:225
void doctokenizerYYsetInsidePre(bool b)
static bool insideOL(DocNode *n)
Definition: docparser.cpp:684
static void handleStyleLeave(DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const char *tagName)
Definition: docparser.cpp:920
const char * qPrint(const char *s)
Definition: qcstring.h:797
static bool insideLI(DocNode *n)
Definition: docparser.cpp:657
#define ASSERT(x)
Definition: qglobal.h:590
static bool insideUL(DocNode *n)
Definition: docparser.cpp:670
int DocPara::handleHtmlHeader ( const HtmlAttribList tagHtmlAttribs,
int  level 
)

Definition at line 5211 of file docparser.cpp.

5212 {
5213  DocHtmlHeader *header = new DocHtmlHeader(this,tagHtmlAttribs,level);
5214  m_children.append(header);
5215  int retval = header->parse();
5216  return (retval==RetVal_OK) ? TK_NEWPARA : retval;
5217 }
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
int DocPara::handleHtmlStartTag ( const QCString tagName,
const HtmlAttribList tagHtmlAttribs 
)

Definition at line 5778 of file docparser.cpp.

5779 {
5780  DBG(("handleHtmlStartTag(%s,%d)\n",qPrint(tagName),tagHtmlAttribs.count()));
5781  int retval=RetVal_OK;
5782  int tagId = Mappers::htmlTagMapper->map(tagName);
5783  if (g_token->emptyTag && !(tagId&XML_CmdMask) &&
5784  tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR)
5785  {
5786  warn_doc_error(g_fileName,doctokenizerYYlineno,"HTML tags may not use the 'empty tag' XHTML syntax.");
5787  }
5788  switch (tagId)
5789  {
5790  case HTML_UL:
5791  {
5792  DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Unordered);
5793  m_children.append(list);
5794  retval=list->parse();
5795  }
5796  break;
5797  case HTML_OL:
5798  {
5799  DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Ordered);
5800  m_children.append(list);
5801  retval=list->parse();
5802  }
5803  break;
5804  case HTML_LI:
5805  if (!insideUL(this) && !insideOL(this))
5806  {
5807  warn_doc_error(g_fileName,doctokenizerYYlineno,"lonely <li> tag found");
5808  }
5809  else
5810  {
5811  retval=RetVal_ListItem;
5812  }
5813  break;
5814  case HTML_BOLD:
5816  break;
5817  case HTML_CODE:
5818  if (/*getLanguageFromFileName(g_fileName)==SrcLangExt_CSharp ||*/ g_xmlComment)
5819  // for C# source or inside a <summary> or <remark> section we
5820  // treat <code> as an XML tag (so similar to @code)
5821  {
5823  retval = handleStartCode();
5824  }
5825  else // normal HTML markup
5826  {
5828  }
5829  break;
5830  case HTML_EMPHASIS:
5832  break;
5833  case HTML_DIV:
5835  break;
5836  case HTML_SPAN:
5838  break;
5839  case HTML_SUB:
5841  break;
5842  case HTML_SUP:
5844  break;
5845  case HTML_CENTER:
5847  break;
5848  case HTML_SMALL:
5850  break;
5851  case HTML_PRE:
5855  break;
5856  case HTML_P:
5857  retval=TK_NEWPARA;
5858  break;
5859  case HTML_DL:
5860  {
5861  DocHtmlDescList *list = new DocHtmlDescList(this,tagHtmlAttribs);
5862  m_children.append(list);
5863  retval=list->parse();
5864  }
5865  break;
5866  case HTML_DT:
5867  retval = RetVal_DescTitle;
5868  break;
5869  case HTML_DD:
5870  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag <dd> found");
5871  break;
5872  case HTML_TABLE:
5873  {
5874  DocHtmlTable *table = new DocHtmlTable(this,tagHtmlAttribs);
5875  m_children.append(table);
5876  retval=table->parse();
5877  }
5878  break;
5879  case HTML_TR:
5880  retval = RetVal_TableRow;
5881  break;
5882  case HTML_TD:
5883  retval = RetVal_TableCell;
5884  break;
5885  case HTML_TH:
5886  retval = RetVal_TableHCell;
5887  break;
5888  case HTML_CAPTION:
5889  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag <caption> found");
5890  break;
5891  case HTML_BR:
5892  {
5893  DocLineBreak *lb = new DocLineBreak(this);
5894  m_children.append(lb);
5895  }
5896  break;
5897  case HTML_HR:
5898  {
5899  DocHorRuler *hr = new DocHorRuler(this);
5900  m_children.append(hr);
5901  }
5902  break;
5903  case HTML_A:
5904  retval=handleAHref(this,m_children,tagHtmlAttribs);
5905  break;
5906  case HTML_H1:
5907  retval=handleHtmlHeader(tagHtmlAttribs,1);
5908  break;
5909  case HTML_H2:
5910  retval=handleHtmlHeader(tagHtmlAttribs,2);
5911  break;
5912  case HTML_H3:
5913  retval=handleHtmlHeader(tagHtmlAttribs,3);
5914  break;
5915  case HTML_H4:
5916  retval=handleHtmlHeader(tagHtmlAttribs,4);
5917  break;
5918  case HTML_H5:
5919  retval=handleHtmlHeader(tagHtmlAttribs,5);
5920  break;
5921  case HTML_H6:
5922  retval=handleHtmlHeader(tagHtmlAttribs,6);
5923  break;
5924  case HTML_IMG:
5925  {
5926  handleImg(this,m_children,tagHtmlAttribs);
5927  }
5928  break;
5929  case HTML_BLOCKQUOTE:
5930  {
5931  DocHtmlBlockQuote *block = new DocHtmlBlockQuote(this,tagHtmlAttribs);
5932  m_children.append(block);
5933  retval = block->parse();
5934  }
5935  break;
5936 
5937  case XML_SUMMARY:
5938  case XML_REMARKS:
5939  case XML_EXAMPLE:
5941  // fall through
5942  case XML_VALUE:
5943  case XML_PARA:
5944  if (!m_children.isEmpty())
5945  {
5946  retval = TK_NEWPARA;
5947  }
5948  break;
5949  case XML_DESCRIPTION:
5950  if (insideTable(this))
5951  {
5952  retval=RetVal_TableCell;
5953  }
5954  break;
5955  case XML_C:
5957  break;
5958  case XML_PARAM:
5959  case XML_TYPEPARAM:
5960  {
5962  QCString paramName;
5963  if (findAttribute(tagHtmlAttribs,"name",&paramName))
5964  {
5965  if (paramName.isEmpty())
5966  {
5967  if (Config_getBool("WARN_NO_PARAMDOC"))
5968  {
5969  warn_doc_error(g_fileName,doctokenizerYYlineno,"empty 'name' attribute for <param%s> tag.",tagId==XML_PARAM?"":"type");
5970  }
5971  }
5972  else
5973  {
5974  retval = handleParamSection(paramName,
5976  TRUE);
5977  }
5978  }
5979  else
5980  {
5981  warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <param%s> tag.",tagId==XML_PARAM?"":"type");
5982  }
5983  }
5984  break;
5985  case XML_PARAMREF:
5986  case XML_TYPEPARAMREF:
5987  {
5988  QCString paramName;
5989  if (findAttribute(tagHtmlAttribs,"name",&paramName))
5990  {
5991  //printf("paramName=%s\n",paramName.data());
5993  m_children.append(new DocWord(this,paramName));
5995  if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," "));
5996  }
5997  else
5998  {
5999  warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'name' attribute from <param%sref> tag.",tagId==XML_PARAMREF?"":"type");
6000  }
6001  }
6002  break;
6003  case XML_EXCEPTION:
6004  {
6006  QCString exceptName;
6007  if (findAttribute(tagHtmlAttribs,"cref",&exceptName))
6008  {
6009  unescapeCRef(exceptName);
6010  retval = handleParamSection(exceptName,DocParamSect::Exception,TRUE);
6011  }
6012  else
6013  {
6014  warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <exception> tag.");
6015  }
6016  }
6017  break;
6018  case XML_ITEM:
6019  case XML_LISTHEADER:
6020  if (insideTable(this))
6021  {
6022  retval=RetVal_TableRow;
6023  }
6024  else if (insideUL(this) || insideOL(this))
6025  {
6026  retval=RetVal_ListItem;
6027  }
6028  else
6029  {
6030  warn_doc_error(g_fileName,doctokenizerYYlineno,"lonely <item> tag found");
6031  }
6032  break;
6033  case XML_RETURNS:
6037  break;
6038  case XML_TERM:
6039  //m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,TRUE));
6040  if (insideTable(this))
6041  {
6042  retval=RetVal_TableCell;
6043  }
6044  break;
6045  case XML_SEE:
6046  // I'm not sure if <see> is the same as <seealso> or if it
6047  // should you link a member without producing a section. The
6048  // C# specification is extremely vague about this (but what else
6049  // can we expect from Microsoft...)
6050  {
6051  QCString cref;
6052  //printf("XML_SEE: empty tag=%d\n",g_token->emptyTag);
6053  if (findAttribute(tagHtmlAttribs,"cref",&cref))
6054  {
6055  unescapeCRef(cref);
6056  if (g_token->emptyTag) // <see cref="..."/> style
6057  {
6058  bool inSeeBlock = g_inSeeBlock;
6059  g_token->name = cref;
6060  g_inSeeBlock = TRUE;
6062  g_inSeeBlock = inSeeBlock;
6063  }
6064  else // <see cref="...">...</see> style
6065  {
6066  //DocRef *ref = new DocRef(this,cref);
6067  //m_children.append(ref);
6068  //ref->parse();
6070  DocLink *lnk = new DocLink(this,cref);
6071  m_children.append(lnk);
6072  QCString leftOver = lnk->parse(FALSE,TRUE);
6073  if (!leftOver.isEmpty())
6074  {
6075  m_children.append(new DocWord(this,leftOver));
6076  }
6077  }
6078  }
6079  else
6080  {
6081  warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <see> tag.");
6082  }
6083  }
6084  break;
6085  case XML_SEEALSO:
6086  {
6088  QCString cref;
6089  if (findAttribute(tagHtmlAttribs,"cref",&cref))
6090  {
6091  unescapeCRef(cref);
6092  // Look for an existing "see" section
6093  DocSimpleSect *ss=0;
6095  DocNode *n;
6096  for (cli.toFirst();(n=cli.current());++cli)
6097  {
6098  if (n->kind()==Kind_SimpleSect && ((DocSimpleSect *)n)->type()==DocSimpleSect::See)
6099  {
6100  ss = (DocSimpleSect *)n;
6101  }
6102  }
6103 
6104  if (!ss) // start new section
6105  {
6106  ss=new DocSimpleSect(this,DocSimpleSect::See);
6107  m_children.append(ss);
6108  }
6109 
6110  ss->appendLinkWord(cref);
6111  retval = RetVal_OK;
6112  }
6113  else
6114  {
6115  warn_doc_error(g_fileName,doctokenizerYYlineno,"Missing 'cref' attribute from <seealso> tag.");
6116  }
6117  }
6118  break;
6119  case XML_LIST:
6120  {
6121  QCString type;
6122  findAttribute(tagHtmlAttribs,"type",&type);
6124  HtmlAttribList emptyList;
6125  if (type=="number")
6126  {
6127  listType=DocHtmlList::Ordered;
6128  }
6129  if (type=="table")
6130  {
6131  DocHtmlTable *table = new DocHtmlTable(this,emptyList);
6132  m_children.append(table);
6133  retval=table->parseXml();
6134  }
6135  else
6136  {
6137  DocHtmlList *list = new DocHtmlList(this,emptyList,listType);
6138  m_children.append(list);
6139  retval=list->parseXml();
6140  }
6141  }
6142  break;
6143  case XML_INCLUDE:
6144  case XML_PERMISSION:
6145  // These tags are defined in .Net but are currently unsupported
6147  break;
6148  case HTML_UNKNOWN:
6149  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported xml/html tag <%s> found", qPrint(tagName));
6150  m_children.append(new DocWord(this, "<"+tagName+tagHtmlAttribs.toString()+">"));
6151  break;
6152  case XML_INHERITDOC:
6153  handleInheritDoc();
6154  break;
6155 
6156  default:
6157  // we should not get here!
6158  ASSERT(0);
6159  break;
6160  }
6161  return retval;
6162 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
int handleParamSection(const QCString &cmdName, DocParamSect::Type t, bool xmlContext, int direction)
Definition: docparser.cpp:4870
bool isEmpty() const
Definition: qcstring.h:189
static bool insideTable(DocNode *n)
Definition: docparser.cpp:697
static void handleImg(DocNode *parent, QList< DocNode > &children, const HtmlAttribList &tagHtmlAttribs)
Definition: docparser.cpp:1676
void append(const type *d)
Definition: qlist.h:73
void handleInheritDoc()
Definition: docparser.cpp:5253
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString toString() const
Definition: htmlattrib.h:52
int parseXml()
Definition: docparser.cpp:4207
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static bool g_hasReturnCommand
Definition: docparser.cpp:99
static bool g_xmlComment
Definition: docparser.cpp:89
static void handleLinkedWord(DocNode *parent, QList< DocNode > &children, bool ignoreAutoLinkFlag=FALSE)
Definition: docparser.cpp:1054
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
virtual Kind kind() const =0
bool emptyTag
Definition: doctokenizer.h:104
TokenInfo * g_token
void setInsidePreformatted(bool p)
Definition: docparser.h:162
def cli(ctx)
Definition: main.py:7
uint count() const
Definition: qlist.h:66
uint count() const
Definition: qstack.h:56
int handleStartCode()
Definition: docparser.cpp:5228
bool isEmpty() const
Definition: qlist.h:67
std::void_t< T > n
int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs, int level)
Definition: docparser.cpp:5211
#define Config_getBool(val)
Definition: config.cpp:664
static void handleStyleEnter(DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const HtmlAttribList *attribs)
Definition: docparser.cpp:908
int map(const char *n)
Definition: cmdmapper.cpp:225
HtmlAttribList attribs
Definition: doctokenizer.h:102
static int handleAHref(DocNode *parent, QList< DocNode > &children, const HtmlAttribList &tagHtmlAttribs)
Definition: docparser.cpp:981
void doctokenizerYYsetInsidePre(bool b)
static bool insideOL(DocNode *n)
Definition: docparser.cpp:684
QCString name
Definition: doctokenizer.h:77
int handleSimpleSection(DocSimpleSect::Type t, bool xmlContext=FALSE)
Definition: docparser.cpp:4840
static void unescapeCRef(QCString &s)
Definition: docparser.cpp:237
static QCString type
Definition: declinfo.cpp:672
static bool g_inSeeBlock
Definition: docparser.cpp:88
void appendLinkWord(const QCString &word)
Definition: docparser.cpp:4600
A list of Html attributes.
Definition: htmlattrib.h:32
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
static bool findAttribute(const HtmlAttribList &tagHtmlAttribs, const char *attrName, QCString *result)
Definition: docparser.cpp:5760
#define ASSERT(x)
Definition: qglobal.h:590
static bool insideUL(DocNode *n)
Definition: docparser.cpp:670
void doctokenizerYYsetStateXmlCode()
void DocPara::handleImage ( const QCString cmdName)

Definition at line 4999 of file docparser.cpp.

5000 {
5001  int tok=doctokenizerYYlex();
5002  if (tok!=TK_WHITESPACE)
5003  {
5004  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5005  qPrint(cmdName));
5006  return;
5007  }
5008  tok=doctokenizerYYlex();
5009  if (tok!=TK_WORD && tok!=TK_LNKWORD)
5010  {
5011  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
5012  tokToString(tok),qPrint(cmdName));
5013  return;
5014  }
5015  tok=doctokenizerYYlex();
5016  if (tok!=TK_WHITESPACE)
5017  {
5018  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5019  qPrint(cmdName));
5020  return;
5021  }
5022  DocImage::Type t;
5023  QCString imgType = g_token->name.lower();
5024  if (imgType=="html") t=DocImage::Html;
5025  else if (imgType=="latex") t=DocImage::Latex;
5026  else if (imgType=="docbook") t=DocImage::DocBook;
5027  else if (imgType=="rtf") t=DocImage::Rtf;
5028  else
5029  {
5030  warn_doc_error(g_fileName,doctokenizerYYlineno,"image type %s specified as the first argument of "
5031  "%s is not valid",
5032  qPrint(imgType),qPrint(cmdName));
5033  return;
5034  }
5036  tok=doctokenizerYYlex();
5038  if (tok!=TK_WORD)
5039  {
5040  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
5041  tokToString(tok),qPrint(cmdName));
5042  return;
5043  }
5044  HtmlAttribList attrList;
5045  DocImage *img = new DocImage(this,attrList,findAndCopyImage(g_token->name,t),t);
5046  m_children.append(img);
5047  img->parse();
5048 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
void append(const type *d)
Definition: qlist.h:73
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateFile()
static QCString findAndCopyImage(const char *fileName, DocImage::Type type)
Definition: docparser.cpp:262
void parse()
Definition: docparser.cpp:2927
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
QCString lower() const
Definition: qcstring.cpp:263
A list of Html attributes.
Definition: htmlattrib.h:32
const char * qPrint(const char *s)
Definition: qcstring.h:797
void DocPara::handleInclude ( const QCString cmdName,
DocInclude::Type  t 
)

Definition at line 5136 of file docparser.cpp.

5137 {
5138  DBG(("handleInclude(%s)\n",qPrint(cmdName)));
5139  int tok=doctokenizerYYlex();
5140  if (tok!=TK_WHITESPACE)
5141  {
5142  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5143  qPrint(cmdName));
5144  return;
5145  }
5147  tok=doctokenizerYYlex();
5149  if (tok==0)
5150  {
5151  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
5152  "argument of command %s",qPrint(cmdName));
5153  return;
5154  }
5155  else if (tok!=TK_WORD)
5156  {
5157  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
5158  tokToString(tok),qPrint(cmdName));
5159  return;
5160  }
5162  QCString blockId;
5163  if (t==DocInclude::Snippet)
5164  {
5165  if (fileName == "this") fileName=g_fileName;
5167  tok=doctokenizerYYlex();
5169  if (tok!=TK_WORD)
5170  {
5171  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected block identifier, but found token %s instead while parsing the %s command",
5172  tokToString(tok),qPrint(cmdName));
5173  return;
5174  }
5175  blockId = "["+g_token->name+"]";
5176  }
5177  DocInclude *inc = new DocInclude(this,fileName,g_context,t,g_isExample,g_exampleName,blockId);
5178  m_children.append(inc);
5179  inc->parse();
5180 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
static bool g_isExample
Definition: docparser.cpp:102
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateFile()
fileName
Definition: dumpTree.py:9
void parse()
Definition: docparser.cpp:1899
QCString name
Definition: doctokenizer.h:77
void doctokenizerYYsetStateSnippet()
static QCString g_context
Definition: docparser.cpp:87
const char * tokToString(int token)
static QCString g_exampleName
Definition: docparser.cpp:103
const char * qPrint(const char *s)
Definition: qcstring.h:797
void DocPara::handleIncludeOperator ( const QCString cmdName,
DocIncOperator::Type  t 
)

Definition at line 4946 of file docparser.cpp.

4947 {
4948  DBG(("handleIncludeOperator(%s)\n",qPrint(cmdName)));
4949  int tok=doctokenizerYYlex();
4950  if (tok!=TK_WHITESPACE)
4951  {
4952  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
4953  qPrint(cmdName));
4954  return;
4955  }
4957  tok=doctokenizerYYlex();
4959  if (tok==0)
4960  {
4961  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
4962  "argument of command %s", qPrint(cmdName));
4963  return;
4964  }
4965  else if (tok!=TK_WORD)
4966  {
4967  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
4968  tokToString(tok),qPrint(cmdName));
4969  return;
4970  }
4973  DocNode *n1 = it.toLast();
4974  --it;
4975  DocNode *n2 = n1!=0 ? it.current() : 0;
4976  bool isFirst = n1==0 || // no last node
4977  (n1->kind()!=DocNode::Kind_IncOperator &&
4979  ) || // last node is not operator or whitespace
4980  (n1->kind()==DocNode::Kind_WhiteSpace &&
4981  n2!=0 && n2->kind()!=DocNode::Kind_IncOperator
4982  ); // previous not is not operator
4983  op->markFirst(isFirst);
4984  op->markLast(TRUE);
4985  if (n1!=0 && n1->kind()==DocNode::Kind_IncOperator)
4986  {
4987  ((DocIncOperator *)n1)->markLast(FALSE);
4988  }
4989  else if (n1!=0 && n1->kind()==DocNode::Kind_WhiteSpace &&
4990  n2!=0 && n2->kind()==DocNode::Kind_IncOperator
4991  )
4992  {
4993  ((DocIncOperator *)n2)->markLast(FALSE);
4994  }
4995  m_children.append(op);
4996  op->parse();
4997 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYsetStatePattern()
QList< DocNode > m_children
Definition: docparser.h:189
void markLast(bool v=TRUE)
Definition: docparser.h:540
void doctokenizerYYsetStatePara()
static bool g_isExample
Definition: docparser.cpp:102
bool isFirst() const
Definition: docparser.h:1124
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
virtual Kind kind() const =0
TokenInfo * g_token
int doctokenizerYYlex(void)
void markFirst(bool v=TRUE)
Definition: docparser.h:539
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
const char * tokToString(int token)
static QCString g_exampleName
Definition: docparser.cpp:103
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
void DocPara::handleInheritDoc ( )

Definition at line 5253 of file docparser.cpp.

5254 {
5255  if (g_memberDef) // inheriting docs from a member
5256  {
5257  MemberDef *reMd = g_memberDef->reimplements();
5258  if (reMd) // member from which was inherited.
5259  {
5260  MemberDef *thisMd = g_memberDef;
5261  //printf("{InheritDocs:%s=>%s}\n",g_memberDef->qualifiedName().data(),reMd->qualifiedName().data());
5263  g_scope=reMd->getOuterScope();
5265  {
5266  g_context=g_scope->name();
5267  }
5268  g_memberDef=reMd;
5269  g_styleStack.clear();
5270  g_nodeStack.clear();
5271  g_copyStack.append(reMd);
5274  g_copyStack.remove(reMd);
5276  g_memberDef = thisMd;
5277  }
5278  }
5279 }
QList< DocNode > m_children
Definition: docparser.h:189
MemberDef * reimplements() const
Definition: memberdef.cpp:878
static Definition * g_scope
Definition: docparser.cpp:86
void append(const type *d)
Definition: qlist.h:73
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
static NamespaceDef * globalScope
Definition: doxygen.h:128
const QCString & name() const
Definition: definition.h:114
QCString briefDescription(bool abbr=FALSE) const
Definition: memberdef.cpp:5073
static MemberDef * g_memberDef
Definition: docparser.cpp:101
static QList< Definition > g_copyStack
Definition: docparser.cpp:94
static void docParserPopContext(bool keepParamInfo=FALSE)
Definition: docparser.cpp:191
static void docParserPushContext(bool saveParamInfo=TRUE)
Definition: docparser.cpp:148
virtual Definition * getOuterScope() const
QCString documentation() const
Definition: memberdef.cpp:5085
static QCString g_context
Definition: docparser.cpp:87
static int internalValidatingParseDoc(DocNode *parent, QList< DocNode > &children, const QCString &doc)
Definition: docparser.cpp:1713
void clear()
Definition: qstack.h:61
bool remove(uint i)
Definition: qlist.h:76
const bool TRUE
Definition: qglobal.h:371
void DocPara::handleLink ( const QCString cmdName,
bool  isJavaLink 
)

Definition at line 5082 of file docparser.cpp.

5083 {
5084  int tok=doctokenizerYYlex();
5085  if (tok!=TK_WHITESPACE)
5086  {
5087  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5088  qPrint(cmdName));
5089  return;
5090  }
5092  tok=doctokenizerYYlex();
5093  if (tok!=TK_WORD)
5094  {
5095  warn_doc_error(g_fileName,doctokenizerYYlineno,"%s as the argument of %s",
5096  tokToString(tok),qPrint(cmdName));
5097  return;
5098  }
5100  DocLink *lnk = new DocLink(this,g_token->name);
5101  m_children.append(lnk);
5102  QCString leftOver = lnk->parse(isJavaLink);
5103  if (!leftOver.isEmpty())
5104  {
5105  m_children.append(new DocWord(this,leftOver));
5106  }
5107 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
bool isEmpty() const
Definition: qcstring.h:189
void doctokenizerYYsetStateLink()
void append(const type *d)
Definition: qlist.h:73
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
int DocPara::handleParamSection ( const QCString cmdName,
DocParamSect::Type  t,
bool  xmlContext = FALSE,
int  direction = DocParamSect::Unspecified 
)

Definition at line 4870 of file docparser.cpp.

4874 {
4875  DocParamSect *ps=0;
4876  if (!m_children.isEmpty() && // previous element
4877  m_children.getLast()->kind()==Kind_ParamSect && // was a param sect
4878  ((DocParamSect *)m_children.getLast())->type()==t) // of same type
4879  {
4880  // append to previous section
4882  }
4883  else // start new section
4884  {
4885  ps=new DocParamSect(this,t);
4886  m_children.append(ps);
4887  }
4888  int rv=ps->parse(cmdName,xmlContext,(DocParamSect::Direction)direction);
4889  return (rv!=TK_NEWPARA) ? rv : RetVal_OK;
4890 }
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
virtual Kind kind() const =0
int parse(const QCString &cmdName, bool xmlContext, Direction d)
Definition: docparser.cpp:4795
type * getLast() const
Definition: qlist.h:96
bool isEmpty() const
Definition: qlist.h:67
static constexpr double ps
Definition: Units.h:99
static QCString type
Definition: declinfo.cpp:672
void DocPara::handleRef ( const QCString cmdName)

Definition at line 5109 of file docparser.cpp.

5110 {
5111  DBG(("handleRef(%s)\n",qPrint(cmdName)));
5112  int tok=doctokenizerYYlex();
5113  if (tok!=TK_WHITESPACE)
5114  {
5115  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5116  qPrint(cmdName));
5117  return;
5118  }
5120  tok=doctokenizerYYlex(); // get the reference id
5121  DocRef *ref=0;
5122  if (tok!=TK_WORD)
5123  {
5124  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
5125  tokToString(tok),qPrint(cmdName));
5126  goto endref;
5127  }
5128  ref = new DocRef(this,g_token->name,g_context);
5129  m_children.append(ref);
5130  ref->parse();
5131 endref:
5133 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
void doctokenizerYYsetStateRef()
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
void parse()
Definition: docparser.cpp:2552
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
void DocPara::handleSection ( const QCString cmdName)

Definition at line 5182 of file docparser.cpp.

5183 {
5184  // get the argument of the section command.
5185  int tok=doctokenizerYYlex();
5186  if (tok!=TK_WHITESPACE)
5187  {
5188  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
5189  qPrint(cmdName));
5190  return;
5191  }
5192  tok=doctokenizerYYlex();
5193  if (tok==0)
5194  {
5195  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
5196  "argument of command %s\n", qPrint(cmdName));
5197  return;
5198  }
5199  else if (tok!=TK_WORD && tok!=TK_LNKWORD)
5200  {
5201  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
5202  tokToString(tok),qPrint(cmdName));
5203  return;
5204  }
5209 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYsetStatePara()
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString sectionId
Definition: doctokenizer.h:89
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateSkipTitle()
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
int DocPara::handleSimpleSection ( DocSimpleSect::Type  t,
bool  xmlContext = FALSE 
)

Definition at line 4840 of file docparser.cpp.

4841 {
4842  DocSimpleSect *ss=0;
4843  bool needsSeparator = FALSE;
4844  if (!m_children.isEmpty() && // previous element
4845  m_children.getLast()->kind()==Kind_SimpleSect && // was a simple sect
4846  ((DocSimpleSect *)m_children.getLast())->type()==t && // of same type
4847  t!=DocSimpleSect::User) // but not user defined
4848  {
4849  // append to previous section
4851  needsSeparator = TRUE;
4852  }
4853  else // start new section
4854  {
4855  ss=new DocSimpleSect(this,t);
4856  m_children.append(ss);
4857  }
4858  int rv = RetVal_OK;
4859  if (xmlContext)
4860  {
4861  return ss->parseXml();
4862  }
4863  else
4864  {
4865  rv = ss->parse(t==DocSimpleSect::User,needsSeparator);
4866  }
4867  return (rv!=TK_NEWPARA) ? rv : RetVal_OK;
4868 }
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
int parse(bool userTitle, bool needsSeparator)
Definition: docparser.cpp:4507
virtual Kind kind() const =0
type * getLast() const
Definition: qlist.h:96
bool isEmpty() const
Definition: qlist.h:67
static QCString type
Definition: declinfo.cpp:672
const bool TRUE
Definition: qglobal.h:371
int DocPara::handleStartCode ( )

Definition at line 5228 of file docparser.cpp.

5229 {
5230  int retval = doctokenizerYYlex();
5231  QCString lang = g_token->name;
5232  if (!lang.isEmpty() && lang.at(0)!='.')
5233  {
5234  lang="."+lang;
5235  }
5236  if (g_xmlComment)
5237  {
5238  g_token->verb = substitute(substitute(g_token->verb,"&lt;","<"),"&gt;",">");
5239  }
5240  // search for the first non-whitespace line, index is stored in li
5241  int i=0,li=0,l=g_token->verb.length();
5242  while (i<l && (g_token->verb.at(i)==' ' || g_token->verb.at(i)=='\n'))
5243  {
5244  if (g_token->verb.at(i)=='\n') li=i+1;
5245  i++;
5246  }
5248  if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"code section ended without end marker");
5250  return retval;
5251 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
static bool g_isExample
Definition: docparser.cpp:102
bool isEmpty() const
Definition: qcstring.h:189
uint length() const
Definition: qcstring.h:195
void append(const type *d)
Definition: qlist.h:73
char & at(uint i) const
Definition: qcstring.h:326
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static bool g_xmlComment
Definition: docparser.cpp:89
static QStrList * l
Definition: config.cpp:1044
TokenInfo * g_token
int doctokenizerYYlex(void)
QCString stripIndentation(const QCString &s)
Definition: util.cpp:8110
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
QCString verb
Definition: doctokenizer.h:96
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
static QCString g_exampleName
Definition: docparser.cpp:103
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
void DocPara::handleVhdlFlow ( )

Definition at line 5075 of file docparser.cpp.

5076 {
5077  DocVhdlFlow *vf = new DocVhdlFlow(this);
5078  m_children.append(vf);
5079  vf->parse();
5080 }
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
void parse()
Definition: docparser.cpp:2876
int DocPara::handleXRefItem ( )

Definition at line 4924 of file docparser.cpp.

4925 {
4926  int retval=doctokenizerYYlex();
4927  ASSERT(retval==TK_WHITESPACE);
4929  retval=doctokenizerYYlex();
4930  if (retval==RetVal_OK)
4931  {
4932  DocXRefItem *ref = new DocXRefItem(this,g_token->id,g_token->name);
4933  if (ref->parse())
4934  {
4935  m_children.append(ref);
4936  }
4937  else
4938  {
4939  delete ref;
4940  }
4941  }
4943  return retval;
4944 }
QList< DocNode > m_children
Definition: docparser.h:189
void doctokenizerYYsetStatePara()
void append(const type *d)
Definition: qlist.h:73
void doctokenizerYYsetStateXRefItem()
TokenInfo * g_token
int doctokenizerYYlex(void)
bool parse()
Definition: docparser.cpp:2159
QCString name
Definition: doctokenizer.h:77
#define ASSERT(x)
Definition: qglobal.h:590
bool DocPara::injectToken ( int  tok,
const QCString tokText 
)

Definition at line 5222 of file docparser.cpp.

5223 {
5224  g_token->name = tokText;
5225  return defaultHandleToken(this,tok,m_children);
5226 }
QList< DocNode > m_children
Definition: docparser.h:189
TokenInfo * g_token
static bool defaultHandleToken(DocNode *parent, int tok, QList< DocNode > &children, bool handleWord=TRUE)
Definition: docparser.cpp:1331
QCString name
Definition: doctokenizer.h:77
bool DocPara::isEmpty ( ) const
inline

Definition at line 1120 of file docparser.h.

1120 { return m_children.isEmpty(); }
QList< DocNode > m_children
Definition: docparser.h:189
bool isEmpty() const
Definition: qlist.h:67
bool DocPara::isFirst ( ) const
inline

Definition at line 1124 of file docparser.h.

1124 { return m_isFirst; }
bool m_isFirst
Definition: docparser.h:1152
bool DocPara::isLast ( ) const
inline

Definition at line 1125 of file docparser.h.

1125 { return m_isLast; }
bool m_isLast
Definition: docparser.h:1153
Kind DocPara::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 1119 of file docparser.h.

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

Definition at line 1122 of file docparser.h.

1122 { m_isFirst=v; }
bool m_isFirst
Definition: docparser.h:1152
void DocPara::markLast ( bool  v = TRUE)
inline

Definition at line 1123 of file docparser.h.

1123 { m_isLast=v; }
bool m_isLast
Definition: docparser.h:1153
int DocPara::parse ( )

Definition at line 6348 of file docparser.cpp.

6349 {
6350  DBG(("DocPara::parse() start\n"));
6351  g_nodeStack.push(this);
6352  // handle style commands "inherited" from the previous paragraph
6354  int tok;
6355  int retval=0;
6356  while ((tok=doctokenizerYYlex())) // get the next token
6357  {
6358 reparsetoken:
6359  DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno));
6360  if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL ||
6361  tok==TK_COMMAND || tok==TK_HTMLTAG
6362  )
6363  {
6364  DBG((" name=%s",qPrint(g_token->name)));
6365  }
6366  DBG(("\n"));
6367  switch(tok)
6368  {
6369  case TK_WORD:
6370  m_children.append(new DocWord(this,g_token->name));
6371  break;
6372  case TK_LNKWORD:
6374  break;
6375  case TK_URL:
6377  break;
6378  case TK_WHITESPACE:
6379  {
6380  // prevent leading whitespace and collapse multiple whitespace areas
6381  DocNode::Kind k;
6382  if (insidePRE(this) || // all whitespace is relevant
6383  (
6384  // remove leading whitespace
6385  !m_children.isEmpty() &&
6386  // and whitespace after certain constructs
6393  /*k!=DocNode::Kind_Verbatim &&*/
6398  )
6399  )
6400  {
6402  }
6403  }
6404  break;
6405  case TK_LISTITEM:
6406  {
6407  DBG(("found list item at %d parent=%d\n",g_token->indent,parent()->kind()));
6408  DocNode *n=parent();
6409  while (n && n->kind()!=DocNode::Kind_AutoList) n=n->parent();
6410  if (n) // we found an auto list up in the hierarchy
6411  {
6412  DocAutoList *al = (DocAutoList *)n;
6413  DBG(("previous list item at %d\n",al->indent()));
6414  if (al->indent()>=g_token->indent)
6415  // new item at the same or lower indent level
6416  {
6417  retval=TK_LISTITEM;
6418  goto endparagraph;
6419  }
6420  }
6421 
6422  // determine list depth
6423  int depth = 0;
6424  n=parent();
6425  while(n)
6426  {
6427  if (n->kind() == DocNode::Kind_AutoList &&
6428  ((DocAutoList*)n)->isEnumList()) depth++;
6429  n=n->parent();
6430  }
6431 
6432  // first item or sub list => create new list
6433  DocAutoList *al=0;
6434  do
6435  {
6436  al = new DocAutoList(this,g_token->indent,
6437  g_token->isEnumList,depth);
6438  m_children.append(al);
6439  retval = al->parse();
6440  } while (retval==TK_LISTITEM && // new list
6441  al->indent()==g_token->indent // at same indent level
6442  );
6443 
6444  // check the return value
6445  if (retval==RetVal_SimpleSec) // auto list ended due to simple section command
6446  {
6447  // Reparse the token that ended the section at this level,
6448  // so a new simple section will be started at this level.
6449  // This is the same as unputting the last read token and continuing.
6451  if (g_token->name.left(4)=="rcs:") // RCS section
6452  {
6453  g_token->name = g_token->name.mid(4);
6455  tok = TK_RCSTAG;
6456  }
6457  else // other section
6458  {
6459  tok = TK_COMMAND;
6460  }
6461  DBG(("reparsing command %s\n",qPrint(g_token->name)));
6462  goto reparsetoken;
6463  }
6464  else if (retval==TK_ENDLIST)
6465  {
6466  if (al->indent()>g_token->indent) // end list
6467  {
6468  goto endparagraph;
6469  }
6470  else // continue with current paragraph
6471  {
6472  }
6473  }
6474  else // paragraph ended due to TK_NEWPARA, TK_LISTITEM, or EOF
6475  {
6476  goto endparagraph;
6477  }
6478  }
6479  break;
6480  case TK_ENDLIST:
6481  DBG(("Found end of list inside of paragraph at line %d\n",doctokenizerYYlineno));
6483  {
6485  DocAutoList *al = (DocAutoList *)parent()->parent();
6486  if (al->indent()>=g_token->indent)
6487  {
6488  // end of list marker ends this paragraph
6489  retval=TK_ENDLIST;
6490  goto endparagraph;
6491  }
6492  else
6493  {
6494  warn_doc_error(g_fileName,doctokenizerYYlineno,"End of list marker found "
6495  "has invalid indent level");
6496  }
6497  }
6498  else
6499  {
6500  warn_doc_error(g_fileName,doctokenizerYYlineno,"End of list marker found without any preceding "
6501  "list items");
6502  }
6503  break;
6504  case TK_COMMAND:
6505  {
6506  // see if we have to start a simple section
6508  DocNode *n=parent();
6509  while (n &&
6510  n->kind()!=DocNode::Kind_SimpleSect &&
6512  )
6513  {
6514  n=n->parent();
6515  }
6516  if (cmd&SIMPLESECT_BIT)
6517  {
6518  if (n) // already in a simple section
6519  {
6520  // simple section cannot start in this paragraph, need
6521  // to unwind the stack and remember the command.
6523  retval=RetVal_SimpleSec;
6524  goto endparagraph;
6525  }
6526  }
6527  // see if we are in a simple list
6528  n=parent();
6529  while (n && n->kind()!=DocNode::Kind_SimpleListItem) n=n->parent();
6530  if (n)
6531  {
6532  if (cmd==CMD_LI)
6533  {
6534  retval=RetVal_ListItem;
6535  goto endparagraph;
6536  }
6537  }
6538 
6539  // handle the command
6540  retval=handleCommand(g_token->name);
6541  DBG(("handleCommand returns %x\n",retval));
6542 
6543  // check the return value
6544  if (retval==RetVal_SimpleSec)
6545  {
6546  // Reparse the token that ended the section at this level,
6547  // so a new simple section will be started at this level.
6548  // This is the same as unputting the last read token and continuing.
6550  if (g_token->name.left(4)=="rcs:") // RCS section
6551  {
6552  g_token->name = g_token->name.mid(4);
6554  tok = TK_RCSTAG;
6555  }
6556  else // other section
6557  {
6558  tok = TK_COMMAND;
6559  }
6560  DBG(("reparsing command %s\n",qPrint(g_token->name)));
6561  goto reparsetoken;
6562  }
6563  else if (retval==RetVal_OK)
6564  {
6565  // the command ended normally, keep scanning for new tokens.
6566  retval = 0;
6567  }
6568  else if (retval>0 && retval<RetVal_OK)
6569  {
6570  // the command ended with a new command, reparse this token
6571  tok = retval;
6572  goto reparsetoken;
6573  }
6574  else // end of file, end of paragraph, start or end of section
6575  // or some auto list marker
6576  {
6577  goto endparagraph;
6578  }
6579  }
6580  break;
6581  case TK_HTMLTAG:
6582  {
6583  if (!g_token->endTag) // found a start tag
6584  {
6586  }
6587  else // found an end tag
6588  {
6589  retval = handleHtmlEndTag(g_token->name);
6590  }
6591  if (retval==RetVal_OK)
6592  {
6593  // the command ended normally, keep scanner for new tokens.
6594  retval = 0;
6595  }
6596  else
6597  {
6598  goto endparagraph;
6599  }
6600  }
6601  break;
6602  case TK_SYMBOL:
6603  {
6605  if (s!=DocSymbol::Sym_Unknown)
6606  {
6607  m_children.append(new DocSymbol(this,s));
6608  }
6609  else
6610  {
6611  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
6612  qPrint(g_token->name));
6613  }
6614  break;
6615  }
6616  case TK_NEWPARA:
6617  retval=TK_NEWPARA;
6618  goto endparagraph;
6619  case TK_RCSTAG:
6620  {
6621  DocNode *n=parent();
6622  while (n &&
6623  n->kind()!=DocNode::Kind_SimpleSect &&
6625  )
6626  {
6627  n=n->parent();
6628  }
6629  if (n) // already in a simple section
6630  {
6631  // simple section cannot start in this paragraph, need
6632  // to unwind the stack and remember the command.
6633  g_token->simpleSectName = "rcs:"+g_token->name;
6635  retval=RetVal_SimpleSec;
6636  goto endparagraph;
6637  }
6638 
6639  // see if we are in a simple list
6641  m_children.append(ss);
6642  ss->parseRcs();
6643  }
6644  break;
6645  default:
6647  "Found unexpected token (id=%x)\n",tok);
6648  break;
6649  }
6650  }
6651  retval=0;
6652 endparagraph:
6654  DocNode *n = g_nodeStack.pop();
6655  ASSERT(n==this);
6656  DBG(("DocPara::parse() end retval=%x\n",retval));
6657  INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM ||
6658  retval==TK_ENDLIST || retval>RetVal_OK
6659  );
6660 
6661  return retval;
6662 }
DocNode * parent() const
Definition: docparser.h:147
static QCString g_fileName
Definition: docparser.cpp:95
Kind kind() const
Definition: docparser.h:1119
QList< DocNode > m_children
Definition: docparser.h:189
int handleHtmlEndTag(const QCString &tagName)
Definition: docparser.cpp:6164
void append(const type *d)
Definition: qlist.h:73
QCString simpleSectText
Definition: doctokenizer.h:93
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString left(uint len) const
Definition: qcstring.cpp:213
int handleCommand(const QCString &cmdName)
Definition: docparser.cpp:5282
static void handleLinkedWord(DocNode *parent, QList< DocNode > &children, bool ignoreAutoLinkFlag=FALSE)
Definition: docparser.cpp:1054
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
virtual Kind kind() const =0
static void handleInitialStyleCommands(DocPara *parent, QList< DocNode > &children)
Definition: docparser.cpp:972
static bool insidePRE(DocNode *n)
Definition: docparser.cpp:644
int handleHtmlStartTag(const QCString &tagName, const HtmlAttribList &tagHtmlAttribs)
Definition: docparser.cpp:5778
QCString copy() const
Definition: qcstring.h:250
TokenInfo * g_token
int doctokenizerYYlex(void)
void push(const type *d)
Definition: qstack.h:58
const int SIMPLESECT_BIT
Definition: cmdmapper.h:26
type * getLast() const
Definition: qlist.h:96
QCString chars
Definition: doctokenizer.h:107
bool isEmpty() const
Definition: qlist.h:67
QCString simpleSectName
Definition: doctokenizer.h:92
static void handlePendingStyleCommands(DocNode *parent, QList< DocNode > &children)
Definition: docparser.cpp:957
std::void_t< T > n
#define INTERNAL_ASSERT(x)
Definition: docparser.cpp:68
QCString text
Definition: doctokenizer.h:80
static SymType decodeSymbol(const QCString &symName)
Definition: docparser.cpp:1705
int map(const char *n)
Definition: cmdmapper.cpp:225
type * pop()
Definition: qstack.h:59
HtmlAttribList attribs
Definition: doctokenizer.h:102
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
static Mapper * cmdMapper
Definition: cmdmapper.h:219
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
int indent() const
Definition: docparser.h:622
bool isEnumList
Definition: doctokenizer.h:85
bool isEMailAddr
Definition: doctokenizer.h:110
list cmd
Definition: getreco.py:22
static QCString * s
Definition: config.cpp:1042
const char * qPrint(const char *s)
Definition: qcstring.h:797
#define ASSERT(x)
Definition: qglobal.h:590

Member Data Documentation

bool DocPara::m_isFirst
private

Definition at line 1152 of file docparser.h.

bool DocPara::m_isLast
private

Definition at line 1153 of file docparser.h.

QCString DocPara::m_sectionId
private

Definition at line 1151 of file docparser.h.


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