diff options
Diffstat (limited to 'src/commentscan.l')
-rw-r--r-- | src/commentscan.l | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/src/commentscan.l b/src/commentscan.l index f7a4e7d..35001c3 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -327,8 +327,7 @@ class DocCmdMapper { if (m_map.find(p->cmdName)!=0) { - err("DocCmdMapper: command %s already added\n",p->cmdName); - exit(1); + term("DocCmdMapper: command %s already added\n",p->cmdName); } Cmd *cmd = new Cmd; cmd->func = p->handler; @@ -395,7 +394,7 @@ class GuardedSection * statics */ -static ParserInterface *langParser; // the language parser that is calling us +static OutlineParserInterface *langParser; // the language parser that is calling us static QCString inputString; // input string static int inputPosition; // read pointer static QCString yyFileName; // file name that is read from @@ -415,11 +414,8 @@ static GuardType guardType; // kind of guard for conditional se static bool enabledSectionFound; static QCString functionProto; // function prototype static QStack<GuardedSection> guards; // tracks nested conditional sections (if,ifnot,..) -static Entry* current = 0 ; // working entry -//static Entry* current_root = 0 ; // parent of working entry +static Entry *current = 0; // working entry - -//static Entry* previous = 0 ; // TODO: remove need for this static bool needNewEntry; static QCString g_sectionLabel; @@ -533,11 +529,10 @@ static QCString stripQuotes(const char *s) static void addXRefItem(const char *listName,const char *itemTitle, const char *listTitle,bool append) { - Entry *docEntry = current; // inBody && previous ? previous : current; if (listName==0) return; //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append); - ListItemInfo *lii=0; + const ListItemInfo *lii=0; RefList *refList = Doxygen::xrefLists->find(listName); if (refList==0) // new list { @@ -545,16 +540,13 @@ static void addXRefItem(const char *listName,const char *itemTitle, Doxygen::xrefLists->insert(listName,refList); //printf("new list!\n"); } - if (docEntry->sli) + for (const ListItemInfo &item : current->sli) { - QListIterator<ListItemInfo> slii(*docEntry->sli); - for (slii.toLast();(lii=slii.current());--slii) + if (qstrcmp(item.type,listName)==0) { - if (qstrcmp(lii->type,listName)==0) - { - //printf("found %s lii->type=%s\n",listName,lii->type); - break; - } + //printf("found %s lii->type=%s\n",listName,lii->type); + lii = &item; + break; } } if (lii && append) // already found item of same type just before this one @@ -580,16 +572,16 @@ static void addXRefItem(const char *listName,const char *itemTitle, ASSERT(item!=0); item->text = outputXRef; item->listAnchor = anchorLabel; - docEntry->addSpecialListItem(listName,itemId); + current->addSpecialListItem(listName,itemId); QCString cmdString; cmdString.sprintf(" \\xrefitem %s %d.",listName,itemId); if (inBody) { - docEntry->inbodyDocs += cmdString; + current->inbodyDocs += cmdString; } else { - docEntry->doc += cmdString; + current->doc += cmdString; } SectionInfo *si = Doxygen::sectionDict->find(anchorLabel); if (si) @@ -609,7 +601,7 @@ static void addXRefItem(const char *listName,const char *itemTitle, g_sectionTitle,SectionInfo::Anchor, g_sectionLevel); Doxygen::sectionDict->append(anchorLabel,si); - docEntry->anchors->append(si); + current->anchors.push_back(si); } } outputXRef.resize(0); @@ -677,7 +669,7 @@ static void addSection() g_sectionTitle,sectionLevelToType(g_sectionLevel),g_sectionLevel); // add section to this entry - current->anchors->append(si); + current->anchors.push_back(si); // add section to the global dictionary Doxygen::sectionDict->append(g_sectionLabel,si); @@ -854,7 +846,7 @@ static void addAnchor(const char *anchor) { si = new SectionInfo(yyFileName,yyLineNr,anchor,0,SectionInfo::Anchor,0); Doxygen::sectionDict->append(anchor,si); - current->anchors->append(si); + current->anchors.push_back(si); } } @@ -1828,7 +1820,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" addOutput(yytext); // we add subpage labels as a kind of "inheritance" relation to prevent // needing to add another list to the Entry class. - current->extends->append(new BaseInfo(yytext,Public,Normal)); + current->extends.push_back(BaseInfo(yytext,Public,Normal)); BEGIN(SubpageTitle); } <SubpageLabel>{DOCNL} { // missing argument @@ -1977,7 +1969,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" BEGIN(Comment); } <GuardParamEnd>{B}* { - if (!g_spaceBeforeIf.isEmpty()) // needed for 665313 in combation with bug620924 + if (!g_spaceBeforeIf.isEmpty()) // needed for 665313 in combination with bug620924 { addOutput(g_spaceBeforeIf); } @@ -2145,8 +2137,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle argument of ingroup command ------- */ <InGroupParam>{LABELID} { // group id - current->groups->append( - new Grouping(yytext, Grouping::GROUPING_INGROUP) + current->groups.push_back( + Grouping(yytext, Grouping::GROUPING_INGROUP) ); inGroupParamFound=TRUE; } @@ -2228,8 +2220,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle argument of inherit command ------- */ <InheritParam>({ID}("::"|"."))*{ID} { // found argument - current->extends->append( - new BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal) + current->extends.push_back( + BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal) ); BEGIN( Comment ); } @@ -2251,8 +2243,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" /* ----- handle argument of extends and implements commands ------- */ <ExtendsParam>({ID}("::"|"."))*{ID} { // found argument - current->extends->append( - new BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal) + current->extends.push_back( + BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal) ); BEGIN( Comment ); } @@ -3134,7 +3126,7 @@ QCString preprocessCommentBlock(const QCString &comment, } } -bool parseCommentBlock(/* in */ ParserInterface *parser, +bool parseCommentBlock(/* in */ OutlineParserInterface *parser, /* in */ Entry *curEntry, /* in */ const QCString &comment, /* in */ const QCString &fileName, @@ -3288,13 +3280,4 @@ static void handleGuard(const QCString &expr) } } - - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void commentscanYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "commentscan.l.h" |