Skip to main content

The DocPara Class Reference

Node representing a paragraph in the documentation tree. More...

Declaration

class DocPara { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocCompoundNode

Base class for nodes with children. More...

Public Constructors Index

DocPara (DocParser *parser, DocNodeVariant *parent)

Public Member Functions Index

Tokenparse ()
boolisEmpty () const
voidmarkFirst (bool v=TRUE)
voidmarkLast (bool v=TRUE)
boolisFirst () const
boolisLast () const
TokenhandleCommand (char cmdChar, const QCString &cmdName)
TokenhandleHtmlStartTag (const QCString &tagName, const HtmlAttribList &tagHtmlAttribs)
TokenhandleHtmlEndTag (const QCString &tagName)
TokenhandleSimpleSection (DocSimpleSect::Type t, bool xmlContext=FALSE)
TokenhandleXRefItem ()
TokenhandleParamSection (const QCString &cmdName, DocParamSect::Type t, bool xmlContext, int direction)
voidhandleIncludeOperator (const QCString &cmdName, DocIncOperator::Type t)
template <class T>
voidhandleFile (const QCString &cmdName)
voidhandleInclude (const QCString &cmdName, DocInclude::Type t)
voidhandleLink (const QCString &cmdName, bool isJavaLink)
voidhandleCite (char cmdChar, const QCString &cmdName)
voidhandleDoxyConfig (char cmdChar, const QCString &cmdName)
voidhandleEmoji (char cmdChar, const QCString &cmdName)
voidhandleRef (char cmdChar, const QCString &cmdName)
voidhandleSection (char cmdChar, const QCString &cmdName)
voidhandleInheritDoc ()
voidhandleVhdlFlow ()
voidhandleILine (char cmdChar, const QCString &cmdName)
voidhandleIFile (char cmdChar, const QCString &cmdName)
voidhandleShowDate (char cmdChar, const QCString &cmdName)
TokenhandleStartCode ()
TokenhandleHtmlHeader (const HtmlAttribList &tagHtmlAttribs, int level)
boolinjectToken (Token tok, const QCString &tokText)
const HtmlAttribList &attribs () const
voidsetAttribs (const HtmlAttribList &attribs)

Private Member Attributes Index

boolm_isFirst = false
boolm_isLast = false
HtmlAttribListm_attribs

Description

Node representing a paragraph in the documentation tree.

Definition at line 1079 of file docnode.h.

Public Constructors

DocPara()

DocPara::DocPara (DocParser * parser, DocNodeVariant * parent)

Declaration at line 1082 of file docnode.h, definition at line 3338 of file docnode.cpp.

References DocCompoundNode::DocCompoundNode, FALSE, m_isFirst, m_isLast, DocNode::parent and DocNode::parser.

Referenced by parse.

Public Member Functions

attribs()

const HtmlAttribList & DocPara::attribs ()
inline

Definition at line 1114 of file docnode.h.

1114 const HtmlAttribList &attribs() const { return m_attribs; }

Reference m_attribs.

Referenced by HtmlDocVisitor::operator() and setAttribs.

handleCite()

void DocPara::handleCite (char cmdChar, const QCString & cmdName)

Declaration at line 1100 of file docnode.h, definition at line 3397 of file docnode.cpp.

3397void DocPara::handleCite(char cmdChar,const QCString &cmdName)
3398{
3399 AUTO_TRACE();
3400 QCString saveCmdName = cmdName;
3401 // get the argument of the cite command.
3402 Token tok=parser()->tokenizer.lex();
3403
3404 CiteInfoOption option;
3405 if (tok.is(TokenRetval::TK_WORD) && parser()->context.token->name=="{")
3406 {
3408 parser()->tokenizer.lex();
3409 StringVector optList=split(parser()->context.token->name.str(),",");
3410 for (auto const &opt : optList)
3411 {
3412 if (opt == "number")
3413 {
3414 if (!option.isUnknown())
3415 {
3416 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Multiple options specified with \\{}, discarding '{}'", saveCmdName, opt);
3417 }
3418 else
3419 {
3421 }
3422 }
3423 else if (opt == "year")
3424 {
3425 if (!option.isUnknown())
3426 {
3427 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Multiple options specified with \\{}, discarding '{}'", saveCmdName, opt);
3428 }
3429 else
3430 {
3431 option = CiteInfoOption::makeYear();
3432 }
3433 }
3434 else if (opt == "shortauthor")
3435 {
3436 if (!option.isUnknown())
3437 {
3438 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Multiple options specified with \\{}, discarding '{}'", saveCmdName, opt);
3439 }
3440 else
3441 {
3443 }
3444 }
3445 else if (opt == "nopar")
3446 {
3447 option.setNoPar();
3448 }
3449 else if (opt == "nocite")
3450 {
3451 option.setNoCite();
3452 }
3453 else
3454 {
3455 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unknown option specified with \\{}, discarding '{}'", saveCmdName, opt);
3456 }
3457 }
3458
3459 if (option.isUnknown()) option.changeToNumber();
3460
3462 tok=parser()->tokenizer.lex();
3463 if (!tok.is(TokenRetval::TK_WHITESPACE))
3464 {
3465 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3466 saveCmdName);
3467 return;
3468 }
3469 }
3470 else if (!tok.is(TokenRetval::TK_WHITESPACE))
3471 {
3472 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
3473 cmdChar,saveCmdName);
3474 return;
3475 }
3476 else
3477 {
3479 }
3480
3482 tok=parser()->tokenizer.lex();
3483 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
3484 {
3485 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"THE ONE unexpected end of comment block while parsing the "
3486 "argument of command '{:c}{}'",cmdChar,saveCmdName);
3487 return;
3488 }
3489 else if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD))
3490 {
3491 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}'",
3492 tok.to_string(),cmdChar,saveCmdName);
3493 return;
3494 }
3498
3500}

References DocNodeList::append, AUTO_TRACE, CiteInfoOption::changeToNumber, DocCompoundNode::children, DocParser::context, DocParserContext::context, Token::is, Token::is_any_of, CiteInfoOption::isUnknown, DocTokenizer::lex, CiteInfoOption::makeNumber, CiteInfoOption::makeShortAuthor, CiteInfoOption::makeYear, TokenInfo::name, DocNode::parser, TokenInfo::sectionId, CiteInfoOption::setNoCite, CiteInfoOption::setNoPar, DocTokenizer::setStateCite, DocTokenizer::setStateOptions, DocTokenizer::setStatePara, split, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, warn and warn_doc_error.

Referenced by handleCommand.

handleCommand()

Token DocPara::handleCommand (char cmdChar, const QCString & cmdName)

Declaration at line 1090 of file docnode.h, definition at line 4154 of file docnode.cpp.

