/***************************************************************************** * * * * Copyright (C) 1997-2000 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ %{ /* * includes */ #include #include #include #include #include #include "qtbc.h" #include #include #include #include "scanner.h" #include "entry.h" #include "doxygen.h" #include "message.h" #include "config.h" #include "util.h" #include "index.h" #include "defargs.h" #include "language.h" #include "outputlist.h" #include "membergroup.h" #ifndef WIN32 #include #endif #define YY_NEVER_INTERACTIVE 1 /* ----------------------------------------------------------------- * * statics */ static bool insideArgumentList; static QCString className; static QCString memberName; static OutputList * outDoc; static QCString code; static QCString linkRef; static QCString linkText; static QCString codeBlock; static const char * inputString; static int inputPosition; static int lastContext; static int lastCContext; static int lastDocContext; static int lastDocRelContext; static int lastCPPContext; static int lastSkipSharpContext; static int lastSkipRoundContext; static int lastBriefContext; static int lastVerbState; static int lastStringContext; static int lastCurlyContext; static int lastRoundContext; static int lastSquareContext; static int lastCodeState; static int lastAfterDocContext; static int lastGroupContext; static int lastFormulaContext; static int lastAnchorContext; static int lastInitializerContext; static int lastClassTemplSpecContext; static int lastSkipHtmlCommentContext; static int nextDefContext; static int overloadContext; static Protection protection; static Protection baseProt; static int sharpCount = 0 ; static int roundCount = 0 ; static int curlyCount = 0 ; static int squareCount = 0 ; static int ifCount = 0 ; static int todoAnchor = 0 ; static int todoStartContext = 0; static QCString todoString = 0; static Entry* current_root = 0 ; static Entry* global_root = 0 ; static Entry* current = 0 ; static Entry* previous = 0 ; static Entry* tempEntry = 0 ; static int yyLineNr = 1 ; static int anonCount = 0 ; static char yyFileName[4096] ; static int lastMemberGroupLine; static bool sig; static bool slot; static bool gstat; static bool removeSlashes; static Specifier virt; static Specifier baseVirt; static bool exampleDoc; static QCString exampleName; static QCString htmlUrl,htmlText; static QCString currentIncludeFile; static QCString msType,msName,msArgs; static int memberGroupId = NOGROUP; static QCString memberGroupHeader; static QCString memberGroupDocs; static int includeFileOffset = 0; static int includeFileLength = 0; static bool firstLine; static bool isTypedef; static bool inParamBlock; static bool inRetValBlock; static bool inExceptionBlock; static bool inSeeBlock; static bool inReturnBlock; static bool inAuthorBlock; static bool inDeprecatedBlock; static bool inVersionBlock; static bool inSinceBlock; static bool inDateBlock; static bool inBugBlock; static bool inNoteBlock; static bool inPreBlock; static bool inPostBlock; static bool inInvarBlock; static bool inWarningBlock; static bool inRemarkBlock; static bool inAttentionBlock; static bool inParBlock; static bool firstSeeArg; static char afterDocTerminator; static int tmpDocType; static QCString sectionLabel; static QCString sectionTitle; static SectionInfo::SectionType sectionType; static QCString funcPtrType; static QCString templateStr; static QCString baseName; static QCString *specName; static QCString formulaText; static QCString sectionRef; static bool insideIDL = FALSE; static bool insideCppQuote = FALSE; static bool insideVerbatim = FALSE; static int depthIf; // state variable for reading the argument list of a function static int argRoundCount; static int argSharpCount; static int currentArgumentContext; static int lastCopyArgStringContext; static int lastCopyArgContext; static int currentListIndentLevel; static QCString *copyArgString; static QCString fullArgString; static ArgumentList *currentArgumentList; static QCString *currentTemplateSpec; static QCString curImageName; static char lastCopyArgChar; static QCString *pCopyRoundString; static QCString *pCopyCurlyString; static QCString *pCopyQuotedString; //----------------------------------------------------------------------------- static void initParser() { insideArgumentList=FALSE; className.resize(0); memberName.resize(0); code.resize(0); linkRef.resize(0); linkText.resize(0); codeBlock.resize(0); htmlUrl.resize(0); htmlText.resize(0); currentIncludeFile.resize(0); sectionLabel.resize(0); sectionTitle.resize(0); baseName.resize(0); formulaText.resize(0); protection = Public; baseProt = Public; sharpCount = 0; roundCount = 0; curlyCount = 0; ifCount = 0; memberGroupId = NOGROUP; sig = FALSE; slot = FALSE; gstat = FALSE; virt = Normal; baseVirt = Normal; includeFileOffset = 0; includeFileLength = 0; firstLine = TRUE; isTypedef = FALSE; inParamBlock = FALSE; inRetValBlock = FALSE; inExceptionBlock = FALSE; inSeeBlock = FALSE; inReturnBlock = FALSE; inAuthorBlock = FALSE; inDeprecatedBlock = FALSE; inVersionBlock = FALSE; inSinceBlock = FALSE; inDateBlock = FALSE; inBugBlock = FALSE; inNoteBlock = FALSE; inPreBlock = FALSE; inPostBlock = FALSE; inInvarBlock = FALSE; inWarningBlock = FALSE; inRemarkBlock = FALSE; inAttentionBlock = FALSE; inParBlock = FALSE; firstSeeArg = FALSE; } //----------------------------------------------------------------------------- void scanString(const char *s); //----------------------------------------------------------------------------- class TableElem { public: TableElem(int r,int c); ~TableElem(); int getRow() { return row; } int getCol() { return col; } OutputList *outputList() { return ol; } private: OutputList *ol; int row; int col; }; TableElem::TableElem(int r,int c) { //printf("TableElem::TableElem(%d,%d)\n",r,c); ol=new OutputList(outDoc); outDoc=ol; row=r; col=c; } TableElem::~TableElem() { //printf("TableElem::~TableElem(%d,%d)\n",row,col); delete ol; ol=0; } class Table { public: Table(); ~Table(); void newRow(); void newElem(); private: OutputList *parentDoc; QList *elemList; int curRow; int curCol; int rows; int cols; }; Table::Table() { parentDoc=outDoc; elemList=new QList; elemList->setAutoDelete(TRUE); curRow=curCol=rows=cols=0; } Table::~Table() { //printf("Table::~Table()\n"); // use elemList & cols & rows if (cols>0 && rows>0) { parentDoc->startTable(cols); TableElem *e=elemList->first(); while (e) { if (e->getRow()>0) { if (e->getCol()==0) { if (e->getRow()>1) parentDoc->endTableRow(); parentDoc->nextTableRow(); } else { parentDoc->nextTableColumn(); } *parentDoc+=*e->outputList(); parentDoc->endTableColumn(); } e=elemList->next(); } parentDoc->endTable(); } delete elemList; elemList=0; outDoc=parentDoc; } void Table::newRow() { //printf("Table::newRow()\n"); curRow++; if (curRow>rows) rows=curRow; curCol=0; } void Table::newElem() { //printf("Table::newElem(%d,%d)\n",curRow,curCol); TableElem *te = new TableElem(curRow,curCol); elemList->append(te); curCol++; if (curCol>cols) cols=curCol; } static QStack tableStack; static Table *curTable; static void startTable() { //printf("startTable()\n"); curTable=new Table; tableStack.push(curTable); } static void endTable() { //printf("endTable()\n"); delete tableStack.pop(); // the destructor adds the table to the stream! curTable=tableStack.top(); } static void forceEndTable() { err("Error: More
tags found than
" "tags in documentation block in file %s!\n",yyFileName); while (!tableStack.isEmpty()) { endTable(); } } //----------------------------------------------------------------------------- static void lineCount() { for( const char* c = yytext ; *c ; ++c ) yyLineNr += (*c == '\n') ; } static void endArgumentList() { if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } } static void addType( Entry* current ) { if( current->type.length() ) current->type += ' ' ; current->type += current->name ; current->name.resize(0) ; if( current->type.length() ) current->type += ' ' ; current->type += current->args ; current->args.resize(0) ; current->argList->clear(); } static void includeFile(OutputList &ol,const char *fileName,bool quiet) { //FileInfo *f; bool ambig; FileDef *fd; if ((fd=findFileDef(exampleNameDict,fileName,ambig))) { currentIncludeFile=fileToString(fd->absFilePath()); includeFileOffset=0; includeFileLength=currentIncludeFile.length(); OutputList codeFrag(&ol); parseCode(codeFrag,0,currentIncludeFile,exampleDoc,exampleName); if (!quiet) { ol.startCodeFragment(); ol+=codeFrag; ol.endCodeFragment(); } } else if (ambig) { QCString text; text.sprintf("Include file name %s is ambigious.\n",fileName); text+="Possible candidates:\n"; text+=showFileDefMatches(exampleNameDict,fileName); warn(yyFileName,yyLineNr,text); } else { warn(yyFileName,yyLineNr, "Warning: example file %s is not found. " "Check your EXAMPLE_PATH",fileName ); } } static void verbIncludeFile(OutputList &ol,const char *name) { //FileInfo *f; bool ambig; FileDef *fd; if ((fd=findFileDef(exampleNameDict,name,ambig))) { ol.startCodeFragment(); ol.codify(fileToString(fd->absFilePath())); ol.endCodeFragment(); } else if (ambig) { QCString text; text.sprintf("Include file name %s is ambigious.\n",name); text+=("Possible candidates:\n"); text+=showFileDefMatches(exampleNameDict,name); warn(yyFileName,yyLineNr,text); } else { warn(yyFileName,yyLineNr, "Warning: example file %s is not found. " "Check your EXAMPLE_PATH",name); } } static QCString stripQuotes(const char *s) { QCString name; if (s==0 || *s==0) return name; name=s; if (name.at(0)=='"' && name.at(name.length()-1)=='"') { name=name.mid(1,name.length()-2); } return name; } static QCString stripKnownExtensions(const char *text) { QCString result=text; if (result.right(4)==".tex") result=result.left(result.length()-4); else if (result.right(5)==".html") result=result.left(result.length()-5); //printf("%s stripKnowExtensions(%s)\n",result.data(),text); return result; } static void skipLine(OutputList &ol,const char *key) { bool found=FALSE; while (!found) { QCString s; char c; while ( includeFileOffset listIndentStack; static bool insideItemList = FALSE; static void addListItemMarker(const char *marker) { // find the actual position at which the bullet was found int indent=0; const char *p=marker; char c; while ((c=*p++)) { if (c=='\t') { indent+=Config::tabSize - (indent%Config::tabSize); } else { indent++; } } //printf("list marker found at column %d\n",indent); if (!insideItemList) { outDoc->startItemList(); outDoc->writeListItem(); listIndentStack.push(new int(indent)); insideItemList=TRUE; } else { int *pPrevIndent = listIndentStack.top(); if (*pPrevIndent==indent) // new item at the same indent level { outDoc->writeListItem(); } else if (*pPrevIndentstartItemList(); outDoc->writeListItem(); listIndentStack.push(new int(indent)); } else // end sub item list { listIndentStack.pop(); delete pPrevIndent; outDoc->endItemList(); // safe guard against wrong indenting if (listIndentStack.isEmpty()) { insideItemList=FALSE; warn(yyFileName,yyLineNr, "Warning: list item with invalid indent found!"); } else { outDoc->writeListItem(); } } } } static void forceEndItemList() { int *indent; while ((indent=listIndentStack.pop())!=0) { outDoc->endItemList(); delete indent; } insideItemList=FALSE; } #if 0 static void tryEndItemList() { if (listIndentStack.count()==1) // no subitems => end list { outDoc->endItemList(); delete listIndentStack.pop(); insideItemList=FALSE; } } #endif //----------------------------------------------------------------- static bool inBlock() { return inParamBlock || inRetValBlock || inSeeBlock || inReturnBlock || inAuthorBlock || inVersionBlock || inSinceBlock || inDateBlock || inWarningBlock || inRemarkBlock || inAttentionBlock || inBugBlock || inNoteBlock || inParBlock || inExceptionBlock || inDeprecatedBlock || inPreBlock || inPostBlock || inInvarBlock; } static void endBlock() { if (inParamBlock || inRetValBlock || inExceptionBlock) { outDoc->endDescTableData(); outDoc->endDescTable(); } outDoc->endDescList(); inParamBlock=inRetValBlock=inSeeBlock=inReturnBlock=inAuthorBlock= inVersionBlock=inSinceBlock=inDateBlock=inBugBlock=inNoteBlock=inWarningBlock= inParBlock=inExceptionBlock=inDeprecatedBlock=inPreBlock=inPostBlock= inInvarBlock=inRemarkBlock=inAttentionBlock=FALSE; } static void addSection() { //printf("New section pageName=%s label=%s title=%s\n", // current->name.data(),sectionLabel.data(),sectionTitle.data()); if (sectionLabel.isEmpty()) return; if (sectionDict[sectionLabel]==0) { SectionInfo *si=new SectionInfo(sectionLabel,sectionTitle,sectionType); //printf("Adding section addr=%p label=`%s' sectionTitle=`%s' fileName=%s\n",si,sectionLabel.data(),sectionTitle.data(),si->fileName.data()); sectionDict.insert(sectionLabel,si); current->anchors->append(new QCString(sectionLabel)); } else { warn(yyFileName,yyLineNr, "Warning: Duplicate label %s found!",sectionLabel.data()); } } // Adds a formula text to the list/dictionary of formulas if it was // not already added. Returns the label of the formula. static QCString addFormula() { QCString formLabel; QCString fText=formulaText.simplifyWhiteSpace(); Formula *f=0; if ((f=formulaDict[fText])==0) { f = new Formula(fText); formulaList.append(f); formulaDict.insert(fText,f); formLabel.sprintf("\\form#%d",f->getId()); formulaNameDict.insert(formLabel,f); } else { formLabel.sprintf("\\form#%d",f->getId()); } return formLabel; } static bool nameIsOperator(QCString &name) { return name.right(8)=="operator" && (name.length()==8 || !isId(name.at(name.length()-9))); } static void checkDocs() { if ((current->brief.length()>2 && current->brief.at(0)=='<' && current->brief.at(1)==' ') || (current->doc.length()>2 && current->doc.at(0)=='<' && current->doc.at(1)==' ') ) { warn("Warning: Found lonely '<' symbol at the start of the documentation " "at line %d of %s",yyLineNr,yyFileName); } } //static bool curLatexState; //static bool curManState; //static bool curHtmlState; // //static void storeOutputListState() //{ // curLatexState = outDoc->isEnabled(OutputGenerator::Latex); // curHtmlState = outDoc->isEnabled(OutputGenerator::Html); // curManState = outDoc->isEnabled(OutputGenerator::Man); //} // //static void restoreOutputListState() //{ // if (curLatexState) // outDoc->enable(OutputGenerator::Latex); // else // outDoc->disable(OutputGenerator::Latex); // if (curHtmlState) // outDoc->enable(OutputGenerator::Html); // else // outDoc->disable(OutputGenerator::Html); // if (curManState) // outDoc->enable(OutputGenerator::Man); // else // outDoc->disable(OutputGenerator::Man); //} enum ImageTypes { IT_Html, IT_Latex }; // search for an image in the imageNameDict and if found // copies the image to the output directory (which is the // html directory if type==0 or the latex directory if type==1) static QCString findAndCopyImage(const char *fileName,ImageTypes type) { QCString result; bool ambig; FileDef *fd; if ((fd=findFileDef(imageNameDict,fileName,ambig))) { QFile inImage(fd->absFilePath().data()); if (inImage.open(IO_ReadOnly)) { result = fileName; int i; if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1) { result.right(result.length()-i-1); } QCString outputDir; switch(type) { case IT_Html: outputDir = Config::htmlOutputDir; break; case IT_Latex: outputDir = Config::latexOutputDir; break; } QCString outputFile = outputDir+"/"+result; QFile outImage(outputFile.data()); if (outImage.open(IO_WriteOnly)) // copy the image { char *buffer = new char[inImage.size()]; inImage.readBlock(buffer,inImage.size()); outImage.writeBlock(buffer,inImage.size()); outImage.flush(); delete buffer; } else { warn(yyFileName,yyLineNr, "Warning: could not write output image %s",outputFile.data()); } } else { warn(yyFileName,yyLineNr, "Warning: could not open image %s",fileName); } } else if (ambig) { QCString text; text.sprintf("Warning: image file name %s is ambigious.\n",fileName); text+="Possible candidates:\n"; text+=showFileDefMatches(imageNameDict,fileName); warn(yyFileName,yyLineNr,text); } else { result=fileName; if (result.left(5)!="http:" && result.left(6)!="https:") { warn(yyFileName,yyLineNr, "Warning: image file %s is not found in IMAGE_PATH: " "assuming external image.",fileName ); } } return result; } QCString extractName(const QCString &s) { uint i=0; while (i]+)/">")?) %} CMD ("\\"|"@") BN [ \t\n\r] BL [ \t\r]*"\n" B [ \t] BS ^(({B}*"//")?)(({B}*"*"+)?){B}* FILE ([a-z_A-Z0-9\.\\:\/\-\+]+)|("\""[^\n\"]+"\"") FILEMASK [a-z_A-Z0-9\.\\:\/\-\+]+"."[a-z_A-Z0-9\.\-\+]*[a-z_A-Z0-9\-\+] ID [a-z_A-Z][a-z_A-Z0-9]* SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+ URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/\=]+ NONTERM [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9] WORD ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"") ATTR ({B}+[^>\n]*)? A [aA] BOLD [bB] BODY [bB][oO][dD][yY] BR [bB][rR] EM [eE][mM] CENTER [cC][eE][nN][tT][eE][rR] CODE [cC][oO][dD][eE] DL [dD][lL] DD [dD][dD] DT [dD][tT] DFN [dD][fF][nN] FORM [fF][oO][rR][mM] H1 [hH]1 H2 [hH]2 H3 [hH][3-6] HEAD [hH][eE][aA][dD] HR [hH][rR] HREF [hH][rR][eE][fF] I [iI] IMG [iI][mM][gG] INPUT [iI][nN][pP][uU][tT] LI [lL][iI] META [mM][eE][tT][aA] MULTICOL [mM][uU][lL][tT][iI][cC][oO][lL] NAME [nN][aA][mM][eE] OL [oO][lL] P [pP] PRE [pP][rR][eE] SMALL [sS][mM][aA][lL][lL] STRONG [sS][tT][rR][oO][nN][gG] SUB [sS][uU][bB] SUP [sS][uU][pP] SRC [sS][rR][cC] TABLE [tT][aA][bB][lL][eE] TITLE [tT][iI][tT][lL][eE] TD [tT][dD] TR [tT][rR] TT [tT][tT] UL [uU][lL] VAR [vV][aA][rR] DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") %option noyywrap %x Define %x DefineArg %x DefineEnd %x Include %x CompoundName %x ClassVar %x ClassTemplSpec %x Bases %x BasesProt %x NextSemi %x FindMembers %x FindMemberName %x FindFields %x FindFieldArg %x Function %x FuncRound %x ExcpRound %x FuncQual %x Operator %x Array %x ReadBody %x Using %x UsingDirective %x NameSpaceDocArg1 %x SkipCurly %x SkipCurlyCpp %x SkipCurlyEndDoc %x SkipString %x SkipInits %x SkipCPP %x SkipCPPBlock %x SkipComment %x SkipCxxComment %x SkipCurlyBlock %x SkipRoundBlock %x SkipCode %x Sharp %x SkipSharp %x SkipRound %x SkipSquare %x TypedefName %x Comment %x Doc %x JavaDoc %x ClassDoc %x LineDoc %x DefLineDoc %x ClassDocArg1 %x ClassDocArg2 %x ClassDocArg3 %x ClassDocFunc %x ClassDocFuncPtr %x ClassDocFuncQual %x ClassDocFuncSkipLine %x ClassDocFuncExc %x ClassDocDefine %x ClassDocRelates %x ClassDocBrief %x ClassDocOverload %x ClassDefineArgs %x CppQuote %x EndCppQuote %x GroupDocArg1 %x GroupDocArg2 %x GroupName %x GroupHeader %x StoreGroupDocs %x AfterDoc %x AfterDocBrief %x AfterDocLine %x PageDoc %x PageDocTitle %x PageDocArg1 %x PageDocArg2 %x FileDocArg1 %x FileDocArg2 %x ExampleDoc %x ExampleDocArg1 %x EnumDoc %x EnumDocArg1 %x FuncPtr %x EndFuncPtr %x FuncFunc %x FuncFuncEnd %x FuncFuncType %x MemberSpec %x MemberSpecSkip %x SkipVerbatim %x Text %x DocScan %x DocParam %x DocException %x DocHtmlScan %x DocLatexScan %x DocEmphasis %x DocBold %x DocCode %x DocIf %x DocCodeBlock %x DocInternal %x DocLink %x DocLinkText %x DocSkipWord %x DocInclude %x DocDontInclude %x DocDescItem %x DocHtmlLink %x DocHtmlAnchor %x DocHtmlHref1 %x DocHtmlHref2 %x DocBaseClass %x DocSkiplineKey %x DocSkipKey %x DocLineKey %x DocUntilKey %x DocKeyEnd %x DocPar %x DocRefName %x DocVerbatim %x DocVerbInc %x DocIndexWord %x DocRef %x DocRefArg %x DocRefArgStart %x DocRefItem %x DocRefItemName %x DocImage %x DocHtmlImageName %x DocLatexImageName %x DocLatexImageWidth %x TodoParam %x SectionLabel %x SectionTitle %x SkipTemplate %x EndTemplate %x CopyArgString %x CopyArgRound %x CopyArgSharp %x CopyArgComment %x CopyArgCommentLine %x SkipUnionSwitch %x ReadFuncArgType %x ReadTempArgs %x Specialization %x SkipHtmlComment %x ReadFormulaShort %x ReadFormulaLong %x AnchorLabel %x ReadInitializer %x CopyString %x CopyRound %x CopyCurly %x IDLUnionCase %% <*>\x06[^\x06]*\x06 { // new file if (memberGroupId!=NOGROUP) { warn(yyFileName,yyLineNr,"Warning: Missing //@}"); memberGroupId=NOGROUP; } yyLineNr= 0 ; // there is always an extra newline at the start of the file int i; for( i = 0 ; yytext[i+1] != 6 ; i++ ) yyFileName[i] = yytext[i+1] ; yyFileName[i] = 0 ; insideIDL = i>4 && strcmp(&yyFileName[i-4],".idl")==0; msg("Parsing file %s...\n",yyFileName); current_root = global_root ; initParser(); current->reset(); int sec=guessSection(yyFileName); if (sec) { current->name = yyFileName; current->name = current->name; current->section = sec; current_root->addSubEntry(current); current = new Entry; } BEGIN( FindMembers ); } <*>\x0d /* ^{BL} { if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } else { outDoc->newParagraph(); } if (inBlock()) endBlock(); } */ ^{B}*(("//"{B}*)?)"*"*{B}*"-"{B}+ { /* found list item marker */ addListItemMarker(yytext); } \n{B}*(("//"{B}*)?)"*"*{B}*"-"{B}+ { addListItemMarker(yytext+1); } "©" { outDoc->writeCopyright(); } """ { outDoc->writeQuote(); } "&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } "&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } "&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } "&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } "&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } "ß" { outDoc->writeSharpS(); } "&[aA]ring;" { outDoc->writeRing(yytext[1]); } "$("[a-z_A-Z]+")" { QCString envvar=&yytext[2]; envvar=envvar.left(envvar.length()-1); outDoc->docify(getenv(envvar)); } {CMD}"htmlonly"/[^a-z_A-Z0-9] { outDoc->pushGeneratorState(); /*storeOutputListState();*/ outDoc->disableAllBut(OutputGenerator::Html); BEGIN(DocHtmlScan); } {CMD}"endhtmlonly"/[^a-z_A-Z0-9] { /*restoreOutputListState();*/ outDoc->popGeneratorState(); BEGIN(DocScan); } {CMD}"latexonly"/[^a-z_A-Z0-9] { /*storeOutputListState();*/ outDoc->pushGeneratorState(); outDoc->disableAllBut(OutputGenerator::Latex); BEGIN(DocLatexScan); } {CMD}"endlatexonly"/[^a-z_A-Z0-9] { /*restoreOutputListState();*/ outDoc->popGeneratorState(); BEGIN(DocScan); } "//"|"/*"|"*/" { outDoc->writeString(yytext); } .|\n { char c[2]; c[0]=*yytext;c[1]='\0'; outDoc->writeString(c); } "\\postheader"/{BN} "\\functionindex"/{BN} { writeMemberList(*outDoc); } "\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); } "\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); } "\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ } "\\header"/{BN} { BEGIN( DocSkipWord ); } "\\define"/{BN} { BEGIN( DocSkipWord ); } {CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); } {FILE} { verbIncludeFile(*outDoc,stripQuotes(yytext)); BEGIN( DocScan ); } {CMD}"verbatim"/[^a-z_A-Z0-9] { outDoc->startCodeFragment(); insideVerbatim=TRUE; BEGIN(DocVerbatim); } {CMD}"endverbatim"/[^a-z_A-Z0-9] { outDoc->endCodeFragment(); insideVerbatim=FALSE; BEGIN(DocScan); } [^\n\\\@]*"\n" { //printf("docifying: %s\n",yytext); outDoc->codify(yytext); } "\n"|"//"|"/*"|"*/" { outDoc->codify(yytext); } . { //printf("char %c\n",*yytext); char c[2];c[0]=*yytext;c[1]='\0'; outDoc->codify(c); } {CMD}"internal"/{BN} { if (!Config::internalDocsFlag) { outDoc->newParagraph(); scanString(theTranslator->trForInternalUseOnly()+"\n"); //outDoc->writeString("For internal use only.\n"); BEGIN( DocInternal ); } } "\\reimp"/{BN} { outDoc->newParagraph(); scanString(theTranslator->trReimplementedForInternalReasons()+"\n"); } {CMD}"link"/{BN} { BEGIN( DocLink ); } [a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); } [a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well! linkRef = stripKnownExtensions(yytext); linkText = ""; BEGIN( DocLinkText ); } . { linkText += *yytext; } "\n" { linkText += " "; } {CMD}"endlink" { // <- needed for things like \endlink. //printf("GenerateLink className=`%s' linkRef=`%s' linkText=`%s'\n", // className.data(),linkRef.data(),linkText.data()); generateLink(*outDoc,className,linkRef,inSeeBlock,linkText.stripWhiteSpace()); BEGIN( DocScan ); } /* "@ref"{B}+ { BEGIN(DocRef); } {SCOPENAME} { generateLink(*outDoc,className,yytext,TRUE,0); BEGIN( DocScan ); } */ {CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr, "Warning: \\endlink without \\link " "in documentation." ); } {CMD}"addindex"/{BN} { BEGIN(DocIndexWord); } "\\form#"[0-9]+ { Formula *formula=formulaNameDict[yytext]; if (formula) { QCString formName; formName.sprintf("form-%d.gif",formula->getId()); outDoc->writeFormula(formName,formula->getFormulaText()); } } [^\n]+ { //printf("Adding %s to index\n",yytext); outDoc->addToIndex(yytext,0); BEGIN(DocScan); } {CMD}"arg"/{BN} { if (insideArgumentList) { outDoc->writeListItem(); } else { outDoc->startItemList(); outDoc->writeListItem(); insideArgumentList=TRUE; } } {CMD}"par"{B}+ { BEGIN(DocPar); } [^\n]*{BN} { endArgumentList(); if (inBlock()) endBlock(); inParBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); outDoc->docify(((QCString)yytext).stripWhiteSpace()); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); BEGIN(DocScan); } {CMD}"warning"/{BN} { endArgumentList(); if (!inWarningBlock) { if (inBlock()) endBlock(); inWarningBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trWarning()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"remark"[s]?/{BN} { endArgumentList(); if (!inRemarkBlock) { if (inBlock()) endBlock(); inRemarkBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trRemarks()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"attention"[s]?/{BN} { endArgumentList(); if (!inAttentionBlock) { if (inBlock()) endBlock(); inAttentionBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trAttention()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"bug"[s]?/{BN} { endArgumentList(); if (!inBugBlock) { if (inBlock()) endBlock(); inBugBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trBugsAndLimitations()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"note"[s]?/{BN} { endArgumentList(); if (!inNoteBlock) { if (inBlock()) endBlock(); inNoteBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trNote()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"pre"/{BN} { endArgumentList(); if (!inPreBlock) { if (inBlock()) endBlock(); inPreBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trPrecondition()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"post"/{BN} { endArgumentList(); if (!inPostBlock) { if (inBlock()) endBlock(); inPostBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trPostcondition()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"invariant"/{BN} { endArgumentList(); if (!inInvarBlock) { if (inBlock()) endBlock(); inInvarBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trInvariant()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"version"/{BN} { endArgumentList(); if (!inVersionBlock) { if (inBlock()) endBlock(); inVersionBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trVersion()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"since"/{BN} { endArgumentList(); if (!inSinceBlock) { if (inBlock()) endBlock(); inSinceBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trSince()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"date"/{BN} { endArgumentList(); if (!inDateBlock) { if (inBlock()) endBlock(); inDateBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trDate()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } {CMD}"deprecated"/{BN} { endArgumentList(); if (!inDeprecatedBlock) { if (inBlock()) endBlock(); inDeprecatedBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trDeprecated()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->writeDescItem(); } } "$"[a-zA-Z_0-9]+":"[^\n\$]+"$" { // RCS tag QCString tagName(&yytext[1]); int i=tagName.find(':'); tagName=tagName.left(i); QCString tagText=&yytext[i+2]; tagText=tagText.left(tagText.length()-1); endArgumentList(); if (inBlock()) endBlock(); outDoc->startDescList(); outDoc->startBold(); scanString(tagName+": "); outDoc->endBold(); outDoc->endDescTitle(); scanString(tagText); outDoc->endDescList(); } {CMD}"author"/{BN} { endArgumentList(); if (!inAuthorBlock) { if (inBlock()) endBlock(); inAuthorBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trAuthors()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->docify(", "); } } {CMD}("return"([s])?|"result")/{BN} { endArgumentList(); if (!inReturnBlock) { if (inBlock()) endBlock(); inReturnBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trReturns()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } } {CMD}("sa"|"see")/{BN} { endArgumentList(); if (!inSeeBlock) { if (inBlock()) endBlock(); inSeeBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trSeeAlso()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); } else { outDoc->docify(", "); } } (({B}*"\n"){2,}{B}*)?{CMD}"param"/{BN} { QCString t=yytext; if (t.contains('\n')>1 && insideItemList) { forceEndItemList(); } endArgumentList(); if (!inParamBlock) { if (inBlock()) endBlock(); inParamBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trParameters()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); outDoc->startDescTable(); } else { outDoc->endDescTableData(); } BEGIN(DocParam); } (({B}*"\n"){2,}{B}*)?{CMD}"retval"/{BN} { QCString t=yytext; if (t.contains('\n')>1 && insideItemList) { forceEndItemList(); } endArgumentList(); if (!inRetValBlock) { if (inBlock()) endBlock(); inRetValBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trReturnValues()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); outDoc->startDescTable(); } else { outDoc->endDescTableData(); } BEGIN(DocParam); } (({B}*"\n"){2,}{B}*)?{CMD}("exception"|"throw")s?/{BN} { QCString t=yytext; if (t.contains('\n')>1 && insideItemList) { forceEndItemList(); } endArgumentList(); if (!inExceptionBlock) { if (inBlock()) endBlock(); inExceptionBlock=TRUE; outDoc->startDescList(); outDoc->startBold(); scanString(theTranslator->trExceptions()+": "); outDoc->endBold(); outDoc->endDescTitle(); outDoc->writeDescItem(); outDoc->startDescTable(); } else { outDoc->endDescTableData(); } BEGIN(DocException); } "\\capt".* ({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} { outDoc->startDescTableTitle(); outDoc->startEmphasis(); outDoc->docify(substitute(yytext,"\"","")); outDoc->endEmphasis(); outDoc->endDescTableTitle(); outDoc->startDescTableData(); BEGIN(DocScan); } {SCOPENAME} { outDoc->startDescTableTitle(); outDoc->startEmphasis(); outDoc->docify(yytext); outDoc->endEmphasis(); outDoc->endDescTableTitle(); outDoc->startDescTableData(); BEGIN(DocScan); } {CMD}"section "{ID}"\n" { QCString secName=&yytext[9]; // skip "\section " secName=secName.left(secName.length()-1); // remove \n //printf("SectionName %s found\n",secName.data()); SectionInfo *sec; if ((sec=sectionDict[secName])) { //printf("Title %s\n",sec->title.data()); outDoc->writeSection(sec->label,sec->title, sec->type==SectionInfo::Subsection); } } {CMD}"anchor "{ID}"\n" { QCString secName=&yytext[8]; secName=secName.left(secName.length()-1); SectionInfo *sec; if ((sec=sectionDict[secName])) { //printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data()); outDoc->writeAnchor(sec->fileName,sec->label); } } {CMD}"ref" { BEGIN(DocRefName); } {CMD}"refitem" { BEGIN(DocRefItem); } {CMD}"if"/{BN} { outDoc->pushGeneratorState(); depthIf++; BEGIN(DocIf); } {CMD}"endif"/[^a-z_A-Z0-9] { if (--depthIf<0) { warn(yyFileName,yyLineNr, "Warning: documentation block contains \\endif without " "matching \\if found in documentation." ); } else { outDoc->popGeneratorState(); } } [^\n\t ]+ { if (Config::sectionFilterList.find(yytext)==-1) { outDoc->disableAll(); } BEGIN(DocScan); } {SCOPENAME} { QCString ref=yytext; SectionInfo *sec; if ((sec=sectionDict[ref])) { QCString text; if (sec->title.isEmpty()) text=sec->label; else text=sec->title; if (sec->type==SectionInfo::Anchor) { //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); outDoc->writeObjectLink(0,sec->fileName,sec->label,text); writePageRef(*outDoc,sec->label,0); } else { //printf(" ref sec=%p sec->fileName=%s text=%s\n",sec,sec->fileName.data(),text.data()); outDoc->writeSectionRef(sec->fileName,sec->label,text); } } else if (!generateLink(*outDoc,className,yytext,TRUE,0)) { warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",yytext); outDoc->writeBoldString(" unknown reference! "); } BEGIN(DocScan); } {SCOPENAME}{B}+/"\"" { sectionRef=yytext; sectionRef=sectionRef.stripWhiteSpace(); BEGIN(DocRefArgStart); } "\"" { BEGIN(DocRefArg); } [^\"\n]+[\n\"] { yytext[yyleng-1]='\0'; QCString text=substitute(yytext,"\\\\","\\"); SectionInfo *sec; if ((sec=sectionDict[sectionRef])) { if (sec->type==SectionInfo::Anchor) { //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); outDoc->writeObjectLink(0,sec->fileName,sec->label,text); //printf("Writing page ref `%s'\n",sec->label.data()); writePageRef(*outDoc,sec->label,0); } else { outDoc->writeSectionRef(sec->fileName,sec->label,text); } } else if (!generateLink(*outDoc,className,sectionRef,TRUE,text)) { warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data()); outDoc->writeBoldString(" unknown reference! "); } BEGIN(DocScan); } {ID} { sectionRef=yytext; BEGIN(DocRefItemName); } .*/"\n" { SectionInfo *sec; QCString text=yytext; if ((sec=sectionDict[sectionRef])) { outDoc->writeSectionRefItem(sec->fileName,sec->label,text.stripWhiteSpace()); } else { warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data()); outDoc->writeBoldString(" unknown reference! "); } BEGIN(DocScan); } {CMD}"image"{B}+ { BEGIN(DocImage); } [hH][tT][mM][lL] { BEGIN(DocHtmlImageName); } [lL][aA][tT][eE][xX] { BEGIN(DocLatexImageName); } {FILE}|{URLMASK} { curImageName = findAndCopyImage(stripQuotes(yytext),IT_Html); if (!curImageName.isEmpty()) { /*storeOutputListState();*/ outDoc->pushGeneratorState(); outDoc->disableAllBut(OutputGenerator::Html); outDoc->writeImage(curImageName,0,0); /*restoreOutputListState();*/ outDoc->popGeneratorState(); } BEGIN(DocScan); } {FILE} { curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex); if (curImageName.isEmpty()) BEGIN(DocScan); else BEGIN(DocLatexImageWidth); } \n { // no width specified /*storeOutputListState();*/ outDoc->pushGeneratorState(); outDoc->disableAllBut(OutputGenerator::Latex); outDoc->writeImage(curImageName,0,0); /*restoreOutputListState();*/ outDoc->popGeneratorState(); BEGIN(DocScan); } "width"{B}*"="{B}*[0-9\.]+({B}*{ID})? { /*storeOutputListState();*/ outDoc->pushGeneratorState(); outDoc->disableAllBut(OutputGenerator::Latex); outDoc->writeImage(curImageName,yytext,0); /*restoreOutputListState();*/ outDoc->popGeneratorState(); BEGIN(DocScan); } "height"{B}*"="{B}*[0-9\.]+({B}*{ID})? { /*storeOutputListState();*/ outDoc->pushGeneratorState(); outDoc->disableAllBut(OutputGenerator::Latex); outDoc->writeImage(curImageName,0,yytext); /*restoreOutputListState();*/ outDoc->popGeneratorState(); BEGIN(DocScan); } [a-z_A-Z0-9\.\-]+ { warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext); } \n { warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!"); outDoc->enableAll(); BEGIN(DocScan); } {CMD}"code"({BN}*"\n"|{B}*) { outDoc->startCodeFragment(); codeBlock.resize(0); BEGIN( DocCodeBlock ); } {CMD}"endcode"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr,"Warning: \\endcode without
 or \\code "
    					       "in the documentation."); 
					}
					
