6250{
6254 Token retval = Token::make_TK_NONE();
6255
6256
6258 DocPara *lastPar = nullptr;
6259 do
6260 {
6261 {
6264 if (isFirst) { par->markFirst(); isFirst=
FALSE; }
6265 retval=par->parse();
6266 if (par->isEmpty() && par->attribs().empty())
6267 {
6269 }
6270 else
6271 {
6272 lastPar = par;
6273 }
6274 }
6275 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6276 if (retval == t)
6277 {
6279 {
6281 parser()->tokenizer.getLineNr(),
6282 "found {} command (id: '{}') outside of {} context!",
6283 sectionType,
parser()->context.token->sectionId,parentSectionType);
6284 }
6285 while (retval==t)
6286 {
6287 if (!
parser()->context.token->sectionId.isEmpty())
6288 {
6290 if (sec)
6291 {
6293 level,
6296 }
6297 else
6298 {
6300 sectionType,
parser()->context.token->sectionId,sectionType);
6301 retval = Token::make_TK_NONE();
6302 }
6303 }
6304 else
6305 {
6306 warn_doc_error(
parser()->context.fileName,
parser()->tokenizer.getLineNr(),
"Missing id for {}; ignoring {}",sectionType,sectionType);
6307 retval = Token::make_TK_NONE();
6308 }
6309 }
6310 }
6311 };
6312 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6313 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6314 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6315 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6316 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6317
6318 if (retval.
is(TokenRetval::TK_LISTITEM))
6319 {
6321 }
6322 if (retval.
is(TokenRetval::RetVal_Internal))
6323 {
6326 }
6327 }
while (!retval.
is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6329
6330
6331
6332 while (retval.
is(TokenRetval::RetVal_Section))
6333 {
6334 if (!
parser()->context.token->sectionId.isEmpty())
6335 {
6337 if (sec)
6338 {
6340 1,
6343 }
6344 else
6345 {
6347 retval = Token::make_TK_NONE();
6348 }
6349 }
6350 else
6351 {
6353 retval = Token::make_TK_NONE();
6354 }
6355 }
6356
6358}
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,...