4154Token DocPara::handleCommand(char cmdChar, const QCString &cmdName)
4155{
4156 AUTO_TRACE("cmdName={}",cmdName);
4157 Token retval = Token::make_RetVal_OK();
4158 CommandType cmdId = Mappers::cmdMapper->map(cmdName);
4159 switch (cmdId)
4160 {
4162 {
4163 std::string str{cmdChar};
4164 children().append<DocWord>(parser(),thisVariant(),str.c_str() + cmdName);
4165 if (isAliasCmd(cmdName.view()))
4166 {
4167 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Found unexpanded alias '{:c}{}'. Check if number of arguments passed is correct.",cmdChar,cmdName);
4168 }
4169 else
4170 {
4171 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Found unknown command '{:c}{}'",cmdChar,cmdName);
4172 }
4173 }
4174 break;
4177 retval=parser()->handleStyleArgument(thisVariant(),children(),cmdName);
4179 if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," ");
4180 break;
4183 retval=parser()->handleStyleArgument(thisVariant(),children(),cmdName);
4185 if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," ");
4186 break;
4189 retval=parser()->handleStyleArgument(thisVariant(),children(),cmdName);
4191 if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," ");
4192 break;
4195 break;
4198 break;
4201 break;
4204 break;
4207 break;
4210 break;
4213 break;
4216 break;
4219 break;
4222 break;
4226 break;
4231 break;
4234 break;
4237 break;
4240 break;
4243 break;
4246 break;
4249 break;
4252 break;
4257 break;
4261 break;
4264 break;
4267 break;
4270 break;
4273 break;
4276 break;
4279 break;
4282 break;
4285 break;
4288 break;
4291 break;
4294 break;
4297 break;
4300 break;
4303 break;
4306 break;
4308 {
4310 retval = children().get_last<DocSimpleList>()->parse();
4311 }
4312 break;
4314 {
4315 handleSection(cmdChar,cmdName);
4316 retval = Token::make_RetVal_Section();
4317 }
4318 break;
4320 {
4321 handleSection(cmdChar,cmdName);
4322 retval = Token::make_RetVal_Subsection();
4323 }
4324 break;
4326 {
4327 handleSection(cmdChar,cmdName);
4328 retval = Token::make_RetVal_Subsubsection();
4329 }
4330 break;
4332 {
4333 handleSection(cmdChar,cmdName);
4334 retval = Token::make_RetVal_Paragraph();
4335 }
4336 break;
4338 {
4339 handleSection(cmdChar,cmdName);
4340 retval = Token::make_RetVal_SubParagraph();
4341 }
4342 break;
4344 {
4345 handleSection(cmdChar,cmdName);
4346 retval = Token::make_RetVal_SubSubParagraph();
4347 }
4348 break;
4350 {
4352 retval = handleStartCode();
4353 }
4354 break;
4356 {
4358 retval = handleStartCode();
4359 }
4360 break;
4362 {
4364 retval = parser()->tokenizer.lex();
4366 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4367 {
4368 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"htmlonly section ended without end marker");
4369 }
4371 }
4372 break;
4374 {
4376 retval = parser()->tokenizer.lex();
4378 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4379 {
4380 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"manonly section ended without end marker");
4381 }
4383 }
4384 break;
4386 {
4388 retval = parser()->tokenizer.lex();
4390 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4391 {
4392 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"rtfonly section ended without end marker");
4393 }
4395 }
4396 break;
4398 {
4400 retval = parser()->tokenizer.lex();
4402 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4403 {
4404 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"latexonly section ended without end marker");
4405 }
4407 }
4408 break;
4410 {
4412 retval = parser()->tokenizer.lex();
4414 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4415 {
4416 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"xmlonly section ended without end marker");
4417 }
4419 }
4420 break;
4422 {
4424 retval = parser()->tokenizer.lex();
4426 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4427 {
4428 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"docbookonly section ended without end marker");
4429 }
4431 }
4432 break;
4434 {
4437 parser()->tokenizer.lex();
4438
4439 QCString fullMatch = parser()->context.token->verb;
4440 int idx = fullMatch.find('{');
4441 int idxEnd = fullMatch.find("}",idx+1);
4442 StringVector optList;
4443 if (idx != -1) // options present
4444 {
4445 QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
4446 optList = split(optStr.str(),",");
4447 for (const auto &opt : optList)
4448 {
4449 if (opt.empty()) continue;
4450 QCString locOpt(opt);
4451 locOpt = locOpt.stripWhiteSpace().lower();
4452 if (locOpt == "code")
4453 {
4455 }
4456 else if (!locOpt.isEmpty())
4457 {
4458 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unknown option '{}' for '\\iliteral'",opt);
4459 }
4460 }
4461 }
4462
4464 retval = parser()->tokenizer.lex();
4466 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4467 {
4469 {
4470 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"javadoc code section ended without end marker");
4471 }
4472 else
4473 {
4474 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"javadoc literal section ended without end marker");
4475 }
4476 }
4478 }
4479 break;
4482 {
4483 if (cmdId == CommandType::CMD_VERBATIM)
4484 {
4486 }
4487 else
4488 {
4490 }
4491 retval = parser()->tokenizer.lex();
4493 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4494 {
4495 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"verbatim section ended without end marker");
4496 }
4498 }
4499 break;
4501 {
4510 QCString width,height;
4511 parser()->defaultHandleTitleAndSize(CommandType::CMD_DOT,&children().back(),dv->children(),width,height);
4513 retval = parser()->tokenizer.lex();
4514 dv->setText(parser()->context.token->verb);
4515 dv->setWidth(width);
4516 dv->setHeight(height);
4517 dv->setLocation(parser()->context.fileName,parser()->tokenizer.getLineNr());
4518 if (!Config_getBool(HAVE_DOT))
4519 {
4520 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"ignoring \\dot command because HAVE_DOT is not set");
4521 children().pop_back();
4522 }
4523 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4524 {
4525 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"dot section ended without end marker");
4526 }
4528 }
4529 break;
4531 {
4540 QCString width,height;
4541 parser()->defaultHandleTitleAndSize(CommandType::CMD_MSC,&children().back(),dv->children(),width,height);
4543 retval = parser()->tokenizer.lex();
4544 dv->setText(parser()->context.token->verb);
4545 dv->setWidth(width);
4546 dv->setHeight(height);
4547 dv->setLocation(parser()->context.fileName,parser()->tokenizer.getLineNr());
4548 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4549 {
4550 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"msc section ended without end marker");
4551 }
4553 }
4554 break;
4556 {
4557 QCString jarPath = Config_getString(PLANTUML_JAR_PATH);
4559 parser()->tokenizer.lex();
4560 QCString fullMatch = parser()->context.token->sectionId;
4561 QCString sectionId = "";
4562 int idx = fullMatch.find('{');
4563 int idxEnd = fullMatch.find("}",idx+1);
4564 StringVector optList;
4565 QCString engine;
4566 if (idx != -1) // options present
4567 {
4568 QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
4569 optList = split(optStr.str(),",");
4570 for (const auto &opt : optList)
4571 {
4572 if (opt.empty()) continue;
4573 bool found = false;
4574 QCString locOpt(opt);
4575 locOpt = locOpt.stripWhiteSpace().lower();
4576 if (g_plantumlEngine.find(locOpt.str())!=g_plantumlEngine.end())
4577 {
4578 if (!engine.isEmpty())
4579 {
4580 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Multiple definition of engine for '\\startuml'");
4581 }
4582 engine = locOpt;
4583 found = true;
4584 }
4585 if (!found)
4586 {
4587 if (sectionId.isEmpty())
4588 {
4589 sectionId = opt;
4590 }
4591 else
4592 {
4593 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Multiple use of filename for '\\startuml'");
4594 }
4595 }
4596 }
4597 }
4598 else
4599 {
4600 sectionId = parser()->context.token->sectionId;
4601 }
4602 if (engine.isEmpty()) engine = "uml";
4603
4604 if (sectionId.isEmpty())
4605 {
4607 retval = parser()->tokenizer.lex();
4608 assert(retval.is(TokenRetval::RetVal_OK));
4609
4610 sectionId = parser()->context.token->sectionId;
4611 sectionId = sectionId.stripWhiteSpace();
4612 }
4613
4614 QCString plantFile(sectionId);
4619 FALSE,plantFile);
4621 dv->setEngine(engine);
4623 QCString width,height;
4624 parser()->defaultHandleTitleAndSize(CommandType::CMD_STARTUML,&children().back(),dv->children(),width,height);
4626 retval = parser()->tokenizer.lex();
4627 int line = 0;
4628 QCString trimmedVerb = stripLeadingAndTrailingEmptyLines(parser()->context.token->verb,line);
4629 if (engine == "ditaa")
4630 {
4631 dv->setUseBitmap(true);
4632 }
4633 else if (engine == "uml")
4634 {
4635 int i = trimmedVerb.find('\n');
4636 QCString firstLine = i==-1 ? trimmedVerb : trimmedVerb.left(i);
4637 if (firstLine.stripWhiteSpace() == "ditaa") dv->setUseBitmap(true);
4638 }
4639 dv->setText(trimmedVerb);
4640 dv->setWidth(width);
4641 dv->setHeight(height);
4642 dv->setLocation(parser()->context.fileName,parser()->tokenizer.getLineNr());
4643 if (jarPath.isEmpty())
4644 {
4645 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"ignoring \\startuml command because PLANTUML_JAR_PATH is not set");
4646 children().pop_back();
4647 }
4648 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4649 {
4650 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"startuml section ended without end marker");
4651 }
4653 }
4654 break;
4656 retval = Token::make_RetVal_EndParBlock();
4657 break;
4673 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command {}",parser()->context.token->name);
4674 break;
4676 retval = handleParamSection(cmdName,DocParamSect::Param,FALSE,parser()->context.token->paramDir);
4677 break;
4679 retval = handleParamSection(cmdName,DocParamSect::TemplateParam,FALSE,parser()->context.token->paramDir);
4680 break;
4683 break;
4686 break;
4688 retval = handleXRefItem();
4689 break;
4691 {
4693 }
4694 break;
4697 {
4699 }
4700 break;
4702 {
4704 }
4705 break;
4707 {
4711 retval = children().get_last<DocIndexEntry>()->parse();
4712 }
4713 break;
4715 retval = Token::make_RetVal_Internal();
4716 break;
4718 retval = Token::make_RetVal_EndInternal();
4719 break;
4721 {
4723 retval = children().get_last<DocParBlock>()->parse();
4724 }
4725 break;
4726 case CommandType::CMD_COPYDOC: // fall through
4727 case CommandType::CMD_COPYBRIEF: // fall through
4729 //retval = Token::make_RetVal_CopyDoc();
4730 // these commands should already be resolved by processCopyDoc()
4731 break;
4734 break;
4737 break;
4740 break;
4743 break;
4746 break;
4749 break;
4752 break;
4755 break;
4758 break;
4761 break;
4764 break;
4767 break;
4770 break;
4773 break;
4776 break;
4779 break;
4782 break;
4784 if (!Config_getBool(HAVE_DOT))
4785 {
4786 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
4787 "ignoring \\dotfile command because HAVE_DOT is not set");
4788 }
4789 else
4790 {
4791 handleFile<DocDotFile>(cmdName);
4792 }
4793 break;
4796 break;
4798 handleFile<DocMscFile>(cmdName);
4799 break;
4801 handleFile<DocDiaFile>(cmdName);
4802 break;
4805 break;
4807 handleLink(cmdName,FALSE);
4808 break;
4810 handleLink(cmdName,TRUE);
4811 break;
4813 handleCite(cmdChar,cmdName);
4814 break;
4816 handleEmoji(cmdChar,cmdName);
4817 break;
4819 handleDoxyConfig(cmdChar,cmdName);
4820 break;
4821 case CommandType::CMD_REF: // fall through
4823 handleRef(cmdChar,cmdName);
4824 break;
4826 {
4829 }
4830 break;
4832 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command '{:c}{}'",cmdChar,parser()->context.token->name);
4833 break;
4835 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command '{:c}{}'",cmdChar,parser()->context.token->name);
4836 break;
4838 {
4840 }
4841 break;
4842 //case CommandType::CMD_LANGSWITCH:
4843 // retval = handleLanguageSwitch();
4844 // break;
4846 //warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command {}",parser()->context.token->name);
4847 {
4850 }
4851 break;
4854 break;
4856 handleShowDate(cmdChar,cmdName);
4857 break;
4859 handleILine(cmdChar,cmdName);
4860 break;
4862 handleIFile(cmdChar,cmdName);
4863 break;
4865 {
4867 (void)parser()->tokenizer.lex();
4869 //printf("Found scope='%s'\n",qPrint(parser()->context.context));
4871 }
4872 break;
4873 default:
4874 // we should not get here!
4875 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command '{}' in paragraph context",cmdName);
4876 break;
4877 }
4878 INTERNAL_ASSERT(retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_OK,TokenRetval::RetVal_SimpleSec
4879 TokenRetval::TK_LISTITEM,TokenRetval::TK_ENDLIST,TokenRetval::TK_NEWPARA
4880 TokenRetval::RetVal_Section,TokenRetval::RetVal_EndList
4881 TokenRetval::RetVal_Internal,TokenRetval::RetVal_SwitchLang
4882 TokenRetval::RetVal_EndInternal)
4883 );
4884 AUTO_TRACE_EXIT("retval={}",retval.to_string());
4885 return retval;
4886}

