6304{
6308 Token retval = Token::make_TK_NONE();
6309
6310
6312 DocPara *lastPar = nullptr;
6313 do
6314 {
6315 {
6318 if (isFirst) { par->markFirst(); isFirst=
FALSE; }
6319 retval=par->parse();
6320 if (par->isEmpty() && par->attribs().empty())
6321 {
6323 }
6324 else
6325 {
6326 lastPar = par;
6327 }
6328 }
6329 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6330 if (retval == t)
6331 {
6333 {
6335 parser()->tokenizer.getLineNr(),
6336 "found {} command (id: '{}') outside of {} context!",
6337 sectionType,
parser()->context.token->sectionId,parentSectionType);
6338 }
6339 while (retval==t)
6340 {
6341 if (!
parser()->context.token->sectionId.isEmpty())
6342 {
6344 if (sec)
6345 {
6347 level,
6350 }
6351 else
6352 {
6354 sectionType,
parser()->context.token->sectionId,sectionType);
6355 retval = Token::make_TK_NONE();
6356 }
6357 }
6358 else
6359 {
6360 warn_doc_error(
parser()->context.fileName,
parser()->tokenizer.getLineNr(),
"Missing id for {}; ignoring {}",sectionType,sectionType);
6361 retval = Token::make_TK_NONE();
6362 }
6363 }
6364 }
6365 };
6366 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6367 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6368 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6369 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6370 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6371
6372 if (retval.
is(TokenRetval::TK_LISTITEM))
6373 {
6375 }
6376 if (retval.
is(TokenRetval::RetVal_Internal))
6377 {
6380 }
6381 }
while (!retval.
is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6383
6384
6385
6386 while (retval.
is(TokenRetval::RetVal_Section))
6387 {
6388 if (!
parser()->context.token->sectionId.isEmpty())
6389 {
6391 if (sec)
6392 {
6394 1,
6397 }
6398 else
6399 {
6401 retval = Token::make_TK_NONE();
6402 }
6403 }
6404 else
6405 {
6407 retval = Token::make_TK_NONE();
6408 }
6409 }
6410
6412}
static AnchorGenerator & instance()
Returns the singleton instance.
DocNodeVariant * thisVariant()
void markLast(bool v=TRUE)
void handleUnclosedStyleCommands()
void pop_back()
removes the last element
const T * find(const std::string &key) const
static SectionManager & instance()
returns a reference to the singleton
bool is(TokenRetval rv) const
bool is_any_of(ARGS... args) const
#define warn_doc_error(file, line, fmt,...)
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...