6049{
6053 Token retval = Token::make_TK_NONE();
6054
6055
6057 DocPara *lastPar = nullptr;
6058 do
6059 {
6060 {
6063 if (isFirst) { par->markFirst(); isFirst=
FALSE; }
6064 retval=par->parse();
6065 if (par->isEmpty() && par->attribs().empty())
6066 {
6068 }
6069 else
6070 {
6071 lastPar = par;
6072 }
6073 }
6074 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6075 if (retval == t)
6076 {
6078 {
6080 parser()->tokenizer.getLineNr(),
6081 "found %s command (id: '%s') outside of %s context!",
6082 sectionType,
qPrint(
parser()->context.token->sectionId),parentSectionType);
6083 }
6084 while (retval==t)
6085 {
6086 if (!
parser()->context.token->sectionId.isEmpty())
6087 {
6089 if (sec)
6090 {
6092 level,
6095 }
6096 else
6097 {
6099 sectionType,
qPrint(
parser()->context.token->sectionId),sectionType);
6100 retval = Token::make_TK_NONE();
6101 }
6102 }
6103 else
6104 {
6105 warn_doc_error(
parser()->context.fileName,
parser()->tokenizer.getLineNr(),
"Missing id for %s; ignoring %s",sectionType,sectionType);
6106 retval = Token::make_TK_NONE();
6107 }
6108 }
6109 }
6110 };
6111 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6112 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6113 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6114 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6115 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6116
6117 if (retval.
is(TokenRetval::TK_LISTITEM))
6118 {
6120 }
6121 if (retval.
is(TokenRetval::RetVal_Internal))
6122 {
6125 }
6126 }
while (!retval.
is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6128
6129
6130
6131 while (retval.
is(TokenRetval::RetVal_Section))
6132 {
6133 if (!
parser()->context.token->sectionId.isEmpty())
6134 {
6136 if (sec)
6137 {
6139 1,
6142 }
6143 else
6144 {
6146 retval = Token::make_TK_NONE();
6147 }
6148 }
6149 else
6150 {
6152 retval = Token::make_TK_NONE();
6153 }
6154 }
6155
6157}
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
Find an object given the key.
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,...)
const char * qPrint(const char *s)
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,...