References DocNodeList::append, DocSimpleSect::Attention, DocSimpleSect::Author, DocSimpleSect::Authors, AUTO_TRACE, AUTO_TRACE_EXIT, DocStyleChange::Bold, DocCompoundNode::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_DOCBOOKINCLUDE, CMD_DOLLAR, CMD_DONTINCLUDE, CMD_DOT, CMD_DOTFILE, CMD_DOXYCONFIG, CMD_EMOJI, CMD_EMPHASIS, CMD_ENDCODE, CMD_ENDDBONLY, CMD_ENDDOT, CMD_ENDHTMLONLY, CMD_ENDICODE, CMD_ENDILITERAL, CMD_ENDINTERNAL, CMD_ENDIVERBATIM, CMD_ENDLATEXONLY, CMD_ENDLINK, CMD_ENDMANONLY, CMD_ENDMSC, CMD_ENDPARBLOCK, CMD_ENDRTFONLY, CMD_ENDSECREFLIST, CMD_ENDUML, CMD_ENDVERBATIM, CMD_ENDXMLONLY, CMD_EQUAL, CMD_EXCEPTION, CMD_EXCLAMATION, CMD_FORMULA, CMD_GREATER, CMD_HASH, CMD_HTMLINCLUDE, CMD_HTMLONLY, CMD_IANCHOR, CMD_IFILE, CMD_ILINE, CMD_ILITERAL, CMD_IMAGE, CMD_IMPORTANT, CMD_INCLUDE, CMD_INCWITHLINES, CMD_INHERITDOC, CMD_INTERNAL, CMD_INTERNALREF, CMD_INVARIANT, CMD_IPREFIX, CMD_ISTARTCODE, CMD_IVERBATIM, CMD_JAVALINK, CMD_LATEXINCLUDE, CMD_LATEXONLY, CMD_LESS, CMD_LI, CMD_LINE, CMD_LINEBREAK, CMD_LINK, CMD_MANINCLUDE, 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_PLANTUMLFILE, CMD_PLUS, CMD_POST, CMD_PRE, CMD_PUNT, CMD_QUESTION, CMD_QUOTE, CMD_REF, CMD_REMARK, CMD_RETURN, CMD_RETVAL, CMD_RTFINCLUDE, CMD_RTFONLY, CMD_SA, CMD_SECREFITEM, CMD_SECREFLIST, CMD_SECTION, CMD_SETSCOPE, CMD_SHOWDATE, CMD_SINCE, CMD_SKIP, CMD_SKIPLINE, CMD_SNIPPET, CMD_SNIPWITHLINES, CMD_STARTCODE, CMD_STARTUML, CMD_SUBPAGE, CMD_SUBPARAGRAPH, CMD_SUBSECTION, CMD_SUBSUBPARAGRAPH, CMD_SUBSUBSECTION, CMD_TPARAM, CMD_UNTIL, CMD_VERBATIM, CMD_VERBINCLUDE, CMD_VERSION, CMD_VHDLFLOW, CMD_WARNING, CMD_XMLINCLUDE, CMD_XMLONLY, CMD_XREFITEM, Mappers::cmdMapper, DocStyleChange::Code, Config_getBool, Config_getString, DocParser::context, DocParserContext::context, DocSimpleSect::Copyright, DocSimpleSect::Date, DocParser::defaultHandleTitleAndSize, DocInclude::DocbookInclude, DocVerbatim::DocbookOnly, DocInclude::DontInclude, DocVerbatim::Dot, DocParserContext::exampleName, DocParamSect::Exception, FALSE, QCString::find, g_plantumlEngine, DocNodeList::get_last, Doxygen::globalScope, DocParser::handleAnchor, handleCite, handleDoxyConfig, handleEmoji, handleFile, handleIFile, handleILine, DocParser::handleImage, handleInclude, handleIncludeOperator, handleInheritDoc, DocParser::handleInternalRef, handleLink, handleParamSection, DocParser::handlePrefix, handleRef, handleSection, handleShowDate, handleSimpleSection, handleStartCode, DocParser::handleStyleArgument, handleVhdlFlow, handleXRefItem, DocParserContext::hasReturnCommand, DocInclude::HtmlInclude, DocVerbatim::HtmlOnly, TokenInfo::id, DocSimpleSect::Important, DocInclude::Include, DocInclude::IncWithLines, DocParserContext::inSeeBlock, INTERNAL_ASSERT, DocSimpleSect::Invar, Token::is_any_of, isAliasCmd, QCString::isEmpty, DocParserContext::isExample, DocStyleChange::Italic, DocVerbatim::JavaDocCode, DocVerbatim::JavaDocLiteral, DocInclude::LatexInclude, DocVerbatim::LatexOnly, QCString::left, DocTokenizer::lex, DocIncOperator::Line, QCString::lower, DocInclude::ManInclude, DocVerbatim::ManOnly, DocParserContext::memberDef, QCString::mid, DocVerbatim::Msc, TokenInfo::name, DocParserContext::nodeStack, DocSimpleSect::Note, DocParamSect::Param, parse, DocNode::parser, DocVerbatim::PlantUML, GrowVector< T >::pop_back, DocSimpleSect::Post, DocSimpleSect::Pre, DocSimpleSect::Remark, DocSimpleSect::Return, DocParamSect::RetVal, DocInclude::RtfInclude, DocVerbatim::RtfOnly, DocParserContext::scope, TokenInfo::sectionId, DocSimpleSect::See, DocVerbatim::setEngine, DocTokenizer::setStateCode, DocTokenizer::setStateDbOnly, DocTokenizer::setStateDot, DocTokenizer::setStateHtmlOnly, DocTokenizer::setStateICode, DocTokenizer::setStateILiteral, DocTokenizer::setStateILiteralOpt, DocTokenizer::setStateIVerbatim, DocTokenizer::setStateLatexOnly, DocTokenizer::setStateManOnly, DocTokenizer::setStateMsc, DocTokenizer::setStatePara, DocTokenizer::setStatePlantUML, DocTokenizer::setStatePlantUMLOpt, DocTokenizer::setStateRtfOnly, DocTokenizer::setStateSetScope, DocTokenizer::setStateVerbatim, DocTokenizer::setStateXmlOnly, DocSimpleSect::Since, DocIncOperator::Skip, DocIncOperator::SkipLine, DocInclude::Snippet, DocInclude::SnippetWithLines, split, QCString::str, stripLeadingAndTrailingEmptyLines, QCString::stripWhiteSpace, HtmlEntityMapper::Sym_Amp, HtmlEntityMapper::Sym_At, HtmlEntityMapper::Sym_BSlash, HtmlEntityMapper::Sym_Dollar, HtmlEntityMapper::Sym_Dot, HtmlEntityMapper::Sym_DoubleColon, HtmlEntityMapper::Sym_Equal, HtmlEntityMapper::Sym_Exclam, HtmlEntityMapper::Sym_Greater, HtmlEntityMapper::Sym_Hash, HtmlEntityMapper::Sym_Less, HtmlEntityMapper::Sym_Minus, HtmlEntityMapper::Sym_Percent, HtmlEntityMapper::Sym_Pipe, HtmlEntityMapper::Sym_Plus, HtmlEntityMapper::Sym_Quest, HtmlEntityMapper::Sym_Quot, DocParamSect::TemplateParam, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, TRUE, UNKNOWN, DocIncOperator::Until, DocSimpleSect::User, TokenInfo::verb, DocVerbatim::Verbatim, DocInclude::VerbInclude, DocSimpleSect::Version, QCString::view, warn, warn_doc_error, DocSimpleSect::Warning, DocInclude::XmlInclude and DocVerbatim::XmlOnly.

Referenced by parse.

handleDoxyConfig()

void DocPara::handleDoxyConfig (char cmdChar, const QCString & cmdName)

Declaration at line 1101 of file docnode.h, definition at line 3533 of file docnode.cpp.

3533void DocPara::handleDoxyConfig(char cmdChar,const QCString &cmdName)
3534{
3535 // get the argument of the cite command.
3536 Token tok=parser()->tokenizer.lex();
3537 if (!tok.is(TokenRetval::TK_WHITESPACE))
3538 {
3539 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
3540 cmdChar,cmdName);
3541 return;
3542 }
3544 tok=parser()->tokenizer.lex();
3545 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
3546 {
3547 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the "
3548 "argument of command '{:c}{}'",cmdChar,cmdName);
3549 return;
3550 }
3551 else if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD))
3552 {
3553 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}'",
3554 tok.to_string(),cmdChar,cmdName);
3555 return;
3556 }
3557 ConfigOption * opt = ConfigImpl::instance()->get(parser()->context.token->name);
3558 if (opt)
3559 {
3560 QCString optionValue;
3561 switch (opt->kind())
3562 {
3564 optionValue = *(static_cast<ConfigBool*>(opt)->valueStringRef());
3565 break;
3567 optionValue = *(static_cast<ConfigString*>(opt)->valueRef());
3568 break;
3570 optionValue = *(static_cast<ConfigEnum*>(opt)->valueRef());
3571 break;
3573 optionValue = *(static_cast<ConfigInt*>(opt)->valueStringRef());
3574 break;
3576 {
3577 StringVector *lst = static_cast<ConfigList*>(opt)->valueRef();
3578 optionValue="";
3579 if (!lst->empty())
3580 {
3581 std::string lstFormat = theTranslator->trWriteList(static_cast<int>(lst->size())).str();
3582 static const reg::Ex marker(R"(@(\d+))");
3583 reg::Iterator it(lstFormat,marker);
3585 size_t index=0;
3586 // now replace all markers with the real text
3587 for ( ; it!=end ; ++it)
3588 {
3589 const auto &match = *it;
3590 size_t newIndex = match.position();
3591 size_t matchLen = match.length();
3592 optionValue += lstFormat.substr(index,newIndex-index);
3593 unsigned long entryIndex = std::stoul(match[1].str());
3594 if (entryIndex<(unsigned long)lst->size())
3595 {
3596 optionValue += lst->at(entryIndex);
3597 }
3598 index=newIndex+matchLen;
3599 }
3600 optionValue+=lstFormat.substr(index);
3601 }
3602 }
3603 break;
3605 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Obsolete setting for '{:c}{}': '{}'",
3606 cmdChar,cmdName,parser()->context.token->name);
3607 break;
3609 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),
3610 "Disabled setting (i.e. not supported in this doxygen executable) for '{:c}{}': '{}'",
3611 cmdChar,cmdName,parser()->context.token->name);
3612 break;
3614 // nothing to show here
3615 break;
3616 }
3617 if (!optionValue.isEmpty())
3618 {
3619 children().append<DocWord>(parser(),thisVariant(),optionValue);
3620 }
3621 }
3622 else
3623 {
3624 warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unknown option for '{:c}{}': '{}'",
3625 cmdChar,cmdName,parser()->context.token->name);
3627 }
3629}

References DocNodeList::append, DocCompoundNode::children, DocParser::context, end, ConfigImpl::get, ConfigImpl::instance, Token::is, Token::is_any_of, QCString::isEmpty, ConfigOption::kind, DocTokenizer::lex, TokenInfo::name, ConfigOption::O_Bool, ConfigOption::O_Disabled, ConfigOption::O_Enum, ConfigOption::O_Info, ConfigOption::O_Int, ConfigOption::O_List, ConfigOption::O_Obsolete, ConfigOption::O_String, DocNode::parser, DocTokenizer::setStateDoxyConfig, DocTokenizer::setStatePara, theTranslator, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, ConfigEnum::valueRef, ConfigString::valueRef, ConfigBool::valueStringRef, ConfigInt::valueStringRef, warn and warn_doc_error.

Referenced by handleCommand.

handleEmoji()

void DocPara::handleEmoji (char cmdChar, const QCString & cmdName)

Declaration at line 1102 of file docnode.h, definition at line 3502 of file docnode.cpp.

3502void DocPara::handleEmoji(char cmdChar,const QCString &cmdName)
3503{
3504 AUTO_TRACE();
3505 // get the argument of the emoji command.
3506 Token tok=parser()->tokenizer.lex();
3507 if (!tok.is(TokenRetval::TK_WHITESPACE))
3508 {
3509 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
3510 cmdChar,cmdName);
3511 return;
3512 }
3514 tok=parser()->tokenizer.lex();
3515 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
3516 {
3517 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"no emoji name given or unexpected end of comment block while parsing the "
3518 "argument of command '{:c}{}'",cmdChar,cmdName);
3520 return;
3521 }
3522 else if (!tok.is(TokenRetval::TK_WORD))
3523 {
3524 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}'",
3525 tok.to_string(),cmdChar,cmdName);
3527 return;
3528 }
3531}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocParser::context, Token::is, Token::is_any_of, DocTokenizer::lex, TokenInfo::name, DocNode::parser, DocTokenizer::setStateEmoji, DocTokenizer::setStatePara, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleFile()

template <class T>
void DocPara::handleFile (const QCString & cmdName)

Declaration at line 1097 of file docnode.h, definition at line 3820 of file docnode.cpp.

3820void DocPara::handleFile(const QCString &cmdName)
3821{
3822 AUTO_TRACE("cmdName={}",cmdName);
3823 QCString saveCmdName = cmdName;
3824 Token tok=parser()->tokenizer.lex();
3825 if (!tok.is(TokenRetval::TK_WHITESPACE))
3826 {
3827 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3828 saveCmdName);
3829 return;
3830 }
3832 tok=parser()->tokenizer.lex();
3834 if (!tok.is(TokenRetval::TK_WORD))
3835 {
3836 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of {}",
3837 tok.to_string(),saveCmdName);
3838 return;
3839 }
3840 QCString name = parser()->context.token->name;
3841 children().append<T>(parser(),thisVariant(),name,
3845 auto df = children().get_last<T>();
3846 if (!df->parse())
3847 {
3848 children().pop_back();
3849 }
3850}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocParser::context, DocParserContext::context, DocParserContext::fileName, DocNodeList::get_last, DocTokenizer::getLineNr, Token::is, DocTokenizer::lex, TokenInfo::name, DocNode::parser, GrowVector< T >::pop_back, DocTokenizer::setStateFile, DocTokenizer::setStatePara, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleHtmlEndTag()

Token DocPara::handleHtmlEndTag (const QCString & tagName)

Declaration at line 1092 of file docnode.h, definition at line 5377 of file docnode.cpp.