{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"?	{
  					  generateRef(*outDoc,className,yytext,inSeeBlock);
  					}
{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" {
  					  generateRef(*outDoc,className,yytext,inSeeBlock);
  					}
{SCOPEMASK}("()")?		{
  					  generateRef(*outDoc,className,yytext,inSeeBlock);
  					}
({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")"	{ 
				          QCString oName=yytext;
					  generateRef(*outDoc,className,
					              removeRedundantWhiteSpace(oName),inSeeBlock);
					}
({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")"	{ 
    					  QCString oName=yytext;
					  generateRef(*outDoc,className,
					              removeRedundantWhiteSpace(oName),inSeeBlock);
					}
("http:"|"https:"|"ftp:"|"file:"){URLMASK}	{ outDoc->writeHtmlLink(yytext,yytext); }
[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+	{ outDoc->writeMailLink(yytext); }
{FILEMASK}			{
					  generateFileRef(*outDoc,yytext);
					}
{BN}*{CMD}"endcode"/[^a-z_A-Z0-9]  { // needed to match things like \endcode. (note the dot)
				          parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
					  //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
					  outDoc->endCodeFragment();
					  BEGIN( DocScan ); 
					}
""	{ 
				          parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
					  //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
					  outDoc->endCodeFragment();
					  BEGIN( DocScan ); 
					}
{CMD}"e"{BN}+	                { BEGIN( DocEmphasis ); }
{CMD}"a"{BN}+                  { BEGIN( DocEmphasis ); }
{CMD}"b"{BN}+			{ BEGIN( DocBold ); }
{CMD}"c"{BN}+                  { BEGIN( DocCode ); }
{CMD}"l"{BN}+		
"\\n"/[^a-z_A-Z0-9]		{ outDoc->lineBreak(); }
{CMD}"include"{BN}+		{ BEGIN( DocInclude ); }
{CMD}"dontinclude"{BN}+	{ BEGIN( DocDontInclude ); }
{CMD}"skip"{BN}+	 	{ BEGIN( DocSkipKey ); }	
{CMD}"skipline"{BN}+		{ BEGIN( DocSkiplineKey ); firstLine=TRUE; }
{CMD}"line"{BN}+		{ BEGIN( DocLineKey ); firstLine=TRUE; }
{CMD}"until"{BN}+		{ BEGIN( DocUntilKey ); firstLine=TRUE; }
[^ \t\r\n]+			{ 
  					  if (includeFileLength>0) 
					    skipUntil(yytext); 
  					  BEGIN( DocScan );
					}
[^ \t\r\n]+			{ 
  					  if (includeFileLength>0) 
					  {
					    if (firstLine) outDoc->startCodeFragment();
					    firstLine=FALSE;
					    showLine(*outDoc,yytext); 
					    BEGIN( DocKeyEnd );
					  }
					  else
					  {
  					    BEGIN( DocScan );
					  }
					}
[^ \t\r\n]+		{ 
  					  if (includeFileLength>0) 
					  {
					    if (firstLine) outDoc->startCodeFragment();
					    firstLine=FALSE;
					    skipLine(*outDoc,yytext); 
					    BEGIN( DocKeyEnd );
					  }
					  else
					  {
  					    BEGIN( DocScan );
					  }
					}
[^ \t\r\n]+		{ 
  					  if (includeFileLength>0) 
					  {
					    if (firstLine) outDoc->startCodeFragment();
					    firstLine=FALSE;
					    showUntil(*outDoc,yytext); 
					    BEGIN( DocKeyEnd );
					  }
					  else
					  {
  					    BEGIN( DocScan );
					  }
					}
{CMD}"line"{BN}+		{ BEGIN(DocLineKey); }
{CMD}"until"{BN}+		{ BEGIN(DocUntilKey); }
{CMD}"skipline"{BN}+		{ BEGIN(DocSkiplineKey); }
\n
<>			{
  					  if (!firstLine) outDoc->endCodeFragment();
					  yyterminate();
  					}
.				{
  					  unput(*yytext);
  					  if (!firstLine) outDoc->endCodeFragment();
					  BEGIN( DocScan );
  					}
"<"{MULTICOL}{ATTR}">"		
""
"<"{STRONG}{ATTR}">"		{ outDoc->startBold(); }
""		{ outDoc->endBold(); }
"<"{CENTER}{ATTR}">"		{ outDoc->startCenter(); }
""		{ outDoc->endCenter(); }
"<"{TABLE}{ATTR}">"		{ startTable(); }
""		{ endTable(); }
"<"{INPUT}{ATTR}">"
"<"{SMALL}{ATTR}">"		{ outDoc->startSmall(); }
""		{ outDoc->endSmall(); }
"<"{META}{ATTR}">"
"<"{FORM}{ATTR}">"
""
"<"{HEAD}{ATTR}">"			
""			
"<"{BODY}{ATTR}">"
""
"<"{CODE}{ATTR}">"		{ outDoc->startTypewriter(); }
""		{ outDoc->endTypewriter(); }
"<"{DFN}{ATTR}">"		{ outDoc->startTypewriter(); }
""		{ outDoc->endTypewriter(); }
"<"{VAR}{ATTR}">"		{ outDoc->startEmphasis(); }
""		{ outDoc->endEmphasis(); }
"<"{IMG}{ATTR}">"		{ 
                                          /*storeOutputListState();*/
  					  outDoc->pushGeneratorState();
                                          outDoc->disableAllBut(OutputGenerator::Html);
					  outDoc->writeString(yytext); 
                                          /*restoreOutputListState();*/
					  outDoc->popGeneratorState();
					}
"<"{PRE}{ATTR}">"			{ 
  					  outDoc->startCodeFragment();
  					  codeBlock.resize(0);
					  BEGIN( DocCodeBlock ); 
					}
""		 	{ 
  					  warn(yyFileName,yyLineNr,
                                               "Warning: 
without
 or \\code"
    					       "in the documentation."
                                              ); 
					}
"<"{SUB}{ATTR}">"		{ outDoc->startSubscript(); }
""		{ outDoc->endSubscript(); }
"<"{SUP}{ATTR}">"		{ outDoc->startSuperscript(); }
""		{ outDoc->endSuperscript(); }
"<"{TR}{ATTR}">"		{ if (curTable) curTable->newRow(); }
""			
"<"{TD}{ATTR}">"		{ if (curTable) curTable->newElem(); }
""
"<"{OL}{ATTR}">"		{ outDoc->startEnumList(); 
  					  currentListIndentLevel++;
					}
""		{ 
					  if (currentListIndentLevel<=0)
					  {
					    warn(yyFileName,yyLineNr,
                                                 "Warning: more  tags than 
    tags in the documentation." ); } else { outDoc->endEnumList(); currentListIndentLevel--; } } "<"{UL}{ATTR}">" { outDoc->startItemList(); currentListIndentLevel++; } "" { if (currentListIndentLevel<=0) { warn(yyFileName,yyLineNr, "Warning: more tags than
      tags in the documentation." ); } else { outDoc->endItemList(); currentListIndentLevel--; } } "<"{LI}{ATTR}">" { outDoc->writeListItem(); } "" "<"{TT}{ATTR}">" { outDoc->startTypewriter(); } "" { outDoc->endTypewriter(); } "<"{EM}{ATTR}">" { outDoc->startEmphasis(); } "" { outDoc->endEmphasis(); } "<"{HR}{ATTR}">" { outDoc->writeRuler(); } "<"{DL}{ATTR}">" { outDoc->startDescription(); currentListIndentLevel++; } "" { if (currentListIndentLevel<=0) { warn(yyFileName,yyLineNr, "Warning: more tags than
      tags in the documentation." ); } else { outDoc->endDescription(); currentListIndentLevel--; } } "<"{DT}{ATTR}">" { outDoc->startDescItem(); } "" "<"{DD}{ATTR}">" { outDoc->endDescItem(); } "" "<"{BR}{ATTR}">" { outDoc->lineBreak(); } "<"{I}{ATTR}">" { outDoc->startEmphasis(); } "" { outDoc->endEmphasis(); } "" "<"{A} { BEGIN(DocHtmlLink); } "<"{BOLD}{ATTR}">" { outDoc->startBold(); } "" { outDoc->endBold(); } "<"{P}{ATTR}">" { if (inBlock()) endBlock(); outDoc->newParagraph(); } "" "<"{H1}{ATTR}">" { outDoc->startTitle(); } "" { outDoc->endTitle(); } "<"{H2}{ATTR}">" { outDoc->startSubsection(); } "" { outDoc->endSubsection(); } "<"{H3}{ATTR}">" { outDoc->startSubsubsection(); } "" { outDoc->endSubsubsection(); } {NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); } [a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); } {HREF}{BN}*"="{BN}*("\""?) { htmlUrl.resize(0); htmlText.resize(0); BEGIN(DocHtmlHref1); } {URLMASK} { htmlUrl=yytext; } ">" { BEGIN(DocHtmlHref2); } [^<]* { htmlText+=yytext; } /* \n { htmlText+='\n'; } */ "<" { outDoc->writeHtmlLink(htmlUrl,htmlText); unput(*yytext); BEGIN(DocScan); } ">" { BEGIN(DocScan); } {CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") { outDoc->docify(&yytext[1]); } "%"[a-zA-Z_0-9\-]+ { outDoc->docify(yytext+1); } {WORD} { outDoc->startEmphasis(); linkifyText(*outDoc,className,0,yytext); outDoc->endEmphasis(); BEGIN( DocScan ); } [a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"()" { outDoc->startEmphasis(); generateRef(*outDoc,className,yytext,inSeeBlock); outDoc->endEmphasis(); BEGIN( DocScan ); } [a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"()" { outDoc->startBold(); generateRef(*outDoc,className,yytext,inSeeBlock); outDoc->endBold(); BEGIN( DocScan ); } {WORD} { outDoc->startBold(); linkifyText(*outDoc,className,0,yytext); outDoc->endBold(); BEGIN( DocScan ); } [a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"()" { outDoc->startTypewriter(); generateRef(*outDoc,className,yytext,inSeeBlock); outDoc->endTypewriter(); BEGIN( DocScan ); } {WORD} { outDoc->startTypewriter(); linkifyText(*outDoc,className,0,yytext); outDoc->endTypewriter(); BEGIN( DocScan ); } {FILE} { includeFile(*outDoc,stripQuotes(yytext),FALSE); BEGIN( DocScan ); } {FILE} { includeFile(*outDoc,stripQuotes(yytext),TRUE); BEGIN( DocScan ); } "//" { codeBlock += yytext; } "/*" { codeBlock += yytext; } \n { codeBlock += '\n'; } [^\/\\\<\n]* { codeBlock += yytext; } . { codeBlock += *yytext; } "//" { outDoc->docify(yytext); } "/*" { outDoc->docify(yytext); } "\n" { outDoc->writeChar('\n'); } ({B}*"\n"){2,}{B}*"*"*{B}*"-"{B}+ { // new paragraph & start of a list if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } else if (insideItemList) { forceEndItemList(); } else { outDoc->newParagraph(); } if (inBlock()) endBlock(); addListItemMarker(strrchr(yytext,'\n')+1); } ({B}*"\n"){2,}{B}* { // new paragraph if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } else if (insideItemList) { forceEndItemList(); } else { outDoc->newParagraph(); } if (inBlock()) endBlock(); } {BN}+/\n { outDoc->writeChar(' '); } \n?{B}* { outDoc->writeChar(' '); } [a-z_A-Z0-9]+ { outDoc->docify(yytext); } . { outDoc->writeChar(*yytext); } "{" { curlyCount=0; BEGIN(SkipCurlyBlock); } "(" { roundCount=0; BEGIN(SkipRoundBlock); } "(" { ++roundCount; } ")" { if (roundCount ) --roundCount ; else BEGIN( NextSemi ) ; } "{" { ++curlyCount ; } "}" { if( curlyCount ) { --curlyCount ; } else BEGIN( NextSemi ) ; } "'"\\[0-7]{1,3}"'" "'"\\."'" "'"."'" \" { lastStringContext=NextSemi; BEGIN(SkipString); } [;,] { unput(*yytext); BEGIN( FindMembers ) ; } {B}*"signals"{BN}*":"{BN}* { current->sig = sig = TRUE; current->slot = slot = FALSE; current->protection = protection = Public ; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount() ; } {B}*"public"{BN}*"slots"{BN}*":"{BN}* { current->protection = protection = Public ; current->slot = slot = TRUE; current->sig = sig = FALSE; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount(); } {B}*"protected"{BN}*"slots"{BN}*":"{BN}* { current->protection = protection = Protected ; current->slot = slot = TRUE; current->sig = sig = FALSE; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount(); } {B}*"private"{BN}*"slots"{BN}*":"{BN}* { current->protection = protection = Private ; current->slot = slot = TRUE; current->sig = sig = FALSE; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount(); } {B}*"public"{BN}*":"{BN}* { current->protection = protection = Public ; current->slot = slot = FALSE; current->sig = sig = FALSE; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount() ; } {B}*"protected"{BN}*":"{BN}* { current->protection = protection = Protected ; current->slot = slot = FALSE; current->sig = sig = FALSE; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount() ; } {B}*"private"{BN}*":"{BN}* { current->protection = protection = Private ; current->slot = slot = FALSE; current->sig = sig = FALSE; current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); lineCount() ; } {BN}+ { lineCount(); } {B}*"static"{BN}+ { //current->type += " static "; current->stat = TRUE; lineCount(); } {B}*"extern"{BN}+ { current->stat = FALSE; lineCount(); } {B}*"virtual"{BN}+ { current->type += " virtual "; current->virt = Virtual; lineCount(); } {B}*"inline"{BN}+ { current->memSpec|=Entry::Inline; lineCount(); } {B}*"mutable"{BN}+ { current->memSpec|=Entry::Mutable; lineCount(); } {B}*"explicit"{BN}+ { current->memSpec|=Entry::Explicit; lineCount(); } {B}*"import"{BN}+ { // IDL import keyword BEGIN( NextSemi ); } {B}*"typename"{BN}+ { lineCount(); } {B}*"namespace"{BN}+ { isTypedef=FALSE; current->section = Entry::NAMESPACE_SEC; current->type = "namespace" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount(); BEGIN( CompoundName ); } {B}*"module"{BN}+ { isTypedef=FALSE; current->section = Entry::NAMESPACE_SEC; current->type = "module" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount(); BEGIN( CompoundName ); } {B}*"interface"{BN}+ { // M$/Corba IDL interface isTypedef=FALSE; current->section = Entry::INTERFACE_SEC; addType( current ) ; current->type += " interface" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount(); BEGIN( CompoundName ); } {B}*"exception"{BN}+ { // Corba IDL exception isTypedef=FALSE; current->section = Entry::EXCEPTION_SEC; addType( current ) ; current->type += " exception" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount(); BEGIN( CompoundName ); } {B}*(("typedef"{BN}+)?)"class"{BN}+ { isTypedef=((QCString)yytext).find("typedef")!=-1; current->section = Entry::CLASS_SEC; addType( current ) ; current->type += " class" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount() ; BEGIN( CompoundName ) ; } {B}*(("typedef"{BN}+)?)"struct"{BN}+ { isTypedef=((QCString)yytext).find("typedef")!=-1; current->section = Entry::STRUCT_SEC ; addType( current ) ; current->type += " struct" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount() ; BEGIN( CompoundName ) ; } {B}*(("typedef"{BN}+)?)"union"{BN}+ { isTypedef=((QCString)yytext).find("typedef")!=-1; current->section = Entry::UNION_SEC ; addType( current ) ; current->type += " union" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount() ; BEGIN( CompoundName ) ; } {B}*(("typedef"{BN}+)?)"enum"{BN}+ { isTypedef=((QCString)yytext).find("typedef")!=-1; current->section = Entry::ENUM_SEC ; addType( current ) ; current->type += " enum" ; current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; lineCount() ; BEGIN( CompoundName ) ; } "("{BN}*")"{BN}*/"(" { lineCount(); current->name += yytext ; current->name = current->name.simplifyWhiteSpace(); BEGIN( FindMembers ) ; } [^(] { lineCount(); current->name += *yytext ; } "<>" { /* skip guided templ specifiers */ } "(" { current->name = current->name.simplifyWhiteSpace(); unput(*yytext); BEGIN( FindMembers ) ; } "template"({BN}*)"<"/[>]? { lineCount(); // class template specifier already found => member template specifier // already inside class => member template specifier if (current->tArgList || (current_root->section&Entry::COMPOUND_MASK)) { //printf("-------> member template\n"); if (current->mtArgList) { current->mtArgList->clear(); } else { current->mtArgList = new ArgumentList; current->mtArgList->setAutoDelete(TRUE); } currentArgumentList = current->mtArgList; } else // class template specifier { //printf("-------> class template\n"); if (current->tArgList) { current->tArgList->clear(); } else { current->tArgList = new ArgumentList; current->tArgList->setAutoDelete(TRUE); } currentArgumentList = current->tArgList; } templateStr="<"; fullArgString = templateStr.copy(); copyArgString = &templateStr; currentArgumentContext = FindMembers; //printf("Start template list\n"); BEGIN( ReadTempArgs ); } "using"{BN}+ { current->startLine=yyLineNr; lineCount(); BEGIN(Using); } "namespace"{BN}+ { lineCount(); BEGIN(UsingDirective); } {ID}{BN}*"::"{BN}*{ID}({BN}*"::"{BN}*{ID})* { current->name=yytext; current->fileName = yyFileName; current->section=Entry::USINGDECL_SEC; //printf("Found using declaration %s\n",yytext); current_root->addSubEntry(current); current = new Entry ; current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; BEGIN(Using); } {SCOPENAME} { current->name=yytext; current->fileName = yyFileName; current->section=Entry::USINGDIR_SEC; //printf("Found using directive %s\n",yytext); current_root->addSubEntry(current); current = new Entry ; current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; BEGIN(Using); } ";" { BEGIN(FindMembers); } {SCOPENAME}{BN}*"<>" { // guided template decl QCString n=yytext; addType( current ); current->name=n.left(n.length()-2); } {SCOPENAME}{BN}*/"<" { sharpCount=0; lineCount(); addType( current ); current->name=yytext; current->name=current->name.stripWhiteSpace(); current->scopeSpec.resize(0); currentTemplateSpec = ¤t->scopeSpec; if (nameIsOperator(current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } {SCOPENAME}{BN}*/"<" { sharpCount=0; lineCount(); current->name+=((QCString)yytext).stripWhiteSpace(); current->memberSpec.resize(0); currentTemplateSpec = ¤t->memberSpec; if (nameIsOperator(current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } /* "<" { sharpCount++; } ">" { if (--sharpCount<=0) { BEGIN(FindMembers); } } . */ "<" { current->name+='<'; *currentTemplateSpec+='<'; sharpCount++; } ">" { current->name+='>'; *currentTemplateSpec+='>'; if (--sharpCount<=0) { //printf("Found %s\n",current->name.data()); BEGIN(FindMembers); } } ">"{BN}*"(" { lineCount(); current->name+='>'; *currentTemplateSpec+='>'; if (--sharpCount<=0) { current->args = "("; currentArgumentContext = FuncQual; fullArgString = current->args.copy(); copyArgString = ¤t->args; //printf("Found %s\n",current->name.data()); BEGIN( ReadFuncArgType ) ; } } ">"{BN}*/"::" { lineCount(); current->name+='>'; *currentTemplateSpec+='>'; if (--sharpCount<=0) { BEGIN(FindMemberName); } } . { current->name+=*yytext; *currentTemplateSpec+=*yytext; } {SCOPENAME} { lineCount(); if (insideIDL && yyleng==9 && strcmp(yytext,"cpp_quote")==0) { BEGIN(CppQuote); } else if (insideIDL && strcmp(yytext,"case")==0) { BEGIN(IDLUnionCase); } else { if (YY_START==FindMembers) { addType( current ) ; current->name = yytext; } else { current->name += yytext; } QCString tmp=yytext; if (nameIsOperator(tmp)) BEGIN( Operator ); else BEGIN(FindMembers); } } "::" { current->name+=yytext; } "("{B}*"\"" { insideCppQuote=TRUE; BEGIN(FindMembers); } "::" ":" { BEGIN(FindMembers); } \n { yyLineNr++; } . ")" { insideCppQuote=FALSE; BEGIN(FindMembers); } {B}*"#" { lastCPPContext = YY_START; BEGIN( SkipCPP ) ; } {B}*"#"{B}*"define" { current->bodyLine = yyLineNr; BEGIN( Define ); } . \\[\r]*"\n"[\r]* { yyLineNr++ ; } [\r]*\n[\r]* { yyLineNr++ ; BEGIN( lastCPPContext) ; } {ID}/"(" { current->bodyLine = yyLineNr; current->name = yytext; BEGIN( DefineArg ); } ")" { //printf("Define with args\n"); current->args += ')'; BEGIN( DefineEnd ); } . { current->args += *yytext; } {ID} { //printf("Define `%s' without args\n",yytext); current->bodyLine = yyLineNr; current->name = yytext; BEGIN(DefineEnd); } \n { //printf("End define\n"); yyLineNr++; current->fileName = yyFileName; current->startLine = yyLineNr; current->type.resize(0); current->args = current->args.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); current->section = Entry::DEFINE_SEC; current_root->addSubEntry(current); current = new Entry ; current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; BEGIN(FindMembers); } \\[\r]?\n { yyLineNr++; } \" { if (insideIDL && insideCppQuote) { BEGIN(EndCppQuote); } else { lastStringContext=DefineEnd; BEGIN(SkipString); } } . [*&]+ { current->name += yytext ; } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { lineCount(); if (current->bodyLine==-1) current->bodyLine=yyLineNr; lastAfterDocContext = YY_START; afterDocTerminator = ';'; if (yytext[yyleng-3]=='/') { current->brief.resize(0); BEGIN(AfterDocLine); } else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag) { current->brief.resize(0); BEGIN(AfterDocBrief); } else { current->doc.resize(0); BEGIN(AfterDoc); } } ","{BN}*("/**"|"//!"|"/*!"|"///")"<" { lineCount(); lastAfterDocContext = YY_START; afterDocTerminator = ','; if (yytext[yyleng-3]=='/') { current->brief.resize(0); BEGIN(AfterDocLine); } else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag) { current->brief.resize(0); BEGIN(AfterDocBrief); } else { current->doc.resize(0); BEGIN(AfterDoc); } } {BN}*("/**"|"//!"|"/*!"|"///")"<" { lineCount(); lastAfterDocContext = YY_START; if (YY_START==DefineEnd) afterDocTerminator = '\n'; else afterDocTerminator = 0; if (yytext[yyleng-3]=='/') { current->brief.resize(0); BEGIN(AfterDocLine); } else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag) { current->brief.resize(0); BEGIN(AfterDocBrief); } else { current->doc.resize(0); BEGIN(AfterDoc); } } "//@{"|"/*@{" { if (memberGroupId!=NOGROUP) { warn(yyFileName,yyLineNr,"Warning: ignoring nested member group. " "Previous command was found at line %d.",lastMemberGroupLine); } else if (memberGroupHeader.isEmpty()) { //warn("Warning: member group does not have a header " // "at line %d of %s.\n",yyLineNr,yyFileName); memberGroupHeader="[NOHEADER]"; memberGroupId = newMemberGroupId(); current->mGrpId = memberGroupId; lastMemberGroupLine = yyLineNr; } else { memberGroupId = newMemberGroupId(); current->mGrpId = memberGroupId; lastMemberGroupLine = yyLineNr; } tmpDocType=-1; if (current_root->section & Entry::SCOPE_MASK) current->inside = current_root->name+"::"; if (yytext[1]=='/') // C++ style comment { current->brief.resize(0); lastDocContext = YY_START; BEGIN( LineDoc ); } else // C style comment { current->doc.resize(0); lastDocContext = YY_START; removeSlashes=FALSE; BEGIN( Doc ); } } "//@}"|"/*@}*/" { if (memberGroupId==NOGROUP) { warn(yyFileName,yyLineNr, "Warning: end of member group without matching begin."); } else { memberHeaderDict.insert(memberGroupId, new QCString(memberGroupHeader.stripWhiteSpace()) ); memberDocDict.insert(memberGroupId, new QCString(memberGroupDocs) ); memberGroupId=NOGROUP; if (YY_START!=ReadInitializer) current->mGrpId=NOGROUP; memberGroupHeader.resize(0); memberGroupDocs.resize(0); } } "=" { current->bodyLine = yyLineNr; lastInitializerContext = YY_START; BEGIN(ReadInitializer); } /* Read initializer rules */ "(" { lastRoundContext=YY_START; pCopyRoundString=¤t->initializer; roundCount=0; current->initializer+=*yytext; BEGIN(CopyRound); } "{" { lastCurlyContext=YY_START; pCopyCurlyString=¤t->initializer; curlyCount=0; current->initializer+=*yytext; BEGIN(CopyCurly); } [;,] { //printf(">> initializer `%s' <<\n",current->initializer.data()); unput(*yytext); BEGIN(lastInitializerContext); } \" { if (insideIDL && insideCppQuote) { BEGIN(EndCppQuote); } else { lastStringContext=YY_START; current->initializer+=*yytext; pCopyQuotedString=¤t->initializer; BEGIN(CopyString); } } "'"\\[0-7]{1,3}"'" "'"\\."'" "'"."'" \n { current->initializer+=*yytext; yyLineNr++; } . { current->initializer+=*yytext; } /* generic quoted string copy rules */ \\. { *pCopyQuotedString+=yytext; } \" { *pCopyQuotedString+=*yytext; BEGIN( lastStringContext ); } "/*"|"*/"|"//" { *pCopyQuotedString+=yytext; } \n { *pCopyQuotedString+=*yytext; yyLineNr++; } . { *pCopyQuotedString+=*yytext; } /* generic round bracket list copy rules */ \" { *pCopyRoundString+=*yytext; pCopyQuotedString=pCopyRoundString; lastStringContext=YY_START; BEGIN(CopyString); } "(" { *pCopyRoundString+=*yytext; roundCount++; } ")" { *pCopyRoundString+=*yytext; if (--roundCount<0) BEGIN(lastRoundContext); } \n { yyLineNr++; *pCopyRoundString+=*yytext; } "'"\\[0-7]{1,3}"'" { *pCopyRoundString+=yytext; } "'"\\."'" { *pCopyRoundString+=yytext; } "'"."'" { *pCopyRoundString+=yytext; } [^"'()\n]+ { *pCopyRoundString+=yytext; } /* generic curly bracket list copy rules */ \" { *pCopyCurlyString+=*yytext; pCopyQuotedString=pCopyCurlyString; lastStringContext=YY_START; BEGIN(CopyString); } "{" { *pCopyCurlyString+=*yytext; curlyCount++; } "}" { *pCopyCurlyString+=*yytext; if (--curlyCount<0) BEGIN(lastCurlyContext); } "'"\\[0-7]{1,3}"'" { *pCopyCurlyString+=yytext; } "'"\\."'" { *pCopyCurlyString+=yytext; } "'"."'" { *pCopyCurlyString+=yytext; } [^"'{}\/\n]+ { *pCopyCurlyString+=yytext; } \n { yyLineNr++; *pCopyCurlyString+=*yytext; } [:;,] { QCString oldType = current->type.copy(); QCString oldDocs = current->doc.copy(); if ( *yytext != ':') { if (current->bodyLine==-1) { current->bodyLine = yyLineNr; } current->type=current->type.simplifyWhiteSpace(); current->args=current->args.simplifyWhiteSpace(); current->name=current->name.stripWhiteSpace(); if (!current->name.isEmpty() && current->type.left(8)=="typedef ") { // add typedef to dictionary QCString dest = extractName(current->type.right(current->type.length()-8)); if (!dest.isEmpty()) { //printf(">>>>>>>>>> adding %s->%s\n",current->name.data(),dest.data()); typedefDict.insert(current->name, new QCString(dest)); } } current->section = Entry::VARIABLE_SEC ; current->fileName = yyFileName; current->startLine = yyLineNr; //printf("New variable type=`%s' name=`%s' groupId=%d\n",current->type.data(),current->name.data(),current->mGrpId); current_root->addSubEntry( current ) ; current = new Entry ; // variable found current->section = Entry::EMPTY_SEC ; current->protection = protection; current->slot = slot = FALSE; current->sig = sig = FALSE; current->virt = Normal; current->stat = gstat; current->mGrpId = memberGroupId; } // skip expression or bitfield if needed if ( *yytext == ':') { BEGIN( NextSemi ); } else { if ( *yytext == ',' ) { int i=oldType.length(); while (i>0 && (oldType[i-1]=='*' || oldType[i-1]==' ')) i--; current->type = oldType.left(i); current->doc = oldDocs; } BEGIN( FindMembers ) ; } } "[" { if (current->name.isEmpty()) // IDL function property { squareCount=1; lastSquareContext = YY_START; BEGIN(SkipSquare); } else { current->args += yytext ; squareCount=1; BEGIN( Array ) ; } } "]" { current->args += *yytext ; if (--squareCount<=0) BEGIN( FindMembers ) ; } "[" { current->args += *yytext ; squareCount++; } . { current->args += *yytext ; } "[" { squareCount++; } "]" { if (--squareCount<=0) BEGIN( lastSquareContext ); } \" { lastStringContext=YY_START; BEGIN( SkipString ); } [^\n\[\]\"]+ "<" { addType( current ) ; current->type += yytext ; BEGIN( Sharp ) ; } ">" { current->type += *yytext ; if (--sharpCount<=0) BEGIN( FindMembers ) ; } "<" { current->type += *yytext ; sharpCount++; } {BN}+ { lineCount(); } . { current->type += *yytext ; } {ID} { current->name = yytext; } "=" { lastInitializerContext = YY_START; BEGIN(ReadInitializer); } "," { //printf("adding `%s' `%s' `%s' to enum `%s' (mGrpId=%d)\n", // current->type.data(), current->name.data(), // current->args.data(), current_root->name.data(),current->mGrpId); current->fileName = yyFileName; current->startLine = yyLineNr; current->type = "@"; // enum marker current->args = current->args.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; // add to the scope of the enum current_root->addSubEntry(current); current = new Entry(*current); // add to the scope surrounding the enum (copy!) current_root->parent->addSubEntry(current); current = new Entry ; current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; } /* "," { unput(*yytext); BEGIN(FindFields); } */ [^\r\n{}"'/]* { current->program += yytext ; } "//".* { current->program += yytext ; } \"[^\r\n"]*\" { current->program += yytext ; } "/*"{B}* { current->program += yytext ; lastContext = ReadBody ; BEGIN( Comment ) ; } "/*"{BL} { current->program += yytext ; ++yyLineNr ; lastContext = ReadBody ; BEGIN( Comment ) ; } "'"\\[0-7]{1,3}"'" { current->program += yytext; } "'"\\."'" { current->program += yytext; } "'"."'" { current->program += yytext; } "{" { current->program += yytext ; ++curlyCount ; } "}" { //err("ReadBody count=%d\n",curlyCount); if ( curlyCount>0 ) { current->program += yytext ; --curlyCount ; } else { current->endBodyLine = yyLineNr; QCString &cn = current->name; //QCString rn = stripAnnonymousScope(current_root->name); QCString rn = current_root->name.copy(); //printf("cn=`%s' rn=`%s'\n",cn.data(),rn.data()); if (!cn.isEmpty() && !rn.isEmpty() && (current_root->section & Entry::SCOPE_MASK)) { cn.prepend(rn+"::"); } if (isTypedef && cn.isEmpty()) { //printf("Typedef Name\n"); BEGIN( TypedefName ); } else { if (current->section == Entry::ENUM_SEC) { current->program+=','; // add field terminator } // add compound definition to the tree current->args = current->args.simplifyWhiteSpace(); current->type = current->type.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); //printf("adding `%s' `%s' `%s' brief=%s\n",current->type.data(),current->name.data(),current->args.data(),current->brief.data()); current_root->addSubEntry( current ) ; current = new Entry(*current); if (current->section==Entry::NAMESPACE_SEC || current->section==Entry::INTERFACE_SEC ) { // namespaces and interfaces ends with a closing bracket without semicolon current->reset(); current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; BEGIN( FindMembers ) ; } else BEGIN( MemberSpec ) ; } } } {ID} { if (current->section == Entry::ENUM_SEC) { current->program+=","; // add field terminator } current->name=yytext; if (current_root->section & Entry::SCOPE_MASK) { current->name.prepend(current_root->name+"::"); } current->args = current->args.simplifyWhiteSpace(); current->type = current->type.simplifyWhiteSpace(); //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data()); current_root->addSubEntry( current ) ; current = new Entry; current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; BEGIN(MemberSpecSkip); } ([*&]*{BN}*)*{ID}("["[a-z_A-Z0-9]*"]")* { // the [] part could be improved. lineCount(); int i=0,l=yyleng,j; while (i[,;] { if (msName.isEmpty() && !current->name.isEmpty()) /* && (current->section & Entry::COMPOUND_MASK)) */ { // see if the compound does not have a name or is inside another // annonymous compound. If so we insert a // special `annonymous' variable. Entry *p=current_root; while (p) { // only look for class scopes, not namespace scopes if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty()) { //printf("Trying scope `%s'\n",p->name.data()); int i=p->name.findRev("::"); int pi = (i==-1) ? 0 : i+2; if (p->name.at(pi)=='@') { // annonymous compound inside -> insert dummy variable name //printf("Adding annonymous variable for scope %s\n",p->name.data()); msName.sprintf("@%d",anonCount++); break; } } p=p->parent; } } if (!msName.isEmpty()) { Entry *varEntry=new Entry; varEntry->protection = current->protection ; varEntry->sig = current->sig; varEntry->virt = current->virt; varEntry->stat = current->stat; varEntry->slot = current->slot; varEntry->section = Entry::VARIABLE_SEC; varEntry->name = msName.stripWhiteSpace(); varEntry->type = current->type.simplifyWhiteSpace()+" "; varEntry->args = msArgs; //current->args.simplifyWhiteSpace(); //if (!current->name.isEmpty() && current->name[0]!='@' && // current->parent->section & Entry::COMPOUND_MASK) // varEntry->type+=current->parent->name+"::"; if (isTypedef) { varEntry->type.prepend("typedef "); //printf("current->name = %s %s\n",current->name.data(),msName.data()); if (!current->name.isEmpty() && current->name.at(0)!='@') { typedefDict.insert(msName,new QCString(current->name)); } } varEntry->type+=current->name+msType; varEntry->fileName = yyFileName; varEntry->startLine = yyLineNr; varEntry->doc = current->doc.copy(); varEntry->brief = current->brief.copy(); varEntry->mGrpId = current->mGrpId; //printf("Add: type=`%s',name=`%s',args=`%s'\n", // varEntry->type.data(),varEntry->name.data(),varEntry->args.data()); current_root->addSubEntry(varEntry); } if (*yytext==';') { msType.resize(0); msName.resize(0); msArgs.resize(0); isTypedef=FALSE; current->reset(); current->protection = protection ; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; BEGIN( FindMembers ); } } "=" { lastInitializerContext=YY_START; BEGIN(ReadInitializer); /* BEGIN(MemberSpecSkip); */ } /* "{" { curlyCount=0; lastCurlyContext = MemberSpecSkip; previous = current; BEGIN(SkipCurly); } */ "," { BEGIN(MemberSpec); } ";" { unput(';'); BEGIN(MemberSpec); } {BN}+ { current->program += yytext ; lineCount() ; } . { current->program += yytext ; } "("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { current->bodyLine = yyLineNr; lineCount(); addType(current); funcPtrType=yytext; //current->type += yytext; BEGIN( FuncPtr ); } {SCOPENAME} { current->name = yytext; BEGIN( EndFuncPtr ); } . { //printf("Error: FuncPtr `%c' unexpected at line %d of %s\n",*yytext,yyLineNr,yyFileName); } ")"{BN}*/";" { // a variable with extra braces lineCount(); current->type+=funcPtrType.data()+1; BEGIN(FindMembers); } ")"{BN}*/"(" { // a variable function lineCount(); current->type+=funcPtrType+")"; BEGIN(FindMembers); } ")"{BN}*/"[" { lineCount(); current->type+=funcPtrType.data(); current->args += ")"; BEGIN(FindMembers); } "(" { // a function returning a function current->args += *yytext ; roundCount=0; BEGIN( FuncFunc ); } ")" { BEGIN(FindMembers); } "(" { current->args += *yytext ; ++roundCount; } ")" { current->args += *yytext ; if ( roundCount ) --roundCount; else { BEGIN(FuncFuncEnd); } } ")"{BN}*"(" { lineCount(); current->type+=funcPtrType+")("; BEGIN(FuncFuncType); } ")"{BN}*/[;{] { lineCount(); current->type+=funcPtrType.data()+1; BEGIN(Function); } . { current->args += *yytext; } "(" { current->type += *yytext; roundCount++; } ")" { current->type += *yytext; if (roundCount) --roundCount; else BEGIN(Function); } {BN}*","{BN}* { lineCount() ; current->type += ", " ; } {BN}+ { lineCount() ; current->type += ' ' ; } . { current->type += *yytext; } "(" { current->args = yytext; current->bodyLine = yyLineNr; currentArgumentContext = FuncQual; fullArgString=current->args.copy(); copyArgString=¤t->args; BEGIN( ReadFuncArgType ) ; //printf(">>> Read function arguments!\n"); } /* "("{BN}*("void"{BN}*)?")" { lineCount(); current->args = "()"; BEGIN( FuncQual ); } */ /*- Function argument reading rules ---------------------------------------*/ [^ \/\r\t\n\)\(\"\']+ { *copyArgString+=yytext; fullArgString+=yytext; } [^\n\\\"\']+ { *copyArgString+=yytext; fullArgString+=yytext; } [^\/\n\)\(\"\']+ { *copyArgString+=yytext; fullArgString+=yytext; } {BN}* { *copyArgString+=" "; fullArgString+=" "; lineCount(); } \" { *copyArgString+=*yytext; fullArgString+=*yytext; lastCopyArgStringContext = YY_START; BEGIN( CopyArgString ); } "(" { *copyArgString+=*yytext; fullArgString+=*yytext; argRoundCount=0; lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } ")" { *copyArgString+=*yytext; fullArgString+=*yytext; stringToArgumentList(fullArgString,current->argList); BEGIN( currentArgumentContext ); } /* a special comment */ ("/*"[*!]|"//"[/!])("<"?) { fullArgString+=yytext; lastCopyArgChar=0; if (yytext[1]=='/') BEGIN( CopyArgCommentLine ); else BEGIN( CopyArgComment ); } /* `)' followed by a special comment */ ")"{BN}*("/*"[*!]|"//"[/!])"<" { lineCount(); lastCopyArgChar=*yytext; QCString text=&yytext[1]; text=text.stripWhiteSpace(); fullArgString+=text; if (text.find("//")!=-1) BEGIN( CopyArgCommentLine ); else BEGIN( CopyArgComment ); } [^\n\*]+ { fullArgString+=yytext; } "*/" { fullArgString+=yytext; if (lastCopyArgChar!=0) unput(lastCopyArgChar); BEGIN( ReadFuncArgType ); } \n { fullArgString+=yytext; yyLineNr++; if (lastCopyArgChar!=0) unput(lastCopyArgChar); BEGIN( ReadFuncArgType ); } [^\n]+ { fullArgString+=yytext; } \n { fullArgString+=*yytext; yyLineNr++; } . { fullArgString+=*yytext; } "<" { *copyArgString+=*yytext; fullArgString+=*yytext; argSharpCount=0; BEGIN( CopyArgSharp ); } ">" { *copyArgString+=*yytext; fullArgString+=*yytext; //printf("end template list %s\n",copyArgString->data()); stringToArgumentList(fullArgString,currentArgumentList); BEGIN( currentArgumentContext ); } "(" { argRoundCount++; *copyArgString+=*yytext; fullArgString+=*yytext; } ")" { *copyArgString+=*yytext; fullArgString+=*yytext; if (argRoundCount>0) argRoundCount--; else BEGIN( lastCopyArgContext ); } "<" { argSharpCount++; *copyArgString+=*yytext; fullArgString+=*yytext; } ">" { *copyArgString+=*yytext; fullArgString+=*yytext; if (argRoundCount>0) argRoundCount--; else BEGIN( ReadTempArgs ); } \\. { *copyArgString+=yytext; fullArgString+=yytext; } \" { *copyArgString+=*yytext; fullArgString+=*yytext; BEGIN( lastCopyArgStringContext ); } "'"\\[0-7]{1,3}"'" { *copyArgString+=yytext; fullArgString+=yytext; } "'"\\."'" { *copyArgString+=yytext; fullArgString+=yytext; } "'"."'" { *copyArgString+=yytext; fullArgString+=yytext; } \n { yyLineNr++; *copyArgString+=*yytext; fullArgString+=*yytext; } . { *copyArgString+=*yytext; fullArgString+=*yytext; } /*------------------------------------------------------------------------*/ "(" { current->args += *yytext ; ++roundCount ; } ")" { current->args += *yytext ; if ( roundCount ) --roundCount ; else BEGIN( FuncQual ) ; } /* "#" { lastCPPContext = YY_START; BEGIN(SkipCPP); } */ [{:;] { unput(*yytext); BEGIN( Function ); } {BN}*"const"{BN}* { lineCount() ; current->args += " const "; current->argList->constSpecifier=TRUE; } {BN}*"volatile"{BN}* { lineCount() ; current->args += " volatile "; current->argList->volatileSpecifier=TRUE; } {BN}*"="{BN}*"0"{BN}* { lineCount() ; current->args += " = 0"; current->virt = Pure; current->argList->pureSpecifier=TRUE; } {BN}*","{BN}* { lineCount() ; current->args += ", " ; } {BN}+ { lineCount() ; current->args += ' ' ; } . { current->args += *yytext; } {BN}*"throw"{BN}*"(" { current->exception = " throw (" ; roundCount=0; lineCount() ; BEGIN( ExcpRound ) ; } {BN}*"raises"{BN}*"(" { current->exception = " raises (" ; lineCount() ; roundCount=0; BEGIN( ExcpRound ) ; } "(" { current->exception += *yytext ; ++roundCount ; } ")" { current->exception += *yytext ; if ( roundCount ) --roundCount ; else BEGIN( FuncQual ) ; } . { current->exception += yytext; } "(" { current->type += current->name ; current->name = current->args ; current->args = yytext ; roundCount=0; BEGIN( FuncRound ) ; } "#" { lastCPPContext = YY_START; BEGIN(SkipCPP); } [:;{] { current->name=current->name.simplifyWhiteSpace(); current->type=current->type.simplifyWhiteSpace(); current->args=current->args.simplifyWhiteSpace(); QCString &cn=current->name; QCString &rn=current_root->name; //printf("current_root->name=`%s'\n",rn.data()); //printf("Function: `%s' `%s' `%s'\n",current->type.data(),cn.data(),current->args.data()); int i; if ((i=cn.findRev("::"))!=-1) // name contains scope { if (cn.left(i)==rn.right(i)) // scope name is redundant { cn=cn.right(cn.length()-i-2); // strip scope //printf("new name=`%s'\n",cn.data()); } } //if (cname.left(current_root->name.length()+2)==current_root->name+"::") //{ // strip redundant scope // current->name=current->name.right(current->name.length()-current_root->name.length()-2); // printf("new name=`%s'\n",current->name.data()); //} current->fileName = yyFileName; current->startLine = yyLineNr; if (*yytext!=';' || (current_root->section&Entry::SCOPE_MASK) ) { int tempArg=current->name.find('<'); QCString tempName; if (tempArg==-1) tempName=current->name; else tempName=current->name.left(tempArg); if (current->type.isEmpty() && tempName.find("operator")==-1 && (tempName.find('*')!=-1 || tempName.find('&')!=-1)) { //printf("Scanner.l: found in class variable: `%s' `%s' `%s'\n", // current->type.data(),current->name.data(),current->args.data()); current->section = Entry::VARIABLE_SEC ; } else { //printf("Scanner.l: found in class function: `%s' `%s' `%s'\n", // current->type.data(),current->name.data(),current->args.data()); current->section = Entry::FUNCTION_SEC ; } } else // a global function prototype or function variable { //printf("Scanner.l: prototype? type=`%s' name=`%s' args=`%s'\n",current->type.data(),current->name.data(),current->args.data()); QRegExp re("([^)]*)"); if (!current->type.isEmpty() && (current->type.find(re,0)!=-1 || current->type.left(8)=="typedef ")) { //printf("Scanner.l: found function variable!\n"); current->section = Entry::VARIABLE_SEC; } else { //printf("Scanner.l: found prototype\n"); current->section = Entry::FUNCTION_SEC; current->proto = TRUE; } } //printf("Adding entry `%s' inLine`%d' bodyLine=`%d'\n", // current->name.data(),current->inLine,current->bodyLine); previous = current; current_root->addSubEntry(current); current = new Entry ; current->protection = protection; current->sig = sig; current->virt = virt; current->stat = gstat; current->slot = slot; current->mGrpId = memberGroupId; lastCurlyContext = FindMembers; if( *yytext == '{' ) { if (current_root->section & Entry::COMPOUND_MASK) previous->memSpec = previous->memSpec | Entry::Inline; //addToBody(yytext); curlyCount=0; BEGIN( SkipCurly ) ; } else if( *yytext == ':' ) { //addToBody(yytext); BEGIN( SkipInits ) ; } else { if (previous->section!=Entry::VARIABLE_SEC) previous->bodyLine=-1; // a function/member declaration BEGIN( FindMembers ) ; } } "{" { //addToBody(yytext); lastCurlyContext = FindMembers; curlyCount=0; BEGIN( SkipCurly ) ; } "{" { //addToBody(yytext); ++curlyCount ; } "}" { //addToBody(yytext); if( curlyCount ) { --curlyCount ; } else { previous->endBodyLine=yyLineNr; BEGIN( lastCurlyContext ) ; } } "}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { if ( curlyCount ) { //addToBody(yytext); --curlyCount ; } else { current->endBodyLine=yyLineNr; lineCount(); tempEntry = current; // temporarily switch to the previous entry current = previous; current->doc.resize(0); current->brief.resize(0); lastAfterDocContext = SkipCurlyEndDoc; afterDocTerminator = '}'; if (yytext[yyleng-3]=='/') BEGIN(AfterDocLine); else if (yytext[yyleng-2]=='*' && Config::autoBriefFlag) BEGIN(AfterDocBrief); else BEGIN(AfterDoc); } } "}" { //addToBody("}"); current = tempEntry; BEGIN( lastCurlyContext ); } "'"\\[0-7]{1,3}"'" { //addToBody(yytext); } "'"\\."'" { //addToBody(yytext); } "'"."'" { //addToBody(yytext); } \" { //addToBody(yytext); lastStringContext=SkipCurly; BEGIN( SkipString ); } ^{B}*"#" { //addToBody(yytext); BEGIN( SkipCurlyCpp ); } \n { yyLineNr++; //addToBody(yytext); } [^\n"'\\/{}]+ { //addToBody(yytext); } \n { //addToBody(yytext); yyLineNr++; lastCurlyContext = FindMembers; BEGIN( SkipCurly ); } \\[\r]*"\n"[\r]* { //addToBody(yytext); yyLineNr++; } "/*" { //addToBody(yytext); lastCContext = YY_START; BEGIN(SkipComment); } "//" { //addToBody(yytext); lastCContext = YY_START; BEGIN(SkipCxxComment); } . { //addToBody(yytext); } \\. { //addToBodyCond(yytext); } \" { //addToBodyCond(yytext); BEGIN( lastStringContext ); } "/*"|"*/"|"//" { //addToBodyCond(yytext); } \n { yyLineNr++; //addToBodyCond(yytext); } . { //addToBodyCond(yytext); } ";" { current->section = Entry::EMPTY_SEC ; current->type.resize(0) ; current->name.resize(0) ; current->args.resize(0) ; current->argList->clear(); BEGIN( FindMembers ) ; } {SCOPENAME}{BN}*/"<" { sharpCount = 0; current->name = yytext ; lineCount(); lastClassTemplSpecContext = ClassVar; BEGIN( ClassTemplSpec ); } ">"({BN}*"::"{BN}*{SCOPENAME})? { current->name += yytext; lineCount(); if (--sharpCount<=0) { current->name = removeRedundantWhiteSpace(current->name); BEGIN( lastClassTemplSpecContext ); } } "<" { current->name += yytext; sharpCount++; } . { current->name += yytext; } {SCOPENAME} { current->name = yytext ; lineCount(); BEGIN( ClassVar ); } {SCOPENAME}{BN}*/"(" { addType(current); current->name = yytext; current->name = current->name.stripWhiteSpace(); lineCount(); BEGIN( FindMembers ); } {ID} { if (insideIDL && strcmp(yytext,"switch")==0) { // Corba IDL style union roundCount=0; BEGIN(SkipUnionSwitch); } else { if (isTypedef) { //QCString dest = extractName(current->name); typedefDict.insert(yytext,new QCString(current->name)); //current->extends->append( // new BaseInfo(yytext,Public,Normal) // ); } current->type += ' ' ; current->type += current->name ; current->name = yytext ; //BEGIN( FindMembers ); } } [(\[] { // probably a function anyway unput(*yytext); BEGIN( FindMembers ); } ":" { current->type.resize(0); if (current->section == Entry::INTERFACE_SEC) baseProt=Public; else baseProt=Private; baseVirt=Normal; baseName.resize(0); BEGIN( BasesProt ) ; } [;=*&] { unput(*yytext); if (isTypedef) // typedef of a class, put typedef keyword back { current->type.prepend("typedef"); } BEGIN( FindMembers ); } {B}*"{"{B}* { current->fileName = yyFileName ; current->startLine = yyLineNr ; current->name = removeRedundantWhiteSpace(current->name); if (current->name.isEmpty() && !isTypedef) // anonymous compound current->name.sprintf("@%d",anonCount++); curlyCount=0; BEGIN( ReadBody ) ; } "virtual" { baseVirt = Virtual; } "public" { baseProt = Public; } "protected" { baseProt = Protected; } "private" { baseProt = Private; } {BN} { lineCount(); } . { unput(*yytext); BEGIN(Bases); } ("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID} { //current->extends->append( // new BaseInfo(yytext,baseProt,baseVirt) //) ; bool globalScope = *yytext==':' && baseName.isEmpty(); if (!globalScope) baseName += yytext; else baseName += (yytext+2); current->args += ' '; if (!globalScope) current->args += yytext; else current->args += (yytext+2); } "<" { current->name += *yytext; sharpCount=1; lastSkipSharpContext = YY_START; specName = ¤t->name; BEGIN ( Specialization ); } "<" { baseName += *yytext; sharpCount=1; lastSkipSharpContext = YY_START; specName = &baseName; BEGIN ( Specialization ); } "<" { *specName += *yytext; sharpCount++; } ">" { *specName += *yytext; if (--sharpCount<=0) BEGIN(lastSkipSharpContext); } {BN}+ { lineCount(); *specName +=' '; } "<<" { *specName += yytext; } ">>" { *specName += yytext; } . { *specName += *yytext; } "<" { ++sharpCount; } ">" { if (--sharpCount<=0) BEGIN ( lastSkipSharpContext ); } "(" { ++roundCount; } ")" { if (--roundCount<=0) BEGIN ( lastSkipRoundContext ); } "," { current->args += ',' ; current->name = removeRedundantWhiteSpace(current->name); if (!baseName.isEmpty()) current->extends->append( new BaseInfo(baseName,baseProt,baseVirt) ); if (current->section == Entry::INTERFACE_SEC) baseProt=Public; else baseProt=Private; baseVirt=Normal; baseName.resize(0); BEGIN(BasesProt); } {B}*"{"{B}* { current->fileName = yyFileName ; current->startLine = yyLineNr ; current->name = removeRedundantWhiteSpace(current->name); if (!baseName.isEmpty()) current->extends->append( new BaseInfo(baseName,baseProt,baseVirt) ); curlyCount=0; BEGIN( ReadBody ) ; } "(" { roundCount++; } ")" { if (--roundCount==0) { BEGIN(ClassVar); } } \n { yyLineNr++; } . {BN}+ { current->program += yytext ; lineCount() ; } "/*" { current->program += yytext ; } "//" { current->program += yytext ; } [^\n\*]+ { current->program += yytext ; } .*"*/" { current->program += yytext ; BEGIN( lastContext ) ; } . { current->program += *yytext ; } ("//"{B}*)?"/*!" { //printf("Start doc block at %d\n",yyLineNr); removeSlashes=(yytext[1]=='/'); tmpDocType=-1; if (YY_START==ReadBody) current->doc+="\n\n"; else current->doc.resize(0); lastDocContext = YY_START; if (current_root->section & Entry::SCOPE_MASK) current->inside = current_root->name+"::"; BEGIN( Doc ); } ("//"{B}*)?"/**"/[^/*] { removeSlashes=(yytext[1]=='/'); lastDocContext = YY_START; if (current_root->section & Entry::SCOPE_MASK) current->inside = current_root->name+"::"; if (!Config::autoBriefFlag) // use the Qt style { tmpDocType=-1; if (YY_START==ReadBody) current->doc+="\n\n"; else current->doc.resize(0); BEGIN( Doc ); } else // Use the javadoc style { if (YY_START==ReadBody) { tmpDocType=-1; current->doc+="\n\n"; lastDocContext = ReadBody; BEGIN( Doc ); } else { tmpDocType=Doc; current->doc.resize(0); current->brief.resize(0); BEGIN( JavaDoc ); } } } "//!" { current->brief.resize(0); tmpDocType=-1; lastDocContext = YY_START; if (current_root->section & Entry::SCOPE_MASK) current->inside = current_root->name+"::"; BEGIN( LineDoc ); } "///"/[^/] { current->brief.resize(0); tmpDocType=-1; lastDocContext = YY_START; if (current_root->section & Entry::SCOPE_MASK) current->inside = current_root->name+"::"; BEGIN( LineDoc ); } "extern"{BN}+"\"C"("++")?"\""{BN}*("{")? "{" { current->type.resize(0); current->name.resize(0); current->args.resize(0); current->argList->clear(); curlyCount=0; BEGIN( SkipCurlyBlock ); } {CMD}("brief"|"short"){B}+ { lastBriefContext=tmpDocType; BEGIN( ClassDocBrief ); } ^(({B}*"*"+)?){BL} { lineCount(); if (!current->brief.stripWhiteSpace().isEmpty()) { BEGIN( tmpDocType ); } } /* "@" { unput(*yytext); BEGIN(ClassDoc); } */ ^{B}*"*"+/[^/] { //printf("---> removing %s\n",yytext); } /* [^\n\@\*\.\\]+ { current->brief+=yytext; } */ . { //printf("---> copy %c\n",*yytext); current->brief+=*yytext; } \n { current->brief+=' '; lineCount(); } ".\\"/[ \t\r\n] { current->brief+="."; } "."[ \t\r\n] { lineCount(); current->brief+="."; BEGIN( tmpDocType ); } {CMD}("image"|"author"|"internal"|"version"|"date"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note") { current->doc+=yytext; BEGIN( tmpDocType ); } "<"{TABLE}{ATTR}">" { //current->doc+=yytext; int i; for (i=yyleng-1;i>=0;i--) { unput(yytext[i]); } BEGIN( tmpDocType ); } {B}*{CMD}("fn"|"var"|"typedef"){B}* { current->section = Entry::MEMBERDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocFunc ); } {B}*{CMD}"def"{B}+ { nextDefContext = YY_START==LineDoc ? DefLineDoc : ClassDoc; current->section = Entry::DEFINEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocDefine ); } {B}*{CMD}"overload"{B}* { overloadContext = YY_START; BEGIN( ClassDocOverload ); } {B}*/"\n" { QCString orgDoc = current->doc; current->doc = getOverloadDocs(); current->doc += "\n\n"; current->doc += orgDoc; BEGIN( overloadContext ); } {B}*/"*/" { QCString orgDoc = current->doc; current->doc = getOverloadDocs(); current->doc += "\n\n"; current->doc += orgDoc; BEGIN( overloadContext ); } . { unput(*yytext); current->section = Entry::OVERLOADDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocFunc ); } {B}*{CMD}"enum"{B}* { current->section = Entry::ENUMDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( EnumDocArg1 ); } {B}*{CMD}"defgroup"{B}* { current->section = Entry::GROUPDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( GroupDocArg1 ); } {B}*{CMD}"namespace"{B}* { current->section = Entry::NAMESPACEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( NameSpaceDocArg1 ); } {B}*{CMD}"class"{B}* { current->section = Entry::CLASSDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocArg1 ); } {B}*{CMD}"union"{B}* { current->section = Entry::UNIONDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocArg1 ); } {B}*{CMD}"struct"{B}* { current->section = Entry::STRUCTDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocArg1 ); } {B}*{CMD}"interface"{B}* { current->section = Entry::INTERFACEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocArg1 ); } {B}*{CMD}"idlexcept"{B}* { current->section = Entry::EXCEPTIONDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ClassDocArg1 ); } {B}*{CMD}"page"{B}* { current->section = Entry::PAGEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( PageDocArg1 ); } {B}*{CMD}"mainpage"{B}* { current->section = Entry::MAINPAGEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( PageDocArg2 ); } {B}*{CMD}"file"{B}* { current->section = Entry::FILEDOC_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( FileDocArg1 ); } {B}*{CMD}"example"{B}* { current->section = Entry::EXAMPLE_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; BEGIN( ExampleDocArg1 ); } {CMD}"name"[^\n]*\n { memberGroupHeader=&yytext[5]; memberGroupHeader=memberGroupHeader.stripWhiteSpace(); current->section = Entry::MEMBERGRP_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; yyLineNr++; BEGIN( lastDocContext ); } {CMD}"name"{B}+ { //printf("--> mgroup found!\n"); current->section = Entry::MEMBERGRP_SEC; current->fileName = yyFileName; current->startLine = yyLineNr; //lastMemberGroupContext = lastDocContext; //lastDocContext = StoreGroupDocs; memberGroupHeader.resize(0); memberGroupDocs.resize(0); BEGIN(GroupHeader); } " Inner block starts at line %d\n",yyLineNr); //current->reset(); current = new Entry; // set default protection based on the compound type if( ce->section==Entry::CLASS_SEC ) // class current->protection = protection = Private ; else if (ce->section == Entry::ENUM_SEC ) // enum current->protection = protection = ce->protection; else if (!ce->name.isEmpty() && ce->name.at(0)=='@') // anonymous union current->protection = protection = ce->protection; else // named struct, union, or interface current->protection = protection = Public ; sig = FALSE; slot = FALSE; gstat = FALSE; virt = Normal; current->mGrpId = memberGroupId = ce->mGrpId; scanYYlex() ; delete current; current=0; ce->program.resize(0); } parseCompounds(ce); } } //---------------------------------------------------------------------------- void parseMain(Entry *rt) { initParser(); anonCount = 0; protection = Public; sig = FALSE; slot = FALSE; gstat = FALSE; virt = Normal; current_root = rt; global_root = rt; current = new Entry; inputString = rt->program; inputPosition = 0; ifCount=0; scanYYrestart( scanYYin ); BEGIN( FindMembers ); scanYYlex(); rt->program.resize(0); delete current; current=0; parseCompounds(rt); } //---------------------------------------------------------------------------- void parseDocument(OutputList &ol,const QCString &docString) { //inParamBlock=inSeeBlock=inReturnBlock=FALSE; curTable = 0; depthIf = 0; outDoc = new OutputList(&ol); currentIncludeFile.resize(0); includeFileOffset=0; includeFileLength=0; currentListIndentLevel=0; if (!docString) return; linkRef = ""; linkText = ""; inputString = docString; inputPosition = 0; scanYYrestart( scanYYin ); BEGIN( DocScan ); insideArgumentList = FALSE; insideVerbatim = FALSE; scanYYlex(); if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } if (insideItemList) { forceEndItemList(); } if (inBlock()) endBlock(); if (currentListIndentLevel>0) { warn(yyFileName,yyLineNr,"Warning: Documentation ended in the middle " "of a list (indent level %d)!",currentListIndentLevel); } if (depthIf!=0) { warn(yyFileName,yyLineNr,"Warning: Documentation block contains \\if " "without matching \\endif: nesting level is %d",depthIf); } if (!tableStack.isEmpty()) { forceEndTable(); } if (insideVerbatim) { warn(yyFileName,yyLineNr, "Warning: file ended inside a \\verbatim block!" ); } ol+=*outDoc; delete outDoc; outDoc=0; return; } //---------------------------------------------------------------------------- void parseDoc(OutputList &ol,const char *fileName,int startLine, const char *clName,const char *memName,const QCString &docString) { //printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine); initParser(); initParseCodeContext(); exampleDoc=FALSE; // do not cross reference with member docs className=clName; memberName=memName; strcpy(yyFileName,fileName); yyLineNr = startLine; parseDocument(ol,docString); } //---------------------------------------------------------------------------- void parseText(OutputList &ol,const QCString &txtString) { if (txtString.isEmpty()) return; inputString = txtString; outDoc = new OutputList(&ol); inputPosition = 0; scanYYrestart( scanYYin ); BEGIN( Text ); scanYYlex(); ol+=*outDoc; delete outDoc; outDoc=0; return; } //---------------------------------------------------------------------------- void parseExample(OutputList &ol,const QCString &docString, const char *fileName) { initParser(); initParseCodeContext(); exampleDoc=TRUE; // cross reference with member docs exampleName=fileName; strcpy(yyFileName,fileName); parseDocument(ol,docString); } //---------------------------------------------------------------------------- extern "C" { // some bogus code to keep the compiler happy void scannerYYdummy() { yy_flex_realloc(0,0); } }