5378{
5379 AUTO_TRACE("tagName={}",tagName);
5380 HtmlTagType tagId = Mappers::htmlTagMapper->map(tagName);
5381 Token retval = Token::make_RetVal_OK();
5382 switch (tagId)
5383 {
5385 if (!insideUL(thisVariant()))
5386 {
5387 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </ul> tag without matching <ul>");
5388 }
5389 else
5390 {
5391 retval = Token::make_RetVal_EndList();
5392 }
5393 break;
5395 if (!insideOL(thisVariant()))
5396 {
5397 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </ol> tag without matching <ol>");
5398 }
5399 else
5400 {
5401 retval = Token::make_RetVal_EndList();
5402 }
5403 break;
5405 if (!insideLI(thisVariant()))
5406 {
5407 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </li> tag without matching <li>");
5408 }
5409 else
5410 {
5411 // ignore </li> tags
5412 }
5413 break;
5416 {
5417 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </details> tag without matching <details>");
5418 }
5419 else
5420 {
5421 retval = Token::make_RetVal_EndHtmlDetails();
5422 }
5423 break;
5426 {
5427 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </blockquote> tag without matching <blockquote>");
5428 }
5429 else
5430 {
5431 retval = Token::make_RetVal_EndBlockQuote();
5432 }
5433 break;
5436 break;
5439 break;
5442 break;
5445 break;
5448 break;
5451 break;
5454 break;
5457 break;
5460 break;
5463 break;
5466 break;
5469 break;
5472 break;
5475 break;
5478 break;
5481 break;
5484 break;
5489 break;
5491 retval = Token::make_TK_NEWPARA();
5492 break;
5494 retval = Token::make_RetVal_EndDesc();
5495 break;
5497 // ignore </dt> tag
5498 break;
5500 // ignore </dd> tag
5501 break;
5503 retval = Token::make_RetVal_EndTable();
5504 break;
5506 retval = Token::make_RetVal_EndTableRow();
5507 break;
5509 retval = Token::make_RetVal_EndTableCell();
5510 break;
5512 retval = Token::make_RetVal_EndTableCell();
5513 break;
5517 // for time being ignore </t....> tag
5518 break;
5520 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </caption> found");
5521 break;
5523 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal </br> tag found");
5524 break;
5526 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h1> found");
5527 break;
5529 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h2> found");
5530 break;
5532 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h3> found");
5533 break;
5535 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h4> found");
5536 break;
5538 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h5> found");
5539 break;
5541 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h6> found");
5542 break;
5544 break;
5546 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal </hr> tag found");
5547 break;
5549 //warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </a> found");
5550 // ignore </a> tag (can be part of <a name=...></a>
5551 break;
5552
5554 break;
5556 retval = Token::make_TK_NEWPARA();
5557 break;
5570 retval = Token::make_RetVal_CloseXml();
5571 break;
5574 break;
5582 // These tags are defined in .Net but are currently unsupported
5583 break;
5585 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported xml/html tag </{}> found", tagName);
5586 children().append<DocWord>(parser(),thisVariant(),"</"+tagName+">");
5587 break;
5588 default:
5589 // we should not get here!
5590 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end tag {}",tagName);
5591 ASSERT(0);
5592 break;
5593 }
5594 AUTO_TRACE_EXIT("retval={}",retval.to_string());
5595 return retval;
5596}

References DocNodeList::append, ASSERT, AUTO_TRACE, AUTO_TRACE_EXIT, DocStyleChange::Bold, DocStyleChange::Center, DocCompoundNode::children, DocStyleChange::Cite, DocStyleChange::Code, DocStyleChange::Del, DocStyleChange::Div, FALSE, DocParser::handleStyleLeave, HTML_A, HTML_BLOCKQUOTE, HTML_BOLD, HTML_BR, HTML_CAPTION, HTML_CENTER, HTML_CITE, HTML_CODE, HTML_DD, HTML_DEL, HTML_DETAILS, 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_INS, HTML_KBD, HTML_LI, HTML_OL, HTML_P, HTML_PRE, HTML_S, HTML_SMALL, HTML_SPAN, HTML_STRIKE, HTML_SUB, HTML_SUP, HTML_TABLE, HTML_TBODY, HTML_TD, HTML_TFOOT, HTML_TH, HTML_THEAD, HTML_TR, HTML_TT, HTML_UL, HTML_UNDERLINE, Mappers::htmlTagMapper, DocStyleChange::Ins, insideBlockQuote, insideDetails, insideLI, insideOL, insideUL, DocStyleChange::Italic, DocStyleChange::Kbd, DocNode::parser, DocStyleChange::Preformatted, DocStyleChange::S, DocTokenizer::setInsidePre, DocNode::setInsidePreformatted, DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Strike, DocStyleChange::Subscript, DocStyleChange::Superscript, DocNode::thisVariant, Token::to_string, DocParser::tokenizer, DocStyleChange::Typewriter, DocStyleChange::Underline, UNKNOWN, 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.

handleHtmlHeader()

Token DocPara::handleHtmlHeader (const HtmlAttribList & tagHtmlAttribs, int level)

Declaration at line 1111 of file docnode.h, definition at line 4063 of file docnode.cpp.

4063Token DocPara::handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level)
4064{
4065 AUTO_TRACE();
4066 children().append<DocHtmlHeader>(parser(),thisVariant(),tagHtmlAttribs,level);
4067 Token retval = children().get_last<DocHtmlHeader>()->parse();
4068 return retval.is(TokenRetval::RetVal_OK) ? Token::make_TK_NEWPARA() : retval;
4069}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocNodeList::get_last, parse, DocNode::parser and DocNode::thisVariant.

Referenced by handleHtmlStartTag.

handleHtmlStartTag()

Token DocPara::handleHtmlStartTag (const QCString & tagName, const HtmlAttribList & tagHtmlAttribs)

Declaration at line 1091 of file docnode.h, definition at line 4904 of file docnode.cpp.

4904Token DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &tagHtmlAttribs)
4905{
4906 AUTO_TRACE("tagName={} #tagHtmlAttrs={}",tagName,tagHtmlAttribs.size());
4907 Token retval = Token::make_RetVal_OK();
4908 HtmlTagType tagId = Mappers::htmlTagMapper->map(tagName);
4909 if (parser()->context.token->emptyTag && !(tagId>HtmlTagType::XML_CmdMask) &&
4912 {
4913 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"HTML tag ('<{}/>') may not use the 'empty tag' XHTML syntax.",
4914 tagName);
4915 }
4916 switch (tagId)
4917 {
4919 if (!parser()->context.token->emptyTag)
4920 {
4922 tagHtmlAttribs,DocHtmlList::Unordered);
4923 retval=children().get_last<DocHtmlList>()->parse();
4924 }
4925 break;
4927 if (!parser()->context.token->emptyTag)
4928 {
4930 tagHtmlAttribs,DocHtmlList::Ordered);
4931 retval=children().get_last<DocHtmlList>()->parse();
4932 }
4933 break;
4935 if (parser()->context.token->emptyTag) break;
4937 {
4938 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"lonely <li> tag found");
4939 }
4940 else
4941 {
4942 retval = Token::make_RetVal_ListItem();
4943 }
4944 break;
4946 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Bold,tagName,&parser()->context.token->attribs);
4947 break;
4949 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::S,tagName,&parser()->context.token->attribs);
4950 break;
4952 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Strike,tagName,&parser()->context.token->attribs);
4953 break;
4955 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Del,tagName,&parser()->context.token->attribs);
4956 break;
4958 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Underline,tagName,&parser()->context.token->attribs);
4959 break;
4961 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Ins,tagName,&parser()->context.token->attribs);
4962 break;
4964 if (parser()->context.token->emptyTag) break;
4965 if (parser()->context.xmlComment)
4966 // for C# source or inside a <summary> or <remark> section we
4967 // treat <code> as an XML tag (so similar to @code)
4968 {
4970 retval = handleStartCode();
4971 }
4972 else // normal HTML markup
4973 {
4974 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Code,tagName,&parser()->context.token->attribs);
4975 }
4976 break;
4978 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Kbd,tagName,&parser()->context.token->attribs);
4979 break;
4981 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Typewriter,tagName,&parser()->context.token->attribs);
4982 break;
4984 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Italic,tagName,&parser()->context.token->attribs);
4985 break;
4987 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Div,tagName,&parser()->context.token->attribs);
4988 if (parser()->context.token->emptyTag) parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Div,tagName);
4989 break;
4991 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Span,tagName,&parser()->context.token->attribs);
4992 if (parser()->context.token->emptyTag) parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Span,tagName);
4993 break;
4995 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Subscript,tagName,&parser()->context.token->attribs);
4996 break;
4998 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Superscript,tagName,&parser()->context.token->attribs);
4999 break;
5001 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Center,tagName,&parser()->context.token->attribs);
5002 break;
5004 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Small,tagName,&parser()->context.token->attribs);
5005 break;
5007 if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Cite,tagName,&parser()->context.token->attribs);
5008 break;
5010 if (parser()->context.token->emptyTag) break;
5011 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Preformatted,tagName,&parser()->context.token->attribs);
5014 break;
5016 retval = Token::make_TK_NEWPARA();
5017 break;
5019 if (!parser()->context.token->emptyTag)
5020 {
5021 children().append<DocHtmlDescList>(parser(),thisVariant(),tagHtmlAttribs);
5022 retval=children().get_last<DocHtmlDescList>()->parse();
5023 }
5024 break;
5026 if (insideDL(thisVariant()))
5027 {
5028 retval = Token::make_RetVal_DescTitle();
5029 }
5030 else
5031 {
5032 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag <dt> found");
5033 }
5034 break;
5036 if (insideDL(thisVariant()))
5037 {
5038 retval = Token::make_RetVal_DescData();
5039 }
5040 else
5041 {
5042 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag <dd> found");
5043 }
5044 break;
5046 if (!parser()->context.token->emptyTag)
5047 {
5048 children().append<DocHtmlTable>(parser(),thisVariant(),tagHtmlAttribs);
5049 retval=children().get_last<DocHtmlTable>()->parse();
5050 if (children().get_last<DocHtmlTable>()->children().empty()) children().pop_back();
5051 }
5052 break;
5054 retval = Token::make_RetVal_TableRow();
5055 break;
5057 retval = Token::make_RetVal_TableCell();
5058 break;
5060 retval = Token::make_RetVal_TableHCell();
5061 break;
5065 // for time being ignore </t....> tag
5066 break;
5068 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag <caption> found");
5069 break;
5071 {
5072 children().append<DocLineBreak>(parser(),thisVariant(),tagHtmlAttribs);
5073 }
5074 break;
5076 {
5077 children().append<DocHorRuler>(parser(),thisVariant(),tagHtmlAttribs);
5078 }
5079 break;
5081 retval = parser()->handleAHref(thisVariant(),children(),tagHtmlAttribs);
5082 break;
5084 if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,1);
5085 break;
5087 if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,2);
5088 break;
5090 if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,3);
5091 break;
5093 if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,4);
5094 break;
5096 if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,5);
5097 break;
5099 if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,6);
5100 break;
5102 {
5103 parser()->handleImg(thisVariant(),children(),tagHtmlAttribs);
5104 }
5105 break;
5107 if (!parser()->context.token->emptyTag)
5108 {
5109 children().append<DocHtmlDetails>(parser(),thisVariant(),tagHtmlAttribs);
5110 retval=children().get_last<DocHtmlDetails>()->parse();
5111 }
5112 break;
5114 if (!parser()->context.token->emptyTag)
5115 {
5116 children().append<DocHtmlBlockQuote>(parser(),thisVariant(),tagHtmlAttribs);
5117 retval = children().get_last<DocHtmlBlockQuote>()->parse();
5118 }
5119 break;
5120
5123 {
5124 if (!parser()->context.token->emptyTag)
5125 {
5127 while (n && !std::holds_alternative<DocHtmlDetails>(*n)) n=::parent(n);
5128 DocHtmlDetails *d = std::get_if<DocHtmlDetails>(n);
5129 if (d)
5130 {
5131 if (!d->summary()) // details section does not have a summary yet
5132 {
5133 d->parseSummary(n,parser()->context.token->attribs);
5134 }
5135 else
5136 {
5137 retval = Token::make_TK_NEWPARA();
5138 }
5139 }
5140 }
5141 }
5142 break;
5146 // fall through
5149 if (!children().empty())
5150 {
5151 retval = Token::make_TK_NEWPARA();
5152 }
5153 break;
5156 {
5157 retval = Token::make_RetVal_TableCell();
5158 }
5159 break;
5161 parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Code,tagName,&parser()->context.token->attribs);
5162 break;
5165 {
5167 QCString paramName;
5168 if (findAttribute(tagHtmlAttribs,"name",&paramName))
5169 {
5170 if (paramName.isEmpty())
5171 {
5172 if (Config_getBool(WARN_NO_PARAMDOC))
5173 {
5174 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"empty 'name' attribute for <param{}> tag.",tagId==HtmlTagType::XML_PARAM?"":"type");
5175 }
5176 }
5177 else
5178 {
5179 retval = handleParamSection(paramName,
5181 TRUE);
5182 }
5183 }
5184 else
5185 {
5186 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'name' attribute from <param{}> tag.",tagId==HtmlTagType::XML_PARAM?"":"type");
5187 }
5188 }
5189 break;
5192 {
5193 QCString paramName;
5194 if (findAttribute(tagHtmlAttribs,"name",&paramName))
5195 {
5196 //printf("paramName=%s\n",qPrint(paramName));
5198 children().append<DocWord>(parser(),thisVariant(),paramName);
5200 if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," ");
5201 }
5202 else
5203 {
5204 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'name' attribute from <param{}ref> tag.",tagId==HtmlTagType::XML_PARAMREF?"":"type");
5205 }
5206 }
5207 break;
5209 {
5211 QCString exceptName;
5212 if (findAttribute(tagHtmlAttribs,"cref",&exceptName))
5213 {
5214 unescapeCRef(exceptName);
5216 }
5217 else
5218 {
5219 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'cref' attribute from <exception> tag.");
5220 }
5221 }
5222 break;
5226 {
5227 retval = Token::make_RetVal_TableRow();
5228 }
5229 else if (insideUL(thisVariant()) || insideOL(thisVariant()))
5230 {
5231 retval = Token::make_RetVal_ListItem();
5232 }
5233 else
5234 {
5235 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"lonely <item> tag found");
5236 }
5237 break;
5242 break;
5245 {
5246 retval = Token::make_RetVal_TableCell();
5247 }
5248 break;
5250 // I'm not sure if <see> is the same as <seealso> or if it
5251 // should you link a member without producing a section. The
5252 // C# specification is extremely vague about this (but what else
5253 // can we expect from Microsoft...)
5254 {
5255 QCString cref;
5256 //printf("HtmlTagType::XML_SEE: empty tag=%d\n",parser()->context.token->emptyTag);
5257 if (findAttribute(tagHtmlAttribs,"cref",&cref))
5258 {
5259 unescapeCRef(cref);
5260 if (parser()->context.token->emptyTag) // <see cref="..."/> style
5261 {
5262 bool inSeeBlock = parser()->context.inSeeBlock;
5263 parser()->context.token->name = cref;
5266 parser()->context.inSeeBlock = inSeeBlock;
5267 }
5268 else // <see cref="...">...</see> style
5269 {
5270 //DocRef *ref = new DocRef(this,cref);
5271 //children().append(ref);
5272 //ref->parse();
5275 DocLink *lnk = children().get_last<DocLink>();
5276 QCString leftOver = lnk->parse(FALSE,TRUE);
5277 if (!leftOver.isEmpty())
5278 {
5279 children().append<DocWord>(parser(),thisVariant(),leftOver);
5280 }
5281 }
5282 }
5283 else if (findAttribute(tagHtmlAttribs,"langword",&cref)) // <see langword="..."/> or <see langword="..."></see>
5284 {
5285 bool inSeeBlock = parser()->context.inSeeBlock;
5286 parser()->context.token->name = cref;
5291 parser()->context.inSeeBlock = inSeeBlock;
5292 }
5293 else
5294 {
5295 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'cref' or 'langword' attribute from <see> tag.");
5296 }
5297 }
5298 break;
5300 {
5302 QCString cref;
5303 if (findAttribute(tagHtmlAttribs,"cref",&cref))
5304 {
5305 unescapeCRef(cref);
5306 // Look for an existing "see" section
5307 DocNodeVariant *vss=nullptr;
5308 for (auto &n : children())
5309 {
5310 DocSimpleSect *candidate = std::get_if<DocSimpleSect>(&n);
5311 if (candidate && candidate->type()==DocSimpleSect::See)
5312 {
5313 vss = &n;
5314 }
5315 }
5316
5317 if (!vss) // start new section
5318 {
5320 vss = &children().back();
5321 }
5322
5323 std::get<DocSimpleSect>(*vss).appendLinkWord(cref);
5324 retval = Token::make_RetVal_OK();
5325 }
5326 else
5327 {
5328 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'cref' attribute from <seealso> tag.");
5329 }
5330 }
5331 break;
5333 {
5334 QCString type;
5335 findAttribute(tagHtmlAttribs,"type",&type);
5337 HtmlAttribList emptyList;
5338 if (type=="number")
5339 {
5340 listType=DocHtmlList::Ordered;
5341 }
5342 if (type=="table")
5343 {
5345 retval=children().get_last<DocHtmlTable>()->parseXml();
5346 if (children().get_last<DocHtmlTable>()->children().empty()) children().pop_back();
5347 }
5348 else
5349 {
5350 children().append<DocHtmlList>(parser(),thisVariant(),emptyList,listType);
5351 retval=children().get_last<DocHtmlList>()->parseXml();
5352 }
5353 }
5354 break;
5357 // These tags are defined in .Net but are currently unsupported
5359 break;
5361 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported xml/html tag <{}> found", tagName);
5363 break;
5366 break;
5367 default:
5368 // we should not get here!
5369 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected start tag {}",tagName);
5370 ASSERT(0);
5371 break;
5372 }
5373 AUTO_TRACE_EXIT("retval={}",retval.to_string());
5374 return retval;
5375}

References DocNodeList::append, ASSERT, TokenInfo::attribsStr, AUTO_TRACE, AUTO_TRACE_EXIT, GrowVector< T >::back, DocStyleChange::Bold, DocStyleChange::Center, DocCompoundNode::children, DocStyleChange::Cite, DocStyleChange::Code, Config_getBool, DocParser::context, DocStyleChange::Del, DocStyleChange::Div, DocParamSect::Exception, FALSE, findAttribute, DocNodeList::get_last, DocParser::handleAHref, handleHtmlHeader, DocParser::handleImg, handleInheritDoc, DocParser::handleLinkedWord, handleParamSection, handleSimpleSection, handleStartCode, DocParser::handleStyleEnter, DocParser::handleStyleLeave, DocParserContext::hasReturnCommand, HTML_A, HTML_BLOCKQUOTE, HTML_BOLD, HTML_BR, HTML_CAPTION, HTML_CENTER, HTML_CITE, HTML_CODE, HTML_DD, HTML_DEL, HTML_DETAILS, 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_INS, HTML_KBD, HTML_LI, HTML_OL, HTML_P, HTML_PRE, HTML_S, HTML_SMALL, HTML_SPAN, HTML_STRIKE, HTML_SUB, HTML_SUP, HTML_TABLE, HTML_TBODY, HTML_TD, HTML_TFOOT, HTML_TH, HTML_THEAD, HTML_TR, HTML_TT, HTML_UL, HTML_UNDERLINE, Mappers::htmlTagMapper, DocStyleChange::Ins, DocParserContext::inSeeBlock, insideDetails, insideDL, insideOL, insideTable, insideUL, Token::is, QCString::isEmpty, DocStyleChange::Italic, DocStyleChange::Kbd, TokenInfo::name, DocParserContext::nodeStack, DocHtmlList::Ordered, DocParamSect::Param, DocNode::parent, parse, DocNode::parser, DocHtmlDetails::parseSummary, GrowVector< T >::pop_back, DocStyleChange::Preformatted, DocSimpleSect::Return, DocStyleChange::S, DocSimpleSect::See, DocTokenizer::setInsidePre, DocNode::setInsidePreformatted, DocTokenizer::setStatePara, DocTokenizer::setStateXmlCode, DocStyleChange::Small, DocStyleChange::Span, DocStyleChange::Strike, DocStyleChange::Subscript, DocHtmlDetails::summary, DocStyleChange::Superscript, DocParamSect::TemplateParam, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, TRUE, DocSimpleSect::type, DocStyleChange::Typewriter, DocStyleChange::Underline, unescapeCRef, UNKNOWN, 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, XML_VALUE and DocParserContext::xmlComment.

Referenced by parse.

handleIFile()

void DocPara::handleIFile (char cmdChar, const QCString & cmdName)

Declaration at line 1108 of file docnode.h, definition at line 3736 of file docnode.cpp.

3736void DocPara::handleIFile(char cmdChar,const QCString &cmdName)
3737{
3738 AUTO_TRACE();
3739 Token tok=parser()->tokenizer.lex();
3740 if (!tok.is(TokenRetval::TK_WHITESPACE))
3741 {
3742 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
3743 cmdChar,cmdName);
3744 return;
3745 }
3747 tok=parser()->tokenizer.lex();
3749 if (!tok.is(TokenRetval::TK_WORD))
3750 {
3751 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}'",
3752 tok.to_string(),cmdChar,cmdName);
3753 return;
3754 }
3757}

References AUTO_TRACE, DocParser::context, DocParserContext::fileName, Token::is, DocTokenizer::lex, TokenInfo::name, DocNode::parser, DocTokenizer::setStateFile, DocTokenizer::setStatePara, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleILine()

void DocPara::handleILine (char cmdChar, const QCString & cmdName)

Declaration at line 1107 of file docnode.h, definition at line 3722 of file docnode.cpp.

3722void DocPara::handleILine(char cmdChar,const QCString &cmdName)
3723{
3724 AUTO_TRACE();
3726 Token tok = parser()->tokenizer.lex();
3727 if (!tok.is(TokenRetval::TK_WORD))
3728 {
3729 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid argument for command '{:c}{}'",
3730 cmdChar,cmdName);
3731 return;
3732 }
3734}

References AUTO_TRACE, Token::is, DocTokenizer::lex, DocNode::parser, DocTokenizer::setStateILine, DocTokenizer::setStatePara, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleInclude()

void DocPara::handleInclude (const QCString & cmdName, DocInclude::Type t)

Declaration at line 1098 of file docnode.h, definition at line 3927 of file docnode.cpp.

3928{
3929 AUTO_TRACE("cmdName={}",cmdName);
3930 QCString saveCmdName = cmdName;
3931 Token tok=parser()->tokenizer.lex();
3932 bool isBlock = false;
3933 bool trimLeft = false;
3934 bool localScope = false;
3935 bool stripCodeComments = Config_getBool(STRIP_CODE_COMMENTS);
3936 if (tok.is(TokenRetval::TK_WORD) && parser()->context.token->name=="{")
3937 {
3939 parser()->tokenizer.lex();
3941 StringVector optList=split(parser()->context.token->name.str(),",");
3942 auto contains = [&optList](const char *kw)
3943 {
3944 return std::find(optList.begin(),optList.end(),kw)!=optList.end();
3945 };
3946 localScope = contains("local");
3947 if (contains("nostrip"))
3948 {
3949 stripCodeComments = false;
3950 }
3951 else if (contains("strip"))
3952 {
3953 stripCodeComments = true;
3954 }
3955 if (t==DocInclude::Snippet && contains("trimleft"))
3956 {
3957 trimLeft = true;
3958 }
3959
3960 if (contains("lineno"))
3961 {
3965 }
3966 tok=parser()->tokenizer.lex();
3967 if (!tok.is(TokenRetval::TK_WHITESPACE))
3968 {
3969 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3970 saveCmdName);
3971 return;
3972 }
3973 }
3974 else if (tok.is(TokenRetval::TK_WORD) && parser()->context.token->name=="[")
3975 {
3977 parser()->tokenizer.lex();
3978 isBlock = (parser()->context.token->name.stripWhiteSpace() == "block");
3980 parser()->tokenizer.lex();
3981 }
3982 else if (!tok.is(TokenRetval::TK_WHITESPACE))
3983 {
3984 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3985 saveCmdName);
3986 return;
3987 }
3989 tok=parser()->tokenizer.lex();
3991 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
3992 {
3993 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the "
3994 "argument of command {}",saveCmdName);
3995 return;
3996 }
3997 else if (!tok.is(TokenRetval::TK_WORD))
3998 {
3999 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of {}",
4000 tok.to_string(),saveCmdName);
4001 return;
4002 }
4003 QCString fileName = parser()->context.token->name;
4004 QCString blockId;
4006 {
4007 if (fileName == "this") fileName=parser()->context.fileName;
4009 tok=parser()->tokenizer.lex();
4011 if (!tok.is(TokenRetval::TK_WORD))
4012 {
4013 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected block identifier, but found token {} instead while parsing the {} command",
4014 tok.to_string(),saveCmdName);
4015 return;
4016 }
4017 blockId = "["+parser()->context.token->name+"]";
4018 }
4019
4021 thisVariant(),
4022 fileName,
4023 localScope ? parser()->context.context : "",
4024 t,
4025 stripCodeComments,
4028 blockId,isBlock,trimLeft);
4030}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, Config_getBool, DocParser::context, DocParserContext::context, DocInclude::DontInclude, DocInclude::DontIncWithLines, DocParserContext::exampleName, DocParserContext::fileName, DocNodeList::get_last, DocInclude::Include, DocInclude::IncWithLines, Token::is, Token::is_any_of, DocParserContext::isExample, DocTokenizer::lex, TokenInfo::name, parse, DocNode::parser, DocTokenizer::setStateBlock, DocTokenizer::setStateFile, DocTokenizer::setStateOptions, DocTokenizer::setStatePara, DocTokenizer::setStateSnippet, DocInclude::Snippet, DocInclude::SnippetWithLines, split, QCString::stripWhiteSpace, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleIncludeOperator()

void DocPara::handleIncludeOperator (const QCString & cmdName, DocIncOperator::Type t)

Declaration at line 1096 of file docnode.h, definition at line 3760 of file docnode.cpp.

3761{
3762 AUTO_TRACE("cmdName={}",cmdName);
3763 QCString saveCmdName = cmdName;
3764 Token tok=parser()->tokenizer.lex();
3765 if (!tok.is(TokenRetval::TK_WHITESPACE))
3766 {
3767 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3768 saveCmdName);
3769 return;
3770 }
3772 tok=parser()->tokenizer.lex();
3774 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
3775 {
3776 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the "
3777 "argument of command {}", saveCmdName);
3778 return;
3779 }
3780 else if (!tok.is(TokenRetval::TK_WORD))
3781 {
3782 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of {}",
3783 tok.to_string(),saveCmdName);
3784 return;
3785 }
3786 auto it1 = children().size()>=1 ? std::prev(children().end()) : children().end();
3787 auto it2 = children().size()>=2 ? std::prev(it1) : children().end();
3788 DocNodeVariant *n1 = it1!=children().end() ? &(*it1) : nullptr;
3789 DocNodeVariant *n2 = it2!=children().end() ? &(*it2) : nullptr;
3790 //TODO get from context the stripCodeComments()
3791 bool stripCodeComments = Config_getBool(STRIP_CODE_COMMENTS);
3795 stripCodeComments,
3798 );
3800 DocIncOperator *n1_docIncOp = std::get_if<DocIncOperator>(n1);
3801 DocWhiteSpace *n1_docWs = std::get_if<DocWhiteSpace >(n1);
3802 DocIncOperator *n2_docIncOp = std::get_if<DocIncOperator>(n2);
3803 bool isFirst = !n1 || // no last node
3804 (!n1_docIncOp && !n1_docWs) || // last node is not operator or whitespace
3805 (n1_docWs && n2 && !n2_docIncOp); // last node is not operator
3806 op->markFirst(isFirst);
3807 op->markLast(true);
3808 if (n1_docIncOp)
3809 {
3810 n1_docIncOp->markLast(false);
3811 }
3812 else if (n1_docWs && n2_docIncOp)
3813 {
3814 n2_docIncOp->markLast(false);
3815 }
3816 op->parse();
3817}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, Config_getBool, DocParser::context, DocParserContext::context, end, GrowVector< T >::end, DocParserContext::exampleName, DocNodeList::get_last, Token::is, Token::is_any_of, DocParserContext::isExample, isFirst, DocTokenizer::lex, DocIncOperator::markLast, TokenInfo::name, DocNode::parser, DocTokenizer::setStatePara, DocTokenizer::setStatePattern, GrowVector< T >::size, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleInheritDoc()

void DocPara::handleInheritDoc ()

Declaration at line 1105 of file docnode.h, definition at line 4117 of file docnode.cpp.

4118{
4119 if (parser()->context.memberDef) // inheriting docs from a member
4120 {
4121 const MemberDef *reMd = parser()->context.memberDef->reimplements();
4122 if (reMd) // member from which was inherited.
4123 {
4124 const MemberDef *thisMd = parser()->context.memberDef;
4125 //printf("{InheritDocs:%s=>%s}\n",qPrint(parser()->context.memberDef->qualifiedName()),qPrint(reMd->qualifiedName()));
4126 parser()->pushContext();
4128 if (parser()->context.scope!=Doxygen::globalScope)
4129 {
4131 }
4132 parser()->context.memberDef=reMd;
4133 while (!parser()->context.styleStack.empty()) parser()->context.styleStack.pop();
4134 while (!parser()->context.nodeStack.empty()) parser()->context.nodeStack.pop();
4135 parser()->context.copyStack.push_back(reMd);
4138 parser()->context.copyStack.pop_back();
4139 auto hasParamCommand = parser()->context.hasParamCommand;
4140 auto hasReturnCommand = parser()->context.hasReturnCommand;
4141 auto retvalsFound = parser()->context.retvalsFound;
4142 auto paramsFound = parser()->context.paramsFound;
4143 parser()->popContext();
4144 parser()->context.hasParamCommand = hasParamCommand;
4145 parser()->context.hasReturnCommand = hasReturnCommand;
4146 parser()->context.retvalsFound = retvalsFound;
4147 parser()->context.paramsFound = paramsFound;
4148 parser()->context.memberDef = thisMd;
4149 }
4150 }
4151}

References Definition::briefDescription, DocCompoundNode::children, DocParser::context, DocParserContext::context, DocParserContext::copyStack, Definition::documentation, Definition::getOuterScope, Doxygen::globalScope, DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, DocParser::internalValidatingParseDoc, DocParserContext::memberDef, Definition::name, DocParserContext::nodeStack, DocParserContext::paramsFound, DocNode::parser, DocParser::popContext, DocParser::pushContext, MemberDef::reimplements, DocParserContext::retvalsFound, DocParserContext::scope, DocParserContext::styleStack and DocNode::thisVariant.

Referenced by handleCommand and handleHtmlStartTag.

handleLink()

void DocPara::handleLink (const QCString & cmdName, bool isJavaLink)

Declaration at line 1099 of file docnode.h, definition at line 3859 of file docnode.cpp.

3859void DocPara::handleLink(const QCString &cmdName,bool isJavaLink)
3860{
3861 AUTO_TRACE("cmdName={} isJavaLink={}",cmdName,isJavaLink);
3862 QCString saveCmdName = cmdName;
3863 Token tok=parser()->tokenizer.lex();
3864 if (!tok.is(TokenRetval::TK_WHITESPACE))
3865 {
3866 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3867 saveCmdName);
3868 return;
3869 }
3871 tok=parser()->tokenizer.lex();
3872 if (!tok.is(TokenRetval::TK_WORD))
3873 {
3874 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"{} as the argument of {}",
3875 tok.to_string(),saveCmdName);
3876 return;
3877 }
3878 if (saveCmdName == "javalink")
3879 {
3881 parser()->context.nodeStack.size(),
3882 DocStyleChange::Code,cmdName,TRUE);
3883 }
3886 DocLink *lnk = children().get_last<DocLink>();
3887 if (saveCmdName == "javalink")
3888 {
3890 parser()->context.nodeStack.size(),
3892 }
3893 QCString leftOver = lnk->parse(isJavaLink);
3894 if (!leftOver.isEmpty())
3895 {
3896 children().append<DocWord>(parser(),thisVariant(),leftOver);
3897 }
3898}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocStyleChange::Code, DocParser::context, FALSE, DocNodeList::get_last, Token::is, QCString::isEmpty, DocTokenizer::lex, TokenInfo::name, DocParserContext::nodeStack, DocNode::parser, DocTokenizer::setStateLink, DocTokenizer::setStatePara, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, TRUE and warn_doc_error.

Referenced by handleCommand.

handleParamSection()

Token DocPara::handleParamSection (const QCString & cmdName, DocParamSect::Type t, bool xmlContext, int direction)

Declaration at line 1095 of file docnode.h, definition at line 3374 of file docnode.cpp.

3376 bool xmlContext=FALSE,
3377 int direction=DocParamSect::Unspecified)
3378{
3379 AUTO_TRACE();
3380 DocParamSect *ps = nullptr;
3381 if (!children().empty() && // previous element
3382 (ps=children().get_last<DocParamSect>()) && // was a param sect
3383 ps->type()==t) // of same type
3384 { // append to previous section ps
3385 }
3386 else // start new section
3387 {
3390 }
3391 Token rv=ps->parse(cmdName,xmlContext,
3392 static_cast<DocParamSect::Direction>(direction));
3393 AUTO_TRACE_EXIT("retval={}",rv.to_string());
3394 return (!rv.is(TokenRetval::TK_NEWPARA)) ? rv : Token::make_RetVal_OK();
3395}

References DocNodeList::append, AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children, FALSE, DocNodeList::get_last, Token::is, DocParamSect::parse, DocNode::parser, DocNode::thisVariant, Token::to_string, DocParamSect::type and DocParamSect::Unspecified.

Referenced by handleCommand and handleHtmlStartTag.

handleRef()

void DocPara::handleRef (char cmdChar, const QCString & cmdName)

Declaration at line 1103 of file docnode.h, definition at line 3900 of file docnode.cpp.

3900void DocPara::handleRef(char cmdChar,const QCString &cmdName)
3901{
3902 AUTO_TRACE("cmdName={}",cmdName);
3903 QCString saveCmdName = cmdName;
3904 Token tok=parser()->tokenizer.lex();
3905 if (!tok.is(TokenRetval::TK_WHITESPACE))
3906 {
3907 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
3908 cmdChar,qPrint(saveCmdName));
3909 return;
3910 }
3912 tok=parser()->tokenizer.lex(); // get the reference id
3913 if (!tok.is(TokenRetval::TK_WORD))
3914 {
3915 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}'",
3916 tok.to_string(),cmdChar,saveCmdName);
3917 goto endref;
3918 }
3923endref:
3925}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocParser::context, DocParserContext::context, DocNodeList::get_last, Token::is, DocTokenizer::lex, TokenInfo::name, parse, DocNode::parser, qPrint, DocTokenizer::setStatePara, DocTokenizer::setStateRef, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleSection()

void DocPara::handleSection (char cmdChar, const QCString & cmdName)

Declaration at line 1104 of file docnode.h, definition at line 4032 of file docnode.cpp.

4032void DocPara::handleSection(char cmdChar,const QCString &cmdName)
4033{
4034 AUTO_TRACE("cmdName={}",cmdName);
4035 QCString saveCmdName = cmdName;
4036 // get the argument of the section command.
4037 Token tok=parser()->tokenizer.lex();
4038 if (!tok.is(TokenRetval::TK_WHITESPACE))
4039 {
4040 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
4041 cmdChar,saveCmdName);
4042 return;
4043 }
4044 tok=parser()->tokenizer.lex();
4045 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4046 {
4047 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the "
4048 "argument of command '{:c}{}'", cmdChar,saveCmdName);
4049 return;
4050 }
4051 else if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD))
4052 {
4053 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}'",
4054 tok.to_string(),cmdChar,saveCmdName);
4055 return;
4056 }
4059 parser()->tokenizer.lex();
4061}

References AUTO_TRACE, DocParser::context, Token::is, Token::is_any_of, DocTokenizer::lex, TokenInfo::name, DocNode::parser, TokenInfo::sectionId, DocTokenizer::setStatePara, DocTokenizer::setStateSkipTitle, Token::to_string, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleShowDate()

void DocPara::handleShowDate (char cmdChar, const QCString & cmdName)

Declaration at line 1109 of file docnode.h, definition at line 3652 of file docnode.cpp.

3652void DocPara::handleShowDate(char cmdChar,const QCString &cmdName)
3653{
3654 AUTO_TRACE();
3656 QCString date;
3657 Token tok=parser()->tokenizer.lex();
3658 if (!tok.is(TokenRetval::TK_WHITESPACE))
3659 {
3660 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
3661 cmdChar,cmdName);
3662 return;
3663 }
3665 tok = parser()->tokenizer.lex();
3666 if (!tok.is(TokenRetval::TK_WORD))
3667 {
3668 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid <format> argument for command '{:c}{}'",
3669 cmdChar,cmdName);
3671 return;
3672 }
3674
3676 tok = parser()->tokenizer.lex();
3677
3678 QCString specDateRaw = tok.is(TokenRetval::TK_WORD) ? parser()->context.token->name : QCString();
3679 QCString specDate = specDateRaw.stripWhiteSpace();
3680 bool specDateOnlyWS = !specDateRaw.isEmpty() && specDate.isEmpty();
3681 if (!specDate.isEmpty() && !tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_NONE,TokenRetval::TK_EOF))
3682 {
3683 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid <date_time> argument for command '{:c}{}'",
3684 cmdChar,cmdName);
3686 return;
3687 }
3688
3689 std::tm dat{};
3690 int specFormat=0;
3691 QCString err = dateTimeFromString(specDate,dat,specFormat);
3692 if (!err.isEmpty())
3693 {
3694 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid <date_time> argument for command '{:c}{}': {}",
3695 cmdChar,cmdName,err);
3697 return;
3698 }
3699
3700 int usedFormat=0;
3701 QCString dateTimeStr = formatDateTime(fmt,dat,usedFormat);
3702
3703 // warn the user if the format contains markers that are not explicitly filled in
3704 for (int i=0;i<SF_NumBits;i++)
3705 {
3706 int bitMask = 1<<i;
3707 if ((usedFormat&bitMask) && !(specFormat&bitMask)) // a part was used in the format string but its value was not specified.
3708 {
3709 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"'{:c}{}' <format> parameter '{}' has {} related markers which are not specified in the <date_time> parameter '{}'. Filling in the current value for {} instead.",
3710 cmdChar,cmdName,fmt,SF_bit2str(i),specDate,SF_bit2str(i));
3711 }
3712 }
3713
3714 children().append<DocWord>(parser(),thisVariant(),dateTimeStr);
3715 if (specDateOnlyWS) // specDate is only whitespace
3716 {
3718 }
3720}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocParser::context, dateTimeFromString, err, formatDateTime, Token::is, Token::is_any_of, QCString::isEmpty, DocTokenizer::lex, TokenInfo::name, DocNode::parser, DocTokenizer::setStatePara, DocTokenizer::setStateQuotedString, DocTokenizer::setStateShowDate, SF_bit2str, SF_NumBits, QCString::stripWhiteSpace, DocNode::thisVariant, DocParserContext::token, DocParser::tokenizer and warn_doc_error.

Referenced by handleCommand.

handleSimpleSection()

Token DocPara::handleSimpleSection (DocSimpleSect::Type t, bool xmlContext=FALSE)

Declaration at line 1093 of file docnode.h, definition at line 3344 of file docnode.cpp.

3345{
3346 AUTO_TRACE();
3347 DocSimpleSect *ss=nullptr;
3348 bool needsSeparator = FALSE;
3349 if (!children().empty() && // has previous element
3350 (ss=children().get_last<DocSimpleSect>()) && // was a simple sect
3351 ss->type()==t && // of same type
3352 t!=DocSimpleSect::User) // but not user defined
3353 {
3354 // append to previous section
3355 needsSeparator = TRUE;
3356 }
3357 else // start new section
3358 {
3361 }
3362 Token rv = Token::make_RetVal_OK();
3363 if (xmlContext)
3364 {
3365 return ss->parseXml();
3366 }
3367 else
3368 {
3369 rv = ss->parse(t==DocSimpleSect::User,needsSeparator);
3370 }
3371 return (!rv.is(TokenRetval::TK_NEWPARA)) ? rv : Token::make_RetVal_OK();
3372}

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, FALSE, DocNodeList::get_last, Token::is, DocSimpleSect::parse, DocNode::parser, DocSimpleSect::parseXml, DocNode::thisVariant, TRUE, DocSimpleSect::type and DocSimpleSect::User.

Referenced by handleCommand and handleHtmlStartTag.

handleStartCode()

Token DocPara::handleStartCode ()

Declaration at line 1110 of file docnode.h, definition at line 4081 of file docnode.cpp.

4082{
4083 AUTO_TRACE();
4084 Token retval = parser()->tokenizer.lex();
4085 QCString lang = parser()->context.token->name;
4086 if (!lang.isEmpty() && lang.at(0)!='.')
4087 {
4088 lang="."+lang;
4089 }
4090 if (parser()->context.xmlComment)
4091 {
4092 parser()->context.token->verb = substitute(substitute(parser()->context.token->verb,"&lt;","<"),"&gt;",">");
4093 }
4094 // search for the first non-whitespace line, index is stored in li
4095 size_t i=0,li=0,l=parser()->context.token->verb.length();
4096 while (i<l && (parser()->context.token->verb.at(i)==' ' || parser()->context.token->verb.at(i)=='\n'))
4097 {
4098 if (parser()->context.token->verb.at(i)=='\n') li=i+1;
4099 i++;
4100 }
4103 stripIndentation(parser()->context.token->verb.mid(li)),
4107 FALSE,lang);
4108 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
4109 {
4110 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"code section ended without end marker");
4111 }
4113 AUTO_TRACE_EXIT("retval={}",retval.to_string());
4114 return retval;
4115}

References DocNodeList::append, QCString::at, AUTO_TRACE, AUTO_TRACE_EXIT, DocCompoundNode::children, DocVerbatim::Code, DocParser::context, DocParserContext::context, DocParserContext::exampleName, FALSE, Token::is_any_of, QCString::isEmpty, DocParserContext::isExample, QCString::length, DocTokenizer::lex, TokenInfo::name, DocNode::parser, DocTokenizer::setStatePara, stripIndentation, substitute, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, TokenInfo::verb and warn_doc_error.

Referenced by handleCommand and handleHtmlStartTag.

handleVhdlFlow()

void DocPara::handleVhdlFlow ()

Declaration at line 1106 of file docnode.h, definition at line 3852 of file docnode.cpp.

References DocNodeList::append, AUTO_TRACE, DocCompoundNode::children, DocNodeList::get_last, parse, DocNode::parser and DocNode::thisVariant.

Referenced by handleCommand.

handleXRefItem()

Token DocPara::handleXRefItem ()

Declaration at line 1094 of file docnode.h, definition at line 3631 of file docnode.cpp.

3632{
3633 AUTO_TRACE();
3634 Token retval=parser()->tokenizer.lex();
3635 ASSERT(retval.is(TokenRetval::TK_WHITESPACE));
3637 retval=parser()->tokenizer.lex();
3638 if (retval.is(TokenRetval::RetVal_OK))
3639 {
3643 if (!ref->parse())
3644 {
3645 children().pop_back();
3646 }
3647 }
3649 return retval;
3650}

References DocNodeList::append, ASSERT, AUTO_TRACE, DocCompoundNode::children, DocParser::context, DocNodeList::get_last, TokenInfo::id, Token::is, DocTokenizer::lex, TokenInfo::name, DocNode::parser, GrowVector< T >::pop_back, DocTokenizer::setStatePara, DocTokenizer::setStateXRefItem, DocNode::thisVariant, DocParserContext::token and DocParser::tokenizer.

Referenced by handleCommand.

injectToken()

bool DocPara::injectToken (Token tok, const QCString & tokText)

Declaration at line 1113 of file docnode.h, definition at line 4074 of file docnode.cpp.

4074bool DocPara::injectToken(Token tok,const QCString &tokText)
4075{
4076 AUTO_TRACE();
4077 parser()->context.token->name = tokText;
4079}

References AUTO_TRACE, DocCompoundNode::children, DocParser::context, DocParser::defaultHandleToken, TokenInfo::name, DocNode::parser, DocNode::thisVariant and DocParserContext::token.

Referenced by DocSimpleSect::appendLinkWord.

isEmpty()

bool DocPara::isEmpty ()
inline

Definition at line 1084 of file docnode.h.

1084 bool isEmpty() const { return children().empty(); }

References DocCompoundNode::children and GrowVector< T >::empty.

isFirst()

bool DocPara::isFirst ()
inline

Definition at line 1087 of file docnode.h.

1087 bool isFirst() const { return m_isFirst; }

Reference m_isFirst.

Referenced by handleIncludeOperator and DocParser::internalValidatingParseDoc.

isLast()

bool DocPara::isLast ()
inline

Definition at line 1088 of file docnode.h.

1088 bool isLast() const { return m_isLast; }

Reference m_isLast.

Referenced by DocParser::internalValidatingParseDoc, LatexDocVisitor::operator(), ManDocVisitor::operator() and RTFDocVisitor::operator().

markFirst()

markLast()

parse()

Token DocPara::parse ()

Declaration at line 1083 of file docnode.h, definition at line 5650 of file docnode.cpp.

5651{
5652 AUTO_TRACE();
5653 auto ns = AutoNodeStack(parser(),thisVariant());
5654 // handle style commands "inherited" from the previous paragraph
5656 Token tok=parser()->tokenizer.lex();
5657 Token retval = Token::make_TK_NONE();
5658 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) // get the next token
5659 {
5660reparsetoken:
5661 AUTO_TRACE_ADD("token '{}' at {}",tok.to_string(),parser()->tokenizer.getLineNr());
5662 if (tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD,TokenRetval::TK_SYMBOL,TokenRetval::TK_URL,
5663 TokenRetval::TK_COMMAND_AT,TokenRetval::TK_COMMAND_BS,TokenRetval::TK_HTMLTAG)
5664 )
5665 {
5666 AUTO_TRACE_ADD("name={}",parser()->context.token->name);
5667 }
5668 switch(tok.value())
5669 {
5670 case TokenRetval::TK_WORD:
5672 break;
5673 case TokenRetval::TK_LNKWORD:
5675 break;
5676 case TokenRetval::TK_URL:
5678 break;
5679 case TokenRetval::TK_WHITESPACE:
5680 {
5681 // prevent leading whitespace and collapse multiple whitespace areas
5682 if (insidePRE(thisVariant()) || // all whitespace is relevant
5683 (
5684 // remove leading whitespace
5685 !children().empty() &&
5686 // and whitespace after certain constructs
5690 )
5691 )
5692 {
5694 }
5695 }
5696 break;
5697 case TokenRetval::TK_LISTITEM:
5698 {
5699 AUTO_TRACE_ADD("found list item at {}",parser()->context.token->indent);
5700 const DocNodeVariant *n=parent();
5701 while (n && !std::holds_alternative<DocAutoList>(*n)) n=::parent(n);
5702 const DocAutoList *al = std::get_if<DocAutoList>(n);
5703 if (al) // we found an auto list up in the hierarchy
5704 {
5705 AUTO_TRACE_ADD("previous list item at {}",al->indent());
5706 if (al->indent()>=parser()->context.token->indent)
5707 // new item at the same or lower indent level
5708 {
5709 retval = Token::make_TK_LISTITEM();
5710 goto endparagraph;
5711 }
5712 }
5713
5714 // determine list depth
5715 int depth = 0;
5716 n=parent();
5717 while (n)
5718 {
5719 al = std::get_if<DocAutoList>(n);
5720 if (al && al->isEnumList()) depth++;
5721 n=::parent(n);
5722 }
5723
5724 // first item or sub list => create new list
5725 do
5726 {
5729 parser()->context.token->isEnumList,depth,
5731 al = children().get_last<DocAutoList>();
5732 retval = children().get_last<DocAutoList>()->parse();
5733 } while (retval.is(TokenRetval::TK_LISTITEM) && // new list
5734 al->indent()==parser()->context.token->indent // at same indent level
5735 );
5736
5737 // check the return value
5738 if (retval.is(TokenRetval::RetVal_SimpleSec)) // auto list ended due to simple section command
5739 {
5740 // Reparse the token that ended the section at this level,
5741 // so a new simple section will be started at this level.
5742 // This is the same as unputting the last read token and continuing.
5744 if (parser()->context.token->name.startsWith("rcs:")) // RCS section
5745 {
5748 tok = Token::make_TK_RCSTAG();
5749 }
5750 else // other section
5751 {
5752 tok = Token::make_TK_COMMAND_BS();
5753 }
5754 AUTO_TRACE_ADD("reparsing command {}",parser()->context.token->name);
5755 goto reparsetoken;
5756 }
5757 else if (retval.is(TokenRetval::TK_ENDLIST))
5758 {
5759 if (al->indent()>parser()->context.token->indent) // end list
5760 {
5761 goto endparagraph;
5762 }
5763 else // continue with current paragraph
5764 {
5765 }
5766 }
5767 else // paragraph ended due to TokenRetval::TK_NEWPARA, TokenRetval::TK_LISTITEM, or EOF
5768 {
5769 goto endparagraph;
5770 }
5771 }
5772 break;
5773 case TokenRetval::TK_ENDLIST:
5774 AUTO_TRACE_ADD("Found end of list inside of paragraph at line {}",parser()->tokenizer.getLineNr());
5775 if (std::get_if<DocAutoListItem>(parent()))
5776 {
5777 const DocAutoList *al = std::get_if<DocAutoList>(::parent(parent()));
5778 if (al && al->indent()>=parser()->context.token->indent)
5779 {
5780 // end of list marker ends this paragraph
5781 retval = Token::make_TK_ENDLIST();
5782 goto endparagraph;
5783 }
5784 else
5785 {
5786 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"End of list marker found "
5787 "has invalid indent level");
5788 }
5789 }
5790 else
5791 {
5792 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"End of list marker found without any preceding "
5793 "list items");
5794 }
5795 break;
5796 case TokenRetval::TK_COMMAND_AT:
5797 // fall through
5798 case TokenRetval::TK_COMMAND_BS:
5799 {
5800 // see if we have to start a simple section
5801 CommandType cmd = Mappers::cmdMapper->map(parser()->context.token->name);
5802 const DocNodeVariant *n=parent();
5803 while (n && !std::holds_alternative<DocSimpleSect>(*n) &&
5804 !std::holds_alternative<DocParamSect>(*n))
5805 {
5806 n=::parent(n);
5807 }
5809 {
5810 if (n) // already in a simple section
5811 {
5812 // simple section cannot start in this paragraph, need
5813 // to unwind the stack and remember the command.
5815 retval = Token::make_RetVal_SimpleSec();
5816 goto endparagraph;
5817 }
5818 }
5819 // see if we are in a simple list
5820 n=parent();
5821 while (n && !std::holds_alternative<DocSimpleListItem>(*n)) n=::parent(n);
5822 if (n)
5823 {
5824 if (cmd==CommandType::CMD_LI)
5825 {
5826 retval = Token::make_RetVal_ListItem();
5827 goto endparagraph;
5828 }
5829 }
5830
5831 // handle the command
5832 retval=handleCommand(tok.command_to_char(),parser()->context.token->name);
5833 AUTO_TRACE_ADD("handleCommand returns {}",retval.to_string());
5834
5835 // check the return value
5836 if (retval.is(TokenRetval::RetVal_SimpleSec))
5837 {
5838 // Reparse the token that ended the section at this level,
5839 // so a new simple section will be started at this level.
5840 // This is the same as unputting the last read token and continuing.
5842 if (parser()->context.token->name.startsWith("rcs:")) // RCS section
5843 {
5846 tok = Token::make_TK_RCSTAG();
5847 }
5848 else // other section
5849 {
5850 tok = Token::make_TK_COMMAND_BS();
5851 }
5852 AUTO_TRACE_ADD("reparsing command {}",parser()->context.token->name);
5853 goto reparsetoken;
5854 }
5855 else if (retval.value()>TokenRetval::TK_NONE && retval.value()<TokenRetval::RetVal_OK)
5856 {
5857 // the command ended with a new command, reparse this token
5858 tok = retval;
5859 goto reparsetoken;
5860 }
5861 else if (retval.value()!=TokenRetval::RetVal_OK) // end of file, end of paragraph, start or end of section
5862 // or some auto list marker
5863 {
5864 goto endparagraph;
5865 }
5866 }
5867 break;
5868 case TokenRetval::TK_HTMLTAG:
5869 {
5870 if (!parser()->context.token->endTag) // found a start tag
5871 {
5872 retval = handleHtmlStartTag(parser()->context.token->name,parser()->context.token->attribs);
5873 }
5874 else // found an end tag
5875 {
5877 {
5878 break; // new code has been pushed back to the scanner, need to reparse
5879 }
5880 retval = handleHtmlEndTag(parser()->context.token->name);
5881 }
5882 if (!retval.is(TokenRetval::RetVal_OK))
5883 {
5884 goto endparagraph;
5885 }
5886 }
5887 break;
5888 case TokenRetval::TK_SYMBOL:
5889 {
5890 HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name);
5892 {
5894 }
5895 else
5896 {
5898 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '{}' found",
5899 parser()->context.token->name);
5900 }
5901 break;
5902 }
5903 case TokenRetval::TK_NEWPARA:
5904 retval = Token::make_TK_NEWPARA();
5905 goto endparagraph;
5906 case TokenRetval::TK_RCSTAG:
5907 {
5908 const DocNodeVariant *n=parent();
5909 while (n && !std::holds_alternative<DocSimpleSect>(*n) &&
5910 !std::holds_alternative<DocParamSect>(*n))
5911 {
5912 n=::parent(n);
5913 }
5914 if (n) // already in a simple section
5915 {
5916 // simple section cannot start in this paragraph, need
5917 // to unwind the stack and remember the command.
5920 retval = Token::make_RetVal_SimpleSec();
5921 goto endparagraph;
5922 }
5923
5924 // see if we are in a simple list
5926 children().get_last<DocSimpleSect>()->parseRcs();
5927 }
5928 break;
5929 default:
5930 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
5931 "Found unexpected token (id={})",tok.to_string());
5932 break;
5933 }
5934 tok=parser()->tokenizer.lex();
5935 }
5936 retval=Token::make_TK_NONE();
5937endparagraph:
5939 DocPara *par = std::get_if<DocPara>(parser()->context.nodeStack.top());
5940 if (!parser()->context.token->endTag && par &&
5941 retval.is(TokenRetval::TK_NEWPARA) && parser()->context.token->name.lower() == "p")
5942 {
5943 par->setAttribs(parser()->context.token->attribs);
5944 }
5945 INTERNAL_ASSERT(retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::TK_NEWPARA,TokenRetval::TK_LISTITEM,
5946 TokenRetval::TK_ENDLIST,TokenRetval::RetVal_OK)
5947 );
5948
5949 AUTO_TRACE_EXIT("retval={}",retval.to_string());
5950 return retval;
5951}

References DocNodeList::append, AUTO_TRACE, AUTO_TRACE_ADD, AUTO_TRACE_EXIT, TokenInfo::chars, checkIfHtmlEndTagEndsAutoList, DocCompoundNode::children, CMD_LI, Mappers::cmdMapper, Token::command_to_char, DocParser::context, DocSymbol::decodeSymbol, DocPara, DocNodeList::get_last, handleCommand, handleHtmlEndTag, handleHtmlStartTag, DocParser::handleInitialStyleCommands, DocParser::handleLinkedWord, DocParser::handlePendingStyleCommands, holds_one_of_alternatives, DocAutoList::indent, TokenInfo::indent, insidePRE, INTERNAL_ASSERT, Token::is, Token::is_any_of, TokenInfo::isCheckedList, TokenInfo::isEMailAddr, DocAutoList::isEnumList, TokenInfo::isEnumList, DocTokenizer::lex, QCString::mid, TokenInfo::name, DocNode::parent, parse, DocNode::parser, DocSimpleSect::Rcs, setAttribs, SIMPLESECT_BIT, TokenInfo::simpleSectName, TokenInfo::simpleSectText, HtmlEntityMapper::Sym_Unknown, TokenInfo::text, DocNode::thisVariant, Token::to_string, DocParserContext::token, DocParser::tokenizer, Token::value and warn_doc_error.

Referenced by handleCommand, handleHtmlHeader, handleHtmlStartTag, handleInclude, handleRef, handleVhdlFlow, DocHtmlBlockQuote::parse, DocHtmlCell::parse, DocHtmlDescData::parse, DocHtmlDetails::parse, DocHtmlListItem::parse, parse, DocParamList::parse, DocParBlock::parse, DocSimpleListItem::parse, DocHtmlCell::parseXml and DocHtmlListItem::parseXml.

setAttribs()

void DocPara::setAttribs (const HtmlAttribList & attribs)
inline

Definition at line 1115 of file docnode.h.

References attribs and m_attribs.

Referenced by parse.

Private Member Attributes

m_attribs

HtmlAttribList DocPara::m_attribs

Definition at line 1120 of file docnode.h.

Referenced by attribs and setAttribs.

m_isFirst

bool DocPara::m_isFirst = false

Definition at line 1118 of file docnode.h.

1118 bool m_isFirst = false;

Referenced by DocPara, isFirst and markFirst.

m_isLast

bool DocPara::m_isLast = false

Definition at line 1119 of file docnode.h.

1119 bool m_isLast = false;

Referenced by DocPara, isLast and markLast.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.