From ded73e043b0479451f0d9b5c0eee5ecab07a87e5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 1 Dec 2019 14:27:27 +0100 Subject: Made scanner.l reentrant --- src/code.l | 2 +- src/doxygen.cpp | 1 - src/scanner.h | 8 +- src/scanner.l | 6700 ++++++++++++++++++++++++++++--------------------------- 4 files changed, 3377 insertions(+), 3334 deletions(-) diff --git a/src/code.l b/src/code.l index 32a0f7e..bab6b0c 100644 --- a/src/code.l +++ b/src/code.l @@ -3871,7 +3871,6 @@ CodeScanner::CodeScanner() { p = new Private; codeYYlex_init_extra(&p->state,&p->yyscanner); - YY_EXTRA_TYPE state = codeYYget_extra(p->yyscanner); } CodeScanner::~CodeScanner() @@ -3918,6 +3917,7 @@ void CodeScanner::parseCCode(CodeOutputInterface &od,const char *className,const yyextra->code = &od; yyextra->inputString = s; yyextra->inputPosition = 0; + codeYYrestart(0,yyscanner); yyextra->currentFontClass = 0; yyextra->needsTermination = FALSE; yyextra->searchCtx = searchCtx; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d4d55e7..3277bbe 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11267,7 +11267,6 @@ void parseInput() // we are done with input scanning now, so free up the buffers used by flex // (can be around 4MB) - scanFreeScanner(); pyscanFreeScanner(); /************************************************************************** diff --git a/src/scanner.h b/src/scanner.h index 65206be..fd40485 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -29,7 +29,8 @@ class CLanguageScanner : public ParserInterface { public: - virtual ~CLanguageScanner() {} + CLanguageScanner(); + virtual ~CLanguageScanner(); void startTranslationUnit(const char *fileName); void finishTranslationUnit(); void parseInput(const char *fileName, @@ -55,8 +56,9 @@ class CLanguageScanner : public ParserInterface ); void resetCodeParserState(); void parsePrototype(const char *text); + private: + struct Private; + Private *p; }; -void scanFreeScanner(); - #endif diff --git a/src/scanner.l b/src/scanner.l index 3e48916..3a71535 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -16,6 +16,8 @@ */ %option never-interactive %option prefix="scannerYY" +%option reentrant +%option extra-type="struct scannerYY_state *" %{ @@ -54,473 +56,171 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 -/* ----------------------------------------------------------------- - * - * statics - */ -static ParserInterface *g_thisParser; -static const char * g_inputString = 0; -static int g_inputPosition = 0; -static int g_lastContext = 0; -static int g_lastCContext = 0; -static int g_lastDocContext = 0; -static int g_lastCPPContext = 0; -static int g_lastSkipSharpContext = 0; -static int g_lastSkipRoundContext = 0; -static int g_lastStringContext = 0; -static int g_lastCurlyContext = 0; -static int g_lastRoundContext = 0; -static int g_lastSquareContext = 0; -static int g_lastInitializerContext = 0; -static int g_lastClassTemplSpecContext = 0; -static int g_lastPreLineCtrlContext = 0; -static int g_lastSkipVerbStringContext = 0; -static int g_lastCommentInArgContext = 0; -static int g_lastRawStringContext = 0; -static int g_lastCSConstraint = 0; -static int g_lastHereDocContext = 0; -static int g_lastDefineContext = 0; -static int g_lastAlignAsContext = 0; -static int g_lastC11AttributeContext = 0; -static int g_lastModifierContext = 0; -static Protection g_protection = Public; -static Protection g_baseProt = Public; -static int g_sharpCount = 0 ; -static int g_roundCount = 0 ; -static int g_curlyCount = 0 ; -static int g_squareCount = 0 ; -static int g_padCount = 0 ; -static std::unique_ptr g_current; -static Entry* g_current_root = 0 ; -static Entry* g_previous = 0 ; -static std::unique_ptr g_tempEntry; -static Entry* g_firstTypedefEntry = 0 ; -static Entry* g_memspecEntry = 0 ; -static int g_yyLineNr = 1 ; -static int g_yyBegLineNr = 1 ; -static int g_yyColNr = 1 ; -static int g_yyBegColNr = 1 ; -static int g_anonCount = 0 ; -static int g_anonNSCount = 0 ; -static QCString g_yyFileName; -static MethodTypes g_mtype = Method; -static bool g_stat = false; -static Specifier g_virt = Normal; -static Specifier g_baseVirt = Normal; -static QCString g_msType; -static QCString g_msName; -static QCString g_msArgs; -static bool g_isTypedef = false; -static QCString g_funcPtrType; -static QCString g_templateStr; -static QCString g_aliasName; -static QCString g_baseName; -static QCString* g_specName = 0; - -static SrcLangExt g_language = SrcLangExt_Unknown; -static bool g_insideIDL = false; //!< processing IDL code? -static bool g_insideJava = false; //!< processing Java code? -static bool g_insideCS = false; //!< processing C# code? -static bool g_insideD = false; //!< processing D code? -static bool g_insidePHP = false; //!< processing PHP code? -static bool g_insideObjC = false; //!< processing Objective C code? -static bool g_insideCli = false; //!< processing C++/CLI code? -static bool g_insideJS = false; //!< processing JavaScript code? -static bool g_insideSlice = false; //!< processing Slice code? -static bool g_insideCpp = true; //!< processing C/C++ code - -static bool g_insideCppQuote = false; -static bool g_insideProtocolList = false; - -static int g_argRoundCount = 0; -static int g_argSharpCount = 0; -static int g_currentArgumentContext = 0; -static int g_lastCopyArgStringContext = 0; -static int g_lastCopyArgContext = 0; -static QCString *g_copyArgString = 0; -static QCString g_fullArgString; -static QCString g_dummyRawString; - -static ArgumentList *g_currentArgumentList = 0; -static char g_lastCopyArgChar = '\0'; - -static QCString *g_pCopyQuotedString = 0; -static QCString *g_pCopyRoundString = 0; -static QCString *g_pCopyCurlyString = 0; -static QCString *g_pCopyRawString = 0; -static QGString *g_pCopyCurlyGString = 0; -static QGString *g_pCopyRoundGString = 0; -static QGString *g_pCopySquareGString = 0; -static QGString *g_pCopyQuotedGString = 0; -static QGString *g_pCopyHereDocGString = 0; -static QGString *g_pCopyRawGString = 0; -static QGString *g_pSkipVerbString = 0; -static QStack g_autoGroupStack; - -static bool g_insideFormula = false; -static bool g_insideTryBlock = false; -static bool g_insideCode = false; -static bool g_needsSemi = false; - -static int g_initBracketCount = 0; - -static QCString g_oldStyleArgType; -static QCString g_docBackup; -static QCString g_briefBackup; - -static int g_docBlockContext = 0; -static QGString g_docBlock; -static QCString g_docBlockName; -static bool g_docBlockInBody = false; -static bool g_docBlockAutoBrief = false; -static char g_docBlockTerm = '\0'; - -static QCString g_idlAttr; -static QCString g_idlProp; -static bool g_odlProp = false; - -static bool g_lexInit = false; -static bool g_externC = false; - -static QCString g_delimiter; - -static int g_column = 0; - -static int g_fencedSize = 0; -static bool g_nestedComment = 0; -static std::vector< std::pair > > g_outerScopeEntries; -static CodeScanner g_codeScanner; - -static const char *stateToString(int state); -//----------------------------------------------------------------------------- - -// forward declarations -//static void handleGroupStartCommand(const char *header); -//static void handleGroupEndCommand(); - -//----------------------------------------------------------------------------- - -static void initParser() -{ - g_outerScopeEntries.clear(); - g_baseName.resize(0); - g_protection = Public; - g_baseProt = Public; - g_sharpCount = 0; - g_roundCount = 0; - g_curlyCount = 0; - g_mtype = Method; - g_stat = FALSE; - g_virt = Normal; - g_baseVirt = Normal; - g_isTypedef = FALSE; - g_autoGroupStack.clear(); - g_insideTryBlock = FALSE; - g_autoGroupStack.setAutoDelete(TRUE); - g_insideFormula = FALSE; - g_insideCode=FALSE; - g_insideCli=Config_getBool(CPP_CLI_SUPPORT); - g_previous = 0; - g_firstTypedefEntry = 0; - g_memspecEntry =0; -} - -static void initEntry() -{ - if (g_insideJava) - { - g_protection = (g_current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; - } - g_current->protection = g_protection ; - g_current->mtype = g_mtype; - g_current->virt = g_virt; - g_current->stat = g_stat; - g_current->lang = g_language; - //printf("*** initEntry() g_language=%d\n",g_language); - Doxygen::docGroup.initGroupInfo(g_current.get()); - g_isTypedef=FALSE; -} - - -//----------------------------------------------------------------------------- - -static void lineCount() -{ - int tabSize = Config_getInt(TAB_SIZE); - const char *p; - for (p = yytext ; *p ; ++p ) - { - if (*p=='\n') - { - g_yyLineNr++,g_column=0,g_yyColNr=1; - } - else if (*p=='\t') - { - g_column+=tabSize - (g_column%tabSize); - } - else - { - g_column++,g_yyColNr++; - } - } - //printf("lineCount()=%d\n",g_column); -} - -static inline int computeIndent(const char *s,int startIndent) -{ - int col=startIndent; - int tabSize=Config_getInt(TAB_SIZE); - const char *p=s; - char c; - while ((c=*p++)) - { - if (c=='\t') col+=tabSize-(col%tabSize); - else if (c=='\n') col=0; - else col++; - } - return col; -} - -static void addType() -{ - uint tl=g_current->type.length(); - if( tl>0 && !g_current->name.isEmpty() && g_current->type.at(tl-1)!='.') - { - g_current->type += ' ' ; - } - g_current->type += g_current->name ; - g_current->name.resize(0) ; - tl=g_current->type.length(); - if( tl>0 && !g_current->args.isEmpty() && g_current->type.at(tl-1)!='.') - { - g_current->type += ' ' ; - } - g_current->type += g_current->args ; - g_current->args.resize(0) ; - g_current->argList.clear(); -} - - -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 void startCommentBlock(bool); -static void handleCommentBlock(const QCString &doc,bool brief); -static void handleParametersCommentBlocks(ArgumentList &al); - -//----------------------------------------------------------------- - -static bool nameIsOperator(QCString &name) -{ - int i=name.find("operator"); - if (i==-1) return FALSE; - if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X - if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator - return FALSE; // case TEXToperatorTEXT -} - -//----------------------------------------------------------------------------- - -static void setContext() -{ - g_language = getLanguageFromFileName(g_yyFileName); - g_insideIDL = g_language==SrcLangExt_IDL; - g_insideJava = g_language==SrcLangExt_Java; - g_insideCS = g_language==SrcLangExt_CSharp; - g_insideD = g_language==SrcLangExt_D; - g_insidePHP = g_language==SrcLangExt_PHP; - g_insideObjC = g_language==SrcLangExt_ObjC; - g_insideJS = g_language==SrcLangExt_JS; - g_insideSlice = g_language==SrcLangExt_Slice; - g_insideCpp = g_language==SrcLangExt_Cpp; - //printf("setContext(%s) g_insideIDL=%d g_insideJava=%d g_insideCS=%d " - // "g_insideD=%d g_insidePHP=%d g_insideObjC=%d\n", - // g_yyFileName.data(),g_insideIDL,g_insideJava,g_insideCS,g_insideD,g_insidePHP,g_insideObjC - // ); -} - -//----------------------------------------------------------------------------- - -static void prependScope() -{ - if (g_current_root->section & Entry::SCOPE_MASK) - { - //printf("--- prependScope %s to %s\n",g_current_root->name.data(),g_current->name.data()); - g_current->name.prepend(g_current_root->name+"::"); - //printf("prependScope #=%d #g_current=%d\n",g_current_root->tArgLists->count(),g_current->tArgLists->count()); - for (const ArgumentList &srcAl : g_current_root->tArgLists) - { - g_current->tArgLists.insert(g_current->tArgLists.begin(),srcAl); - } - } -} - -//----------------------------------------------------------------------------- - -/*! Returns TRUE iff the g_current entry could be a K&R style C function */ -static bool checkForKnRstyleC() -{ - if (((QCString)g_yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file - if (g_current->argList.empty()) return FALSE; // must have arguments - for (const Argument &a : g_current->argList) - { - // in K&R style argument do not have a type, but doxygen expects a type - // so it will think the argument has no name - if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE; - } - return TRUE; -} - -//----------------------------------------------------------------------------- - -static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) -{ - int si = g_current->args.length(); - if (g_oldStyleArgType.isEmpty()) // new argument - { - static QRegExp re("([^)]*)"); - int bi1 = g_current->args.findRev(re); - int bi2 = bi1!=-1 ? g_current->args.findRev(re,bi1-1) : -1; - char c; - if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)" - { - int s=bi2+1; - g_oldStyleArgType = g_current->args.left(s); - int i=s; - while (iargs.at(i))=='*' || isspace((uchar)c))) i++; - g_oldStyleArgType += g_current->args.mid(s,i-s); - s=i; - while (iargs.at(i))) i++; - oldStyleArgName = g_current->args.mid(s,i-s); - g_oldStyleArgType+=g_current->args.mid(i); - } - else if (bi1!=-1) // redundant braces like in "int (*var)" - { - int s=bi1; - g_oldStyleArgType = g_current->args.left(s); - s++; - int i=s+1; - while (iargs.at(i))=='*' || isspace((uchar)c))) i++; - g_oldStyleArgType += g_current->args.mid(s,i-s); - s=i; - while (iargs.at(i))) i++; - oldStyleArgName = g_current->args.mid(s,i-s); - } - else // normal "int *var" - { - int l=si,i=l-1,j; - char c; - // look for start of name in "type *name" - while (i>=0 && isId(g_current->args.at(i))) i--; - j=i+1; - // look for start of *'s - while (i>=0 && ((c=g_current->args.at(i))=='*' || isspace((uchar)c))) i--; - i++; - if (i!=l) - { - g_oldStyleArgType=g_current->args.left(i); - oldStyleArgPtr=g_current->args.mid(i,j-i); - oldStyleArgName=g_current->args.mid(j).stripWhiteSpace(); - } - else - { - oldStyleArgName=g_current->args.copy().stripWhiteSpace(); - } - } - } - else // continuation like *arg2 in "int *args,*arg2" - { - int l=si,j=0; - char c; - while (jargs.at(j))=='*' || isspace((uchar)c))) j++; - if (j>0) - { - oldStyleArgPtr=g_current->args.left(j); - oldStyleArgName=g_current->args.mid(j).stripWhiteSpace(); - } - else - { - oldStyleArgName=g_current->args.copy().stripWhiteSpace(); - } - } -} - -//----------------------------------------------------------------------------- - -/*! Update the argument \a name with additional \a type info. For K&R style - * function the type is found \e after the argument list, so this routine - * in needed to fix up. - */ -static void addKnRArgInfo(const QCString &type,const QCString &name, - const QCString &brief,const QCString &docs) +struct scannerYY_state { - for (Argument &a : g_current->argList) - { - if (a.type==name) - { - a.type=type.stripWhiteSpace(); - if (a.type.left(9)=="register ") // strip keyword - { - a.type=a.type.mid(9); - } - a.name=name.stripWhiteSpace(); - if (!brief.isEmpty() && !docs.isEmpty()) - { - a.docs=brief+"\n\n"+docs; - } - else if (!brief.isEmpty()) - { - a.docs=brief; - } - else - { - a.docs=docs; - } - } - } -} + ParserInterface *thisParser; + const char * inputString = 0; + int inputPosition = 0; + int lastContext = 0; + int lastCContext = 0; + int lastDocContext = 0; + int lastCPPContext = 0; + int lastSkipSharpContext = 0; + int lastSkipRoundContext = 0; + int lastStringContext = 0; + int lastCurlyContext = 0; + int lastRoundContext = 0; + int lastSquareContext = 0; + int lastInitializerContext = 0; + int lastClassTemplSpecContext = 0; + int lastPreLineCtrlContext = 0; + int lastSkipVerbStringContext = 0; + int lastCommentInArgContext = 0; + int lastRawStringContext = 0; + int lastCSConstraint = 0; + int lastHereDocContext = 0; + int lastDefineContext = 0; + int lastAlignAsContext = 0; + int lastC11AttributeContext = 0; + int lastModifierContext = 0; + Protection protection = Public; + Protection baseProt = Public; + int sharpCount = 0 ; + int roundCount = 0 ; + int curlyCount = 0 ; + int squareCount = 0 ; + int padCount = 0 ; + std::unique_ptr current; + Entry* current_root = 0 ; + Entry* previous = 0 ; + std::unique_ptr tempEntry; + Entry* firstTypedefEntry = 0 ; + Entry* memspecEntry = 0 ; + int yyLineNr = 1 ; + int yyBegLineNr = 1 ; + int yyColNr = 1 ; + int yyBegColNr = 1 ; + int anonCount = 0 ; + int anonNSCount = 0 ; + QCString yyFileName; + MethodTypes mtype = Method; + bool stat = false; + Specifier virt = Normal; + Specifier baseVirt = Normal; + QCString msType; + QCString msName; + QCString msArgs; + bool isTypedef = false; + QCString funcPtrType; + QCString templateStr; + QCString aliasName; + QCString baseName; + QCString* specName = 0; + + SrcLangExt language = SrcLangExt_Unknown; + bool insideIDL = false; //!< processing IDL code? + bool insideJava = false; //!< processing Java code? + bool insideCS = false; //!< processing C# code? + bool insideD = false; //!< processing D code? + bool insidePHP = false; //!< processing PHP code? + bool insideObjC = false; //!< processing Objective C code? + bool insideCli = false; //!< processing C++/CLI code? + bool insideJS = false; //!< processing JavaScript code? + bool insideSlice = false; //!< processing Slice code? + bool insideCpp = true; //!< processing C/C++ code + + bool insideCppQuote = false; + bool insideProtocolList = false; + + int argRoundCount = 0; + int argSharpCount = 0; + int currentArgumentContext = 0; + int lastCopyArgStringContext = 0; + int lastCopyArgContext = 0; + QCString *copyArgString = 0; + QCString fullArgString; + QCString dummyRawString; + + ArgumentList *currentArgumentList = 0; + char lastCopyArgChar = '\0'; + + QCString *pCopyQuotedString = 0; + QCString *pCopyRoundString = 0; + QCString *pCopyCurlyString = 0; + QCString *pCopyRawString = 0; + QGString *pCopyCurlyGString = 0; + QGString *pCopyRoundGString = 0; + QGString *pCopySquareGString = 0; + QGString *pCopyQuotedGString = 0; + QGString *pCopyHereDocGString = 0; + QGString *pCopyRawGString = 0; + QGString *pSkipVerbString = 0; + QStack autoGroupStack; + + bool insideFormula = false; + bool insideTryBlock = false; + bool insideCode = false; + bool needsSemi = false; + + int initBracketCount = 0; + + QCString oldStyleArgType; + QCString docBackup; + QCString briefBackup; + + int docBlockContext = 0; + QGString docBlock; + QCString docBlockName; + bool docBlockInBody = false; + bool docBlockAutoBrief = false; + char docBlockTerm = '\0'; + + QCString idlAttr; + QCString idlProp; + bool odlProp = false; + + bool lexInit = false; + bool externC = false; + + QCString delimiter; + + int column = 0; + + int fencedSize = 0; + bool nestedComment = 0; + std::vector< std::pair > > outerScopeEntries; + CodeScanner codeScanner; +}; +static const char *stateToString(int state); //----------------------------------------------------------------------------- +// forward declarations for stateless functions +static inline int computeIndent(const char *s,int startIndent); +static QCString stripQuotes(const char *s); +static bool nameIsOperator(QCString &name); +void fixArgumentListForJavaScript(ArgumentList &al); + +// forward declarations for statefull functions +static void initParser(yyscan_t yyscanner); +static void initEntry(yyscan_t yyscanner); +static void lineCount(yyscan_t yyscanner); +static void addType(yyscan_t yyscanner); +static void setContext(yyscan_t yyscanner); +static void prependScope(yyscan_t yyscanner); +static void startCommentBlock(yyscan_t yyscanner,bool); +static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief); +static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al); +static bool checkForKnRstyleC(yyscan_t yyscanner); +static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &oldStyleArgName); +static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString &name, + const QCString &brief,const QCString &docs); +static int yyread(yyscan_t yyscanner,char *buf,int max_size); -void fixArgumentListForJavaScript(ArgumentList &al) -{ - for (Argument &a : al) - { - if (!a.type.isEmpty() && a.name.isEmpty()) - { // a->type is actually the (typeless) parameter name, so move it - a.name=a.type; - a.type.resize(0); - } - } -} /* ----------------------------------------------------------------- */ #undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); - -static int yyread(char *buf,int max_size) -{ - int c=0; - while( c < max_size && g_inputString[g_inputPosition] ) - { - *buf = g_inputString[g_inputPosition++] ; - //printf("%d (%c)\n",*buf,*buf); - c++; buf++; - } - return c; -} +#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); %} @@ -717,32 +417,32 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %% "{" { - g_curlyCount=0; - g_needsSemi = TRUE; + yyextra->curlyCount=0; + yyextra->needsSemi = TRUE; BEGIN(SkipCurlyBlock); } "(" { - g_roundCount=0; + yyextra->roundCount=0; BEGIN(SkipRoundBlock); } "(" { - ++g_roundCount; + ++yyextra->roundCount; } ")" { - if (g_roundCount ) - --g_roundCount ; + if (yyextra->roundCount ) + --yyextra->roundCount ; else BEGIN( NextSemi ) ; } "{" { - ++g_curlyCount ; + ++yyextra->curlyCount ; } "}" { - if( g_curlyCount ) + if( yyextra->curlyCount ) { - --g_curlyCount ; + --yyextra->curlyCount ; } - else if (g_needsSemi) + else if (yyextra->needsSemi) { BEGIN( NextSemi ); } @@ -752,15 +452,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } \' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_lastStringContext=NextSemi; + yyextra->lastStringContext=NextSemi; BEGIN(SkipPHPString); } } -{CHARLIT} { if (g_insidePHP) REJECT; } +{CHARLIT} { if (yyextra->insidePHP) REJECT; } \" { - g_lastStringContext=NextSemi; + yyextra->lastStringContext=NextSemi; BEGIN(SkipString); } [;,] { @@ -772,22 +472,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } [{;,] { - g_current->args = g_current->args.simplifyWhiteSpace(); + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); unput(*yytext); BEGIN( ClassVar ); } "insidePHP = TRUE; } """ { // PHP code start - lineCount() ; + lineCount(yyscanner) ; BEGIN( FindMembers ); } "?>"|"" { // PHP code end - if (g_insidePHP) + if (yyextra->insidePHP) BEGIN( FindMembersPHP ); else REJECT; @@ -795,100 +495,100 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) [^\n<]+ { // Non-PHP code text, ignore } \n { // Non-PHP code text, ignore - lineCount(); + lineCount(yyscanner); } . { // Non-PHP code text, ignore } -{PHPKW} { if (g_insidePHP) +{PHPKW} { if (yyextra->insidePHP) BEGIN( NextSemi ); else REJECT; } "%{"[^\n]* { // Mozilla XPIDL lang-specific block - if (!g_insideIDL) + if (!yyextra->insideIDL) REJECT; } "%}" { // Mozilla XPIDL lang-specific block end - if (!g_insideIDL) + if (!yyextra->insideIDL) REJECT; } {B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property - g_current->mtype = g_mtype = Property; - g_current->protection = g_protection = Public ; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->mtype = yyextra->mtype = Property; + yyextra->current->protection = yyextra->protection = Public ; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } -{B}*"k_dcop"{BN}*":"{BN}* { g_current->mtype = g_mtype = DCOP; - g_current->protection = g_protection = Public ; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; +{B}*"k_dcop"{BN}*":"{BN}* { yyextra->current->mtype = yyextra->mtype = DCOP; + yyextra->current->protection = yyextra->protection = Public ; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } -{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { g_current->mtype = g_mtype = Signal; +{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { yyextra->current->mtype = yyextra->mtype = Signal; - g_current->protection = g_protection = Public ; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Public ; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } {B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - g_current->protection = g_protection = Public ; - g_current->mtype = g_mtype = Slot; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount(); + yyextra->current->protection = yyextra->protection = Public ; + yyextra->current->mtype = yyextra->mtype = Slot; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner); } {B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - g_current->protection = g_protection = Protected ; - g_current->mtype = g_mtype = Slot; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount(); + yyextra->current->protection = yyextra->protection = Protected ; + yyextra->current->mtype = yyextra->mtype = Slot; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner); } {B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - g_current->protection = g_protection = Private ; - g_current->mtype = g_mtype = Slot; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount(); + yyextra->current->protection = yyextra->protection = Private ; + yyextra->current->mtype = yyextra->mtype = Slot; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner); } {B}*("public"|"methods"|"__published"){BN}*":"{BN}* { - g_current->protection = g_protection = Public ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Public ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } {B}*"internal"{BN}*":"{BN}* { // for now treat C++/CLI's internal as package... - if (g_insideCli) + if (yyextra->insideCli) { - g_current->protection = g_protection = Package ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Package ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } else { @@ -896,38 +596,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"protected"{BN}*":"{BN}* { - g_current->protection = g_protection = Protected ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Protected ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } {B}*"private"{BN}*":"{BN}* { - g_current->protection = g_protection = Private ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Private ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } {B}*"event"{BN}+ { - if (g_insideCli) + if (yyextra->insideCli) { // C++/CLI event - lineCount() ; - g_current->mtype = g_mtype = Event; - g_current->bodyLine = g_yyLineNr; - g_curlyCount=0; + lineCount(yyscanner) ; + yyextra->current->mtype = yyextra->mtype = Event; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->curlyCount=0; BEGIN( CliPropertyType ); } - else if (g_insideCS) + else if (yyextra->insideCS) { - lineCount() ; - g_current->mtype = Event; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner) ; + yyextra->current->mtype = Event; + yyextra->current->bodyLine = yyextra->yyLineNr; } else { @@ -935,13 +635,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"property"{BN}+ { - if (g_insideCli) + if (yyextra->insideCli) { // C++/CLI property - lineCount() ; - g_current->mtype = g_mtype = Property; - g_current->bodyLine = g_yyLineNr; - g_curlyCount=0; + lineCount(yyscanner) ; + yyextra->current->mtype = yyextra->mtype = Property; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->curlyCount=0; BEGIN( CliPropertyType ); } else @@ -950,16 +650,16 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {ID} { - addType(); - g_current->name = yytext; + addType(yyscanner); + yyextra->current->name = yytext; } "[" { // C++/CLI indexed property - g_current->args = "["; + yyextra->current->args = "["; BEGIN( CliPropertyIndex ); } "{" { - g_curlyCount=0; - //printf("event: '%s' '%s'\n",g_current->type.data(),g_current->name.data()); + yyextra->curlyCount=0; + //printf("event: '%s' '%s'\n",yyextra->current->type.data(),yyextra->current->name.data()); BEGIN( CSAccessorDecl ); } ";" { @@ -967,84 +667,84 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } \n { - lineCount(); + lineCount(yyscanner); } {B}* { } . { - addType(); - g_current->type += yytext; + addType(yyscanner); + yyextra->current->type += yytext; } "]" { BEGIN( CliPropertyType ); - g_current->args+=yytext; + yyextra->current->args+=yytext; } . { - g_current->args+=yytext; + yyextra->current->args+=yytext; } /* {B}*"property"{BN}+ { - if (!g_current->type.isEmpty()) + if (!yyextra->current->type.isEmpty()) { REJECT; } else { - g_current->mtype = g_mtype = Property; - lineCount(); + yyextra->current->mtype = yyextra->mtype = Property; + lineCount(yyscanner); } } */ {B}*"@private"{BN}+ { - g_current->protection = g_protection = Private ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Private ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } {B}*"@protected"{BN}+ { - g_current->protection = g_protection = Protected ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Protected ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } {B}*"@public"{BN}+ { - g_current->protection = g_protection = Public ; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); - lineCount() ; + yyextra->current->protection = yyextra->protection = Public ; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); + lineCount(yyscanner) ; } [\-+]{BN}* { - if (!g_insideObjC) + if (!yyextra->insideObjC) { REJECT; } else { - lineCount(); - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - g_current->section = Entry::FUNCTION_SEC; - g_current->protection = g_protection = Public ; - g_language = g_current->lang = SrcLangExt_ObjC; - g_insideObjC = TRUE; - g_current->virt = Virtual; - g_current->stat=yytext[0]=='+'; - g_current->mtype = g_mtype = Method; - g_current->type.resize(0); - g_current->name.resize(0); - g_current->args.resize(0); - g_current->argList.clear(); + lineCount(yyscanner); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->section = Entry::FUNCTION_SEC; + yyextra->current->protection = yyextra->protection = Public ; + yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; + yyextra->insideObjC = TRUE; + yyextra->current->virt = Virtual; + yyextra->current->stat=yytext[0]=='+'; + yyextra->current->mtype = yyextra->mtype = Method; + yyextra->current->type.resize(0); + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->argList.clear(); BEGIN( ObjCMethod ); } } @@ -1052,24 +752,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( ObjCReturnType ); } {ID} { // found method name - if (g_current->type.isEmpty()) + if (yyextra->current->type.isEmpty()) { - g_current->type = "id"; + yyextra->current->type = "id"; } - g_current->name = yytext; - if (g_insideCpp || g_insideObjC) + yyextra->current->name = yytext; + if (yyextra->insideCpp || yyextra->insideObjC) { - g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); + yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext); } } ":"{B}* { // start of parameter list - g_current->name += ':'; + yyextra->current->name += ':'; Argument a; - g_current->argList.push_back(a); + yyextra->current->argList.push_back(a); BEGIN( ObjCParams ); } [^)]* { // TODO: check if nested braches are possible. - g_current->type = yytext; + yyextra->current->type = yytext; } ")" { BEGIN( ObjCMethod ); @@ -1079,140 +779,140 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) keyw=keyw.left(keyw.length()-1).stripWhiteSpace(); // strip : if (keyw.isEmpty()) { - g_current->name += " :"; + yyextra->current->name += " :"; } else { - g_current->name += keyw+":"; + yyextra->current->name += keyw+":"; } - if (g_current->argList.back().type.isEmpty()) + if (yyextra->current->argList.back().type.isEmpty()) { - g_current->argList.back().type="id"; + yyextra->current->argList.back().type="id"; } Argument a; a.attrib=(QCString)"["+keyw+"]"; - g_current->argList.push_back(a); + yyextra->current->argList.push_back(a); } {ID}{BN}* { // name of parameter - lineCount(); - g_current->argList.back().name=QCString(yytext).stripWhiteSpace(); + lineCount(yyscanner); + yyextra->current->argList.back().name=QCString(yytext).stripWhiteSpace(); } ","{BN}*"..." { // name of parameter - lineCount(); + lineCount(yyscanner); // do we want the comma as part of the name? - //g_current->name += ","; + //yyextra->current->name += ","; Argument a; a.attrib="[,]"; a.type="..."; - g_current->argList.push_back(a); + yyextra->current->argList.push_back(a); } /* ":" { - g_current->name += ':'; + yyextra->current->name += ':'; } */ "(" { - g_roundCount=0; - g_current->argList.back().type.resize(0); + yyextra->roundCount=0; + yyextra->current->argList.back().type.resize(0); BEGIN( ObjCParamType ); } "(" { - g_roundCount++; - g_current->argList.back().type+=yytext; + yyextra->roundCount++; + yyextra->current->argList.back().type+=yytext; } ")"/{B}* { - if (g_roundCount<=0) + if (yyextra->roundCount<=0) { BEGIN( ObjCParams ); } else { - g_current->argList.back().type+=yytext; - g_roundCount--; + yyextra->current->argList.back().type+=yytext; + yyextra->roundCount--; } } [^()]* { - g_current->argList.back().type+=QCString(yytext).stripWhiteSpace(); + yyextra->current->argList.back().type+=QCString(yytext).stripWhiteSpace(); } ";" { // end of method declaration - if (!g_current->argList.empty() && g_current->argList.back().type.isEmpty()) + if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty()) { - g_current->argList.back().type="id"; + yyextra->current->argList.back().type="id"; } - if (g_current->argList.empty()) // method without parameters + if (yyextra->current->argList.empty()) // method without parameters { - g_current->argList.noParameters = TRUE; + yyextra->current->argList.noParameters = TRUE; } - g_current->args = argListToString(g_current->argList); - //printf("argList=%s\n",g_current->args.data()); + yyextra->current->args = argListToString(yyextra->current->argList); + //printf("argList=%s\n",yyextra->current->args.data()); unput(';'); BEGIN( Function ); } (";"{BN}+)?"{" { // start of a method body - lineCount(); + lineCount(yyscanner); //printf("Type=%s Name=%s args=%s\n", - // g_current->type.data(),g_current->name.data(),argListToString(g_current->argList).data() + // yyextra->current->type.data(),yyextra->current->name.data(),argListToString(yyextra->current->argList).data() // ); - if (!g_current->argList.empty() && g_current->argList.back().type.isEmpty()) + if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty()) { - g_current->argList.back().type="id"; + yyextra->current->argList.back().type="id"; } - if (g_current->argList.empty()) // method without parameters + if (yyextra->current->argList.empty()) // method without parameters { - g_current->argList.noParameters = TRUE; + yyextra->current->argList.noParameters = TRUE; } - g_current->args = argListToString(g_current->argList); + yyextra->current->args = argListToString(yyextra->current->argList); unput('{'); BEGIN( Function ); } {B}*"sequence"{BN}*"<"{BN}* { - if (g_insideSlice) - { - lineCount(); - g_current->bodyLine = g_yyLineNr; - g_current->fileName = g_yyFileName ; - g_current->startLine = g_yyLineNr ; - g_current->startColumn = g_yyColNr; - g_current->args.resize(0); - g_current->section = Entry::TYPEDEF_SEC ; - g_isTypedef = TRUE; + if (yyextra->insideSlice) + { + lineCount(yyscanner); + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->fileName = yyextra->yyFileName ; + yyextra->current->startLine = yyextra->yyLineNr ; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->args.resize(0); + yyextra->current->section = Entry::TYPEDEF_SEC ; + yyextra->isTypedef = TRUE; BEGIN( SliceSequence ); } else REJECT; } {B}*"dictionary"{BN}*"<"{BN}* { - if (g_insideSlice) - { - lineCount(); - g_current->bodyLine = g_yyLineNr; - g_current->fileName = g_yyFileName ; - g_current->startLine = g_yyLineNr ; - g_current->startColumn = g_yyColNr; - g_current->args.resize(0); - g_current->section = Entry::TYPEDEF_SEC ; - g_isTypedef = TRUE; + if (yyextra->insideSlice) + { + lineCount(yyscanner); + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->fileName = yyextra->yyFileName ; + yyextra->current->startLine = yyextra->yyLineNr ; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->args.resize(0); + yyextra->current->section = Entry::TYPEDEF_SEC ; + yyextra->isTypedef = TRUE; BEGIN( SliceDictionary ); } else REJECT; } {BN}{1,80} { - lineCount(); + lineCount(yyscanner); } "@"({ID}".")*{ID}{BN}*"(" { - if (g_insideJava) // Java annotation + if (yyextra->insideJava) // Java annotation { - lineCount(); - g_lastSkipRoundContext = YY_START; - g_roundCount=0; + lineCount(yyscanner); + yyextra->lastSkipRoundContext = YY_START; + yyextra->roundCount=0; BEGIN( SkipRound ); } else if (qstrncmp(yytext,"@property",9)==0) // ObjC 2.0 property { - g_current->mtype = g_mtype = Property; - g_current->spec|=Entry::Readable | Entry::Writable | Entry::Assign; - g_current->protection = Public ; + yyextra->current->mtype = yyextra->mtype = Property; + yyextra->current->spec|=Entry::Readable | Entry::Writable | Entry::Assign; + yyextra->current->protection = Public ; unput('('); BEGIN( ObjCPropAttr ); } @@ -1222,54 +922,54 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } "getter="{ID} { - g_current->read = yytext+7; + yyextra->current->read = yytext+7; } "setter="{ID} { - g_current->write = yytext+7; + yyextra->current->write = yytext+7; } "readonly" { - g_current->spec&=~Entry::Writable; + yyextra->current->spec&=~Entry::Writable; } "readwrite" { // default } "assign" { // default } "unsafe_unretained" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Unretained; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Unretained; } "retain" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Retain; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Retain; } "copy" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Copy; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Copy; } "weak" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Weak; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Weak; } "strong" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Strong; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Strong; } "nonatomic" { - g_current->spec|=Entry::NonAtomic; + yyextra->current->spec|=Entry::NonAtomic; } ")" { BEGIN(FindMembers); } "@"{ID} { - if (g_insideJava) // Java annotation + if (yyextra->insideJava) // Java annotation { // skip annotation } else if (qstrcmp(yytext,"@property")==0) // ObjC 2.0 property { - g_current->mtype = g_mtype = Property; - g_current->spec|=Entry::Writable | Entry::Readable; - g_current->protection = Public ; + yyextra->current->mtype = yyextra->mtype = Property; + yyextra->current->spec|=Entry::Writable | Entry::Readable; + yyextra->current->protection = Public ; } else if (qstrcmp(yytext,"@synthesize")==0) { @@ -1288,58 +988,58 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } {ID}(("."|"\\"){ID})* { - g_isTypedef=FALSE; - //printf("Found namespace %s lang=%d\n",yytext,g_current->lang); - g_current->name = yytext; - g_current->name = substitute(g_current->name,".","::"); - g_current->name = substitute(g_current->name,"\\","::"); - g_current->section = Entry::NAMESPACE_SEC; - g_current->type = "namespace" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount(); + yyextra->isTypedef=FALSE; + //printf("Found namespace %s lang=%d\n",yytext,yyextra->current->lang); + yyextra->current->name = yytext; + yyextra->current->name = substitute(yyextra->current->name,".","::"); + yyextra->current->name = substitute(yyextra->current->name,"\\","::"); + yyextra->current->section = Entry::NAMESPACE_SEC; + yyextra->current->type = "namespace" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner); } ";" { - Entry *tmp = g_current.get(); - g_current_root->moveToSubEntryAndRefresh(g_current); - g_current_root = tmp; - initEntry(); + Entry *tmp = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + yyextra->current_root = tmp; + initEntry(yyscanner); BEGIN(FindMembers); } "{" { - g_curlyCount=0; + yyextra->curlyCount=0; BEGIN( ReadNSBody ); } {B}*"initonly"{BN}+ { - g_current->type += " initonly "; - if (g_insideCli) g_current->spec |= Entry::Initonly; - lineCount(); + yyextra->current->type += " initonly "; + if (yyextra->insideCli) yyextra->current->spec |= Entry::Initonly; + lineCount(yyscanner); } -{B}*"static"{BN}+ { g_current->type += " static "; - g_current->stat = TRUE; - lineCount(); +{B}*"static"{BN}+ { yyextra->current->type += " static "; + yyextra->current->stat = TRUE; + lineCount(yyscanner); } {B}*"extern"{BN}+ { - g_current->stat = FALSE; - g_current->explicitExternal = TRUE; - lineCount(); + yyextra->current->stat = FALSE; + yyextra->current->explicitExternal = TRUE; + lineCount(yyscanner); } -{B}*"const"{BN}+ { g_current->type += " const "; - if (g_insideCS) g_current->stat = TRUE; - lineCount(); +{B}*"const"{BN}+ { yyextra->current->type += " const "; + if (yyextra->insideCS) yyextra->current->stat = TRUE; + lineCount(yyscanner); } -{B}*"virtual"{BN}+ { g_current->type += " virtual "; - g_current->virt = Virtual; - lineCount(); +{B}*"virtual"{BN}+ { yyextra->current->type += " virtual "; + yyextra->current->virt = Virtual; + lineCount(yyscanner); } {B}*"constexpr"{BN}+ { - if (g_insideCpp) + if (yyextra->insideCpp) { - g_current->type += " constexpr "; - g_current->spec |= Entry::ConstExpr; - lineCount(); + yyextra->current->type += " constexpr "; + yyextra->current->spec |= Entry::ConstExpr; + lineCount(yyscanner); } else { @@ -1347,10 +1047,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"published"{BN}+ { // UNO IDL published keyword - if (g_insideIDL) + if (yyextra->insideIDL) { - lineCount(); - g_current->spec |= Entry::Published; + lineCount(yyscanner); + yyextra->current->spec |= Entry::Published; } else { @@ -1358,60 +1058,60 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"abstract"{BN}+ { - if (!g_insidePHP) + if (!yyextra->insidePHP) { - g_current->type += " abstract "; - if (!g_insideJava) + yyextra->current->type += " abstract "; + if (!yyextra->insideJava) { - g_current->virt = Pure; + yyextra->current->virt = Pure; } else { - g_current->spec|=Entry::Abstract; + yyextra->current->spec|=Entry::Abstract; } } else { - g_current->spec|=Entry::Abstract; + yyextra->current->spec|=Entry::Abstract; } - lineCount(); + lineCount(yyscanner); } -{B}*"inline"{BN}+ { g_current->spec|=Entry::Inline; - lineCount(); +{B}*"inline"{BN}+ { yyextra->current->spec|=Entry::Inline; + lineCount(yyscanner); } -{B}*"mutable"{BN}+ { g_current->spec|=Entry::Mutable; - lineCount(); +{B}*"mutable"{BN}+ { yyextra->current->spec|=Entry::Mutable; + lineCount(yyscanner); } -{B}*"explicit"{BN}+ { g_current->spec|=Entry::Explicit; - lineCount(); +{B}*"explicit"{BN}+ { yyextra->current->spec|=Entry::Explicit; + lineCount(yyscanner); } -{B}*"local"{BN}+ { g_current->spec|=Entry::Local; - lineCount(); +{B}*"local"{BN}+ { yyextra->current->spec|=Entry::Local; + lineCount(yyscanner); } {B}*"@required"{BN}+ { // Objective C 2.0 protocol required section - g_current->spec=(g_current->spec & ~Entry::Optional) | Entry::Required; - lineCount(); + yyextra->current->spec=(yyextra->current->spec & ~Entry::Optional) | Entry::Required; + lineCount(yyscanner); } {B}*"@optional"{BN}+ { // Objective C 2.0 protocol optional section - g_current->spec=(g_current->spec & ~Entry::Required) | Entry::Optional; - lineCount(); + yyextra->current->spec=(yyextra->current->spec & ~Entry::Required) | Entry::Optional; + lineCount(yyscanner); } /* {B}*"import"{BN}+ { // IDL import keyword BEGIN( NextSemi ); } */ -{B}*"typename"{BN}+ { lineCount(); } +{B}*"typename"{BN}+ { lineCount(yyscanner); } {B}*"namespace"{BN}*/[^a-z_A-Z0-9] { - g_isTypedef=FALSE; - g_current->section = Entry::NAMESPACE_SEC; - g_current->type = "namespace" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount(); - if (g_insidePHP) + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::NAMESPACE_SEC; + yyextra->current->type = "namespace" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner); + if (yyextra->insidePHP) { BEGIN( PackageName ); } @@ -1421,449 +1121,449 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"module"{BN}+ { - lineCount(); - if (g_insideIDL || g_insideSlice) - { - g_isTypedef=FALSE; - g_current->section = Entry::NAMESPACE_SEC; - g_current->type = "module" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + if (yyextra->insideIDL || yyextra->insideSlice) + { + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::NAMESPACE_SEC; + yyextra->current->type = "module" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } - else if (g_insideD) + else if (yyextra->insideD) { - lineCount(); + lineCount(yyscanner); BEGIN(PackageName); } else { - addType(); - g_current->name = QCString(yytext).stripWhiteSpace(); + addType(yyscanner); + yyextra->current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"library"{BN}+ { - lineCount(); - if (g_insideIDL) - { - g_isTypedef=FALSE; - g_current->section = Entry::NAMESPACE_SEC; - g_current->type = "library" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + if (yyextra->insideIDL) + { + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::NAMESPACE_SEC; + yyextra->current->type = "library" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } else { - addType(); - g_current->name = QCString(yytext).stripWhiteSpace(); + addType(yyscanner); + yyextra->current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"constants"{BN}+ { // UNO IDL constant group - lineCount(); - if (g_insideIDL) - { - g_isTypedef=FALSE; - g_current->section = Entry::NAMESPACE_SEC; - g_current->type = "constants"; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + if (yyextra->insideIDL) + { + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::NAMESPACE_SEC; + yyextra->current->type = "constants"; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } else { - addType(); - g_current->name = QCString(yytext).stripWhiteSpace(); + addType(yyscanner); + yyextra->current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*("service"){BN}+ { // UNO IDL service - lineCount(); - if (g_insideIDL) + lineCount(yyscanner); + if (yyextra->insideIDL) { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Service | + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Service | // preserve UNO IDL [optional] or published - (g_current->spec & (Entry::Optional|Entry::Published)); - addType(); - g_current->type += " service " ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->bodyLine = g_yyLineNr; + (yyextra->current->spec & (Entry::Optional|Entry::Published)); + addType(yyscanner); + yyextra->current->type += " service " ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted { - addType(); - g_current->name = QCString(yytext).stripWhiteSpace(); + addType(yyscanner); + yyextra->current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*("singleton"){BN}+ { // UNO IDL singleton - lineCount(); - if (g_insideIDL) - { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Singleton | - (g_current->spec & Entry::Published); // preserve - addType(); - g_current->type += " singleton " ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + if (yyextra->insideIDL) + { + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Singleton | + (yyextra->current->spec & Entry::Published); // preserve + addType(yyscanner); + yyextra->current->type += " singleton " ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted { - addType(); - g_current->name = QCString(yytext).stripWhiteSpace(); + addType(yyscanner); + yyextra->current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba/UNO IDL/Java/Slice interface - lineCount(); - if (g_insideIDL || g_insideJava || g_insideCS || g_insideD || g_insidePHP || g_insideSlice) + lineCount(yyscanner); + if (yyextra->insideIDL || yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideSlice) { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Interface | + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Interface | // preserve UNO IDL [optional], published, Slice local - (g_current->spec & (Entry::Optional|Entry::Published|Entry::Local)); - addType(); - g_current->type += " interface" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + (yyextra->current->spec & (Entry::Optional|Entry::Published|Entry::Local)); + addType(yyscanner); + yyextra->current->type += " interface" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } else { - addType(); - g_current->name = QCString(yytext).stripWhiteSpace(); + addType(yyscanner); + yyextra->current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"@implementation"{BN}+ { // Objective-C class implementation - lineCount(); - g_isTypedef=FALSE; - g_current->section = Entry::OBJCIMPL_SEC; - g_language = g_current->lang = SrcLangExt_ObjC; - g_insideObjC = TRUE; - g_current->protection = g_protection = Public ; - addType(); - g_current->type += " implementation" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::OBJCIMPL_SEC; + yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; + yyextra->insideObjC = TRUE; + yyextra->current->protection = yyextra->protection = Public ; + addType(yyscanner); + yyextra->current->type += " implementation" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } {B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute - lineCount(); - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Interface; - if (!g_insideJava) - { - g_language = g_current->lang = SrcLangExt_ObjC; - g_insideObjC = TRUE; - } - g_current->protection = g_protection = Public ; - addType(); - g_current->type += " interface" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Interface; + if (!yyextra->insideJava) + { + yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; + yyextra->insideObjC = TRUE; + } + yyextra->current->protection = yyextra->protection = Public ; + addType(yyscanner); + yyextra->current->type += " interface" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } {B}*"@protocol"{BN}+ { // Objective-C protocol definition - lineCount(); - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Protocol; - g_language = g_current->lang = SrcLangExt_ObjC; - g_insideObjC = TRUE; - g_current->protection = g_protection = Public ; - addType(); - g_current->type += " protocol" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + lineCount(yyscanner); + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Protocol; + yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; + yyextra->insideObjC = TRUE; + yyextra->current->protection = yyextra->protection = Public ; + addType(yyscanner); + yyextra->current->type += " protocol" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( CompoundName ); } {B}*"exception"{BN}+ { // Corba IDL/Slice exception - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; // preserve UNO IDL, Slice local - g_current->spec = Entry::Exception | - (g_current->spec & Entry::Published) | - (g_current->spec & Entry::Local); - addType(); - g_current->type += " exception" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount(); + yyextra->current->spec = Entry::Exception | + (yyextra->current->spec & Entry::Published) | + (yyextra->current->spec & Entry::Local); + addType(yyscanner); + yyextra->current->type += " exception" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner); BEGIN( CompoundName ); } "@class" | // for Objective C class declarations {B}*{TYPEDEFPREFIX}"class{" | {B}*{TYPEDEFPREFIX}"class"{BN}+ { QCString decl = yytext; - g_isTypedef=decl.find("typedef")!=-1; + yyextra->isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - g_current->section = Entry::CLASS_SEC; - addType(); - uint64 spec = g_current->spec; - if (g_insidePHP && g_current->spec&Entry::Abstract) + yyextra->current->section = Entry::CLASS_SEC; + addType(yyscanner); + uint64 spec = yyextra->current->spec; + if (yyextra->insidePHP && yyextra->current->spec&Entry::Abstract) { // convert Abstract to AbstractClass - g_current->spec=(g_current->spec&~Entry::Abstract)|Entry::AbstractClass; + yyextra->current->spec=(yyextra->current->spec&~Entry::Abstract)|Entry::AbstractClass; } - if (g_insideSlice && spec&Entry::Local) + if (yyextra->insideSlice && spec&Entry::Local) { - g_current->spec|=Entry::Local; + yyextra->current->spec|=Entry::Local; } if (isConst) { - g_current->type += " const"; + yyextra->current->type += " const"; } else if (isVolatile) { - g_current->type += " volatile"; + yyextra->current->type += " volatile"; } - g_current->type += " class" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; + yyextra->current->type += " class" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; if (yytext[0]=='@') { - g_language = g_current->lang = SrcLangExt_ObjC; - g_insideObjC = TRUE; + yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; + yyextra->insideObjC = TRUE; } - lineCount() ; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"value class{" | // C++/CLI extension {B}*"value class"{BN}+ { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Value; - addType(); - g_current->type += " value class" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Value; + addType(yyscanner); + yyextra->current->type += " value class" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"ref class{" | // C++/CLI extension {B}*"ref class"{BN}+ { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Ref; - addType(); - g_current->type += " ref class" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Ref; + addType(yyscanner); + yyextra->current->type += " ref class" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"interface class{" | // C++/CLI extension {B}*"interface class"{BN}+ { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Interface; - addType(); - g_current->type += " interface class" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Interface; + addType(yyscanner); + yyextra->current->type += " interface class" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"coclass"{BN}+ { - if (g_insideIDL) - { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - addType(); - g_current->type += " coclass" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + if (yyextra->insideIDL) + { + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + addType(yyscanner); + yyextra->current->type += " coclass" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; BEGIN( CompoundName ) ; } else { - addType(); - g_current->name = yytext; - g_current->name = g_current->name.stripWhiteSpace(); - lineCount(); + addType(yyscanner); + yyextra->current->name = yytext; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + lineCount(yyscanner); } } {B}*{TYPEDEFPREFIX}"struct{" | {B}*{TYPEDEFPREFIX}"struct"/{BN}+ { QCString decl = yytext; - g_isTypedef=decl.find("typedef")!=-1; + yyextra->isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - uint64 spec = g_current->spec; - g_current->section = Entry::CLASS_SEC ; + uint64 spec = yyextra->current->spec; + yyextra->current->section = Entry::CLASS_SEC ; // preserve UNO IDL & Inline attributes, Slice local - g_current->spec = Entry::Struct | - (g_current->spec & Entry::Published) | - (g_current->spec & Entry::Inline) | - (g_current->spec & Entry::Local); - // bug 582676: can be a struct nested in an interface so keep g_insideObjC state - //g_current->objc = g_insideObjC = FALSE; - addType(); + yyextra->current->spec = Entry::Struct | + (yyextra->current->spec & Entry::Published) | + (yyextra->current->spec & Entry::Inline) | + (yyextra->current->spec & Entry::Local); + // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state + //yyextra->current->objc = yyextra->insideObjC = FALSE; + addType(yyscanner); if (isConst) { - g_current->type += " const"; + yyextra->current->type += " const"; } else if (isVolatile) { - g_current->type += " volatile"; + yyextra->current->type += " volatile"; } - g_current->type += " struct" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->current->type += " struct" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"value struct{" | // C++/CLI extension {B}*"value struct"{BN}+ { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Struct | Entry::Value; - addType(); - g_current->type += " value struct" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Struct | Entry::Value; + addType(yyscanner); + yyextra->current->type += " value struct" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"ref struct{" | // C++/CLI extension {B}*"ref struct"{BN}+ { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Struct | Entry::Ref; - addType(); - g_current->type += " ref struct" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Struct | Entry::Ref; + addType(yyscanner); + yyextra->current->type += " ref struct" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"interface struct{" | // C++/CLI extension {B}*"interface struct"{BN}+ { - g_isTypedef=FALSE; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Struct | Entry::Interface; - addType(); - g_current->type += " interface struct"; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Struct | Entry::Interface; + addType(yyscanner); + yyextra->current->type += " interface struct"; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*{TYPEDEFPREFIX}"union{" | {B}*{TYPEDEFPREFIX}"union"{BN}+ { QCString decl=yytext; - g_isTypedef=decl.find("typedef")!=-1; + yyextra->isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Union; - // bug 582676: can be a struct nested in an interface so keep g_insideObjC state - //g_current->objc = g_insideObjC = FALSE; - addType(); + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Union; + // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state + //yyextra->current->objc = yyextra->insideObjC = FALSE; + addType(yyscanner); if (isConst) { - g_current->type += " const"; + yyextra->current->type += " const"; } else if (isVolatile) { - g_current->type += " volatile"; + yyextra->current->type += " volatile"; } - g_current->type += " union" ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->current->type += " union" ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" | {B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum QCString text=yytext; - g_isTypedef = text.find("typedef")!=-1; - bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || g_insideCS; - if (g_insideJava) + yyextra->isTypedef = text.find("typedef")!=-1; + bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || yyextra->insideCS; + if (yyextra->insideJava) { - g_current->section = Entry::CLASS_SEC; - g_current->spec = Entry::Enum; + yyextra->current->section = Entry::CLASS_SEC; + yyextra->current->spec = Entry::Enum; } else { - g_current->section = Entry::ENUM_SEC ; + yyextra->current->section = Entry::ENUM_SEC ; } - addType(); - g_current->type += " enum"; + addType(yyscanner); + yyextra->current->type += " enum"; if (isStrongEnum) { - g_current->spec |= Entry::Strong; + yyextra->current->spec |= Entry::Strong; } - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->bodyLine = g_yyLineNr; - lineCount() ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } "("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"(" { // A::operator()(int arg) - lineCount(); - g_current->name += "()"; + lineCount(yyscanner); + yyextra->current->name += "()"; BEGIN( FindMembers ); } "("{BN}*")"{BN}*/"(" { - lineCount(); - g_current->name += yytext ; - g_current->name = g_current->name.simplifyWhiteSpace(); + lineCount(yyscanner); + yyextra->current->name += yytext ; + yyextra->current->name = yyextra->current->name.simplifyWhiteSpace(); BEGIN( FindMembers ) ; } ";" { // can occur when importing members @@ -1871,85 +1571,85 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ) ; } [^(] { - lineCount(); - g_current->name += *yytext ; + lineCount(yyscanner); + yyextra->current->name += *yytext ; } "<>" { /* skip guided templ specifiers */ } "(" { - g_current->name = g_current->name.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.simplifyWhiteSpace(); unput(*yytext); BEGIN( FindMembers ) ; } ("template"|"generic")({BN}*)"<"/[>]? { // generic is a C++/CLI extension - lineCount(); + lineCount(yyscanner); ArgumentList al; - //g_current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template; - g_current->tArgLists.push_back(al); - g_currentArgumentList = &g_current->tArgLists.back(); - g_templateStr="<"; - g_fullArgString = g_templateStr; - g_copyArgString = &g_templateStr; - g_currentArgumentContext = FindMembers; + //yyextra->current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template; + yyextra->current->tArgLists.push_back(al); + yyextra->currentArgumentList = &yyextra->current->tArgLists.back(); + yyextra->templateStr="<"; + yyextra->fullArgString = yyextra->templateStr; + yyextra->copyArgString = &yyextra->templateStr; + yyextra->currentArgumentContext = FindMembers; BEGIN( ReadTempArgs ); } "namespace"{BN}+/{ID}{BN}*"=" { // namespace alias - lineCount(); + lineCount(yyscanner); BEGIN( NSAliasName ); } {ID} { - g_aliasName = yytext; + yyextra->aliasName = yytext; BEGIN( NSAliasArg ); } ({ID}"::")*{ID} { - //printf("Inserting namespace alias %s::%s->%s\n",g_current_root->name.data(),g_aliasName.data(),yytext); - //if (g_current_root->name.isEmpty()) + //printf("Inserting namespace alias %s::%s->%s\n",yyextra->current_root->name.data(),yyextra->aliasName.data(),yytext); + //if (yyextra->current_root->name.isEmpty()) //{ // TODO: namespace aliases are now treated as global entities // while they should be aware of the scope they are in - Doxygen::namespaceAliasDict.insert(g_aliasName,new QCString(yytext)); + Doxygen::namespaceAliasDict.insert(yyextra->aliasName,new QCString(yytext)); //} //else //{ - // Doxygen::namespaceAliasDict.insert(g_current_root->name+"::"+g_aliasName, - // new QCString(g_current_root->name+"::"+yytext)); + // Doxygen::namespaceAliasDict.insert(yyextra->current_root->name+"::"+yyextra->aliasName, + // new QCString(yyextra->current_root->name+"::"+yytext)); //} } ";" { BEGIN( FindMembers ); } ({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as" { - lineCount(); - g_aliasName=yytext; + lineCount(yyscanner); + yyextra->aliasName=yytext; BEGIN(PHPUseAs); } ({ID}{BN}*"\\"{BN}*)*{ID} { - lineCount(); - g_current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); - //printf("PHP: adding use relation: %s\n",g_current->name.data()); - g_current->fileName = g_yyFileName; + lineCount(yyscanner); + yyextra->current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); + //printf("PHP: adding use relation: %s\n",yyextra->current->name.data()); + yyextra->current->fileName = yyextra->yyFileName; // add a using declaration - g_current->section=Entry::USINGDECL_SEC; - g_current_root->copyToSubEntry(g_current); + yyextra->current->section=Entry::USINGDECL_SEC; + yyextra->current_root->copyToSubEntry(yyextra->current); // also add it as a using directive - g_current->section=Entry::USINGDIR_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); - g_aliasName.resize(0); + yyextra->current->section=Entry::USINGDIR_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); + yyextra->aliasName.resize(0); } {BN}+"as"{BN}+ { - lineCount(); + lineCount(yyscanner); } {PHPUSEKW} { } {ID} { - //printf("PHP: adding use as relation: %s->%s\n",yytext,g_aliasName.data()); - if (!g_aliasName.isEmpty()) + //printf("PHP: adding use as relation: %s->%s\n",yytext,yyextra->aliasName.data()); + if (!yyextra->aliasName.isEmpty()) { Doxygen::namespaceAliasDict.insert(yytext, new QCString(removeRedundantWhiteSpace( - substitute(g_aliasName,"\\","::")))); + substitute(yyextra->aliasName,"\\","::")))); } - g_aliasName.resize(0); + yyextra->aliasName.resize(0); } [,;] { if (*yytext==',') @@ -1962,62 +1662,62 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ({ID}{BN}*"."{BN}*)+"*" { // package import => add as a using directive - lineCount(); + lineCount(yyscanner); QCString scope=yytext; - g_current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); - g_current->fileName = g_yyFileName; - g_current->section=Entry::USINGDIR_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->section=Entry::USINGDIR_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(Using); } ({ID}{BN}*"."{BN}*)+{ID} { // class import => add as a using declaration - lineCount(); + lineCount(yyscanner); QCString scope=yytext; - g_current->name=removeRedundantWhiteSpace(substitute(scope,".","::")); - g_current->fileName = g_yyFileName; - if (g_insideD) + yyextra->current->name=removeRedundantWhiteSpace(substitute(scope,".","::")); + yyextra->current->fileName = yyextra->yyFileName; + if (yyextra->insideD) { - g_current->section=Entry::USINGDIR_SEC; + yyextra->current->section=Entry::USINGDIR_SEC; } else { - //printf("import name = %s -> %s\n",yytext,g_current->name.data()); - g_current->section=Entry::USINGDECL_SEC; + //printf("import name = %s -> %s\n",yytext,yyextra->current->name.data()); + yyextra->current->section=Entry::USINGDECL_SEC; } - g_previous = g_current.get(); - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->previous = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(Using); } "using"{BN}+ { - g_current->startLine=g_yyLineNr; - g_current->startColumn = g_yyColNr; - lineCount(); + yyextra->current->startLine=yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + lineCount(yyscanner); BEGIN(Using); } -"namespace"{BN}+ { lineCount(); BEGIN(UsingDirective); } +"namespace"{BN}+ { lineCount(yyscanner); BEGIN(UsingDirective); } ({ID}{BN}*("::"|"."){BN}*)*({ID}|{OPERATOR}) { - lineCount(); - g_current->name=yytext; - g_current->fileName = g_yyFileName; - g_current->section=Entry::USINGDECL_SEC; - g_current->startLine = g_yyLineNr; - g_previous = g_current.get(); - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); - if (g_insideCS) /* Hack: in C# a using declaration and + lineCount(yyscanner); + yyextra->current->name=yytext; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->section=Entry::USINGDECL_SEC; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->previous = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); + if (yyextra->insideCS) /* Hack: in C# a using declaration and directive have the same syntax, so we also add it as a using directive here */ { - g_current->name=yytext; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->section=Entry::USINGDIR_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->name=yytext; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->section=Entry::USINGDIR_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); } BEGIN(Using); } @@ -2025,119 +1725,119 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(UsingAlias); } ";" { - g_previous->section=Entry::VARIABLE_SEC; - g_previous->type = "typedef "+g_previous->args; - g_previous->type=g_previous->type.simplifyWhiteSpace(); - g_previous->args.resize(0); - g_previous->name=g_previous->name.stripWhiteSpace(); - g_previous->bodyLine = g_yyLineNr; - g_previous->spec |= Entry::Alias; + yyextra->previous->section=Entry::VARIABLE_SEC; + yyextra->previous->type = "typedef "+yyextra->previous->args; + yyextra->previous->type=yyextra->previous->type.simplifyWhiteSpace(); + yyextra->previous->args.resize(0); + yyextra->previous->name=yyextra->previous->name.stripWhiteSpace(); + yyextra->previous->bodyLine = yyextra->yyLineNr; + yyextra->previous->spec |= Entry::Alias; BEGIN(FindMembers); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { - g_docBlockContext = UsingAliasEnd; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = UsingAliasEnd; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; - lineCount(); + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; + lineCount(yyscanner); - g_docBlockTerm = ';'; + yyextra->docBlockTerm = ';'; if (yytext[yyleng-3]=='/') { - startCommentBlock(TRUE); + startCommentBlock(yyscanner,TRUE); BEGIN( DocLine ); } else { - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } } ">>" { - g_previous->args+="> >"; // see bug769552 + yyextra->previous->args+="> >"; // see bug769552 } . { - g_previous->args+=yytext; + yyextra->previous->args+=yytext; } \n { - g_previous->args+=yytext; - lineCount(); + yyextra->previous->args+=yytext; + lineCount(yyscanner); } ";" { - g_previous->doc = g_current->doc; - g_previous->brief = g_current->brief; - g_current->doc.resize(0); - g_current->brief.resize(0); + yyextra->previous->doc = yyextra->current->doc; + yyextra->previous->brief = yyextra->current->brief; + yyextra->current->doc.resize(0); + yyextra->current->brief.resize(0); unput(';'); BEGIN(UsingAlias); } -{SCOPENAME} { g_current->name=removeRedundantWhiteSpace(yytext); - g_current->fileName = g_yyFileName; - g_current->section=Entry::USINGDIR_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); +{SCOPENAME} { yyextra->current->name=removeRedundantWhiteSpace(yytext); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->section=Entry::USINGDIR_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(Using); } ";" { BEGIN(FindMembers); } {SCOPENAME}{BN}*"<>" { // guided template decl QCString n=yytext; - addType(); - g_current->name=n.left(n.length()-2); + addType(yyscanner); + yyextra->current->name=n.left(n.length()-2); } {SCOPENAME}{BN}*/"<" { // Note: this could be a return type! - g_roundCount=0; - g_sharpCount=0; - lineCount(); - addType(); - g_current->name=yytext; - g_current->name=g_current->name.stripWhiteSpace(); - //g_current->scopeSpec.resize(0); - // g_currentTemplateSpec = &g_current->scopeSpec; - if (nameIsOperator(g_current->name)) + yyextra->roundCount=0; + yyextra->sharpCount=0; + lineCount(yyscanner); + addType(yyscanner); + yyextra->current->name=yytext; + yyextra->current->name=yyextra->current->name.stripWhiteSpace(); + //yyextra->current->scopeSpec.resize(0); + // yyextra->currentTemplateSpec = &yyextra->current->scopeSpec; + if (nameIsOperator(yyextra->current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } {SCOPENAME}{BN}*/"<" { - g_sharpCount=0; - g_roundCount=0; - lineCount(); - g_current->name+=((QCString)yytext).stripWhiteSpace(); - //g_current->memberSpec.resize(0); - // g_currentTemplateSpec = &g_current->memberSpec; - if (nameIsOperator(g_current->name)) + yyextra->sharpCount=0; + yyextra->roundCount=0; + lineCount(yyscanner); + yyextra->current->name+=((QCString)yytext).stripWhiteSpace(); + //yyextra->current->memberSpec.resize(0); + // yyextra->currentTemplateSpec = &yyextra->current->memberSpec; + if (nameIsOperator(yyextra->current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } "<<<" { - if (!g_insidePHP) + if (!yyextra->insidePHP) { REJECT; } else { - g_lastHereDocContext = YY_START; + yyextra->lastHereDocContext = YY_START; BEGIN(HereDoc); } } "<<" { - g_current->name+=yytext; - // *g_currentTemplateSpec+=yytext; + yyextra->current->name+=yytext; + // *yyextra->currentTemplateSpec+=yytext; } "<" { - if (g_roundCount==0) + if (yyextra->roundCount==0) { - // *g_currentTemplateSpec+='<'; - g_sharpCount++; + // *yyextra->currentTemplateSpec+='<'; + yyextra->sharpCount++; } - g_current->name+=yytext; + yyextra->current->name+=yytext; } ">>" { - if (g_insideJava || g_insideCS || g_insideCli || g_roundCount==0) + if (yyextra->insideJava || yyextra->insideCS || yyextra->insideCli || yyextra->roundCount==0) { unput('>'); unput(' '); @@ -2145,117 +1845,117 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - g_current->name+=yytext; + yyextra->current->name+=yytext; } - // *g_currentTemplateSpec+=yytext; + // *yyextra->currentTemplateSpec+=yytext; } ">" { - g_current->name+='>'; - // *g_currentTemplateSpec+='>'; - if (g_roundCount==0 && --g_sharpCount<=0) + yyextra->current->name+='>'; + // *yyextra->currentTemplateSpec+='>'; + if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) { - //printf("Found %s\n",g_current->name.data()); + //printf("Found %s\n",yyextra->current->name.data()); BEGIN(FindMembers); } } ">"{BN}*"(" { - lineCount(); - g_current->name+='>'; - // *g_currentTemplateSpec+='>'; - if (g_roundCount==0 && --g_sharpCount<=0) - { - g_current->bodyLine = g_yyLineNr; - g_current->args = "("; - g_currentArgumentContext = FuncQual; - g_fullArgString = g_current->args.copy(); - g_copyArgString = &g_current->args; - //printf("Found %s\n",g_current->name.data()); + lineCount(yyscanner); + yyextra->current->name+='>'; + // *yyextra->currentTemplateSpec+='>'; + if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) + { + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->args = "("; + yyextra->currentArgumentContext = FuncQual; + yyextra->fullArgString = yyextra->current->args.copy(); + yyextra->copyArgString = &yyextra->current->args; + //printf("Found %s\n",yyextra->current->name.data()); BEGIN( ReadFuncArgType ) ; } } ">"{BN}*/"("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance - lineCount(); - g_current->name+='>'; - if (g_roundCount==0) + lineCount(yyscanner); + yyextra->current->name+='>'; + if (yyextra->roundCount==0) { BEGIN(FindMembers); } } ">"{BN}*/"::" { - lineCount(); - g_current->name+='>'; - // *g_currentTemplateSpec+='>'; - if (g_roundCount==0 && --g_sharpCount<=0) + lineCount(yyscanner); + yyextra->current->name+='>'; + // *yyextra->currentTemplateSpec+='>'; + if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) { BEGIN(FindMemberName); } } -"(" { g_current->name+=*yytext; - g_roundCount++; +"(" { yyextra->current->name+=*yytext; + yyextra->roundCount++; } -")" { g_current->name+=*yytext; - if (g_roundCount>0) g_roundCount--; +")" { yyextra->current->name+=*yytext; + if (yyextra->roundCount>0) yyextra->roundCount--; } . { - g_current->name+=*yytext; - // *g_currentTemplateSpec+=*yytext; + yyextra->current->name+=*yytext; + // *yyextra->currentTemplateSpec+=*yytext; } "define"{BN}*"("{BN}*["'] { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_current->bodyLine = g_yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( DefinePHP ); } else REJECT; } {ID} { // PHP heredoc - g_delimiter = yytext; - *g_pCopyHereDocGString += yytext; + yyextra->delimiter = yytext; + *yyextra->pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } "'"{ID}/"'" { // PHP nowdoc - g_delimiter = &yytext[1]; - *g_pCopyHereDocGString += yytext; + yyextra->delimiter = &yytext[1]; + *yyextra->pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } {ID} { // PHP heredoc - g_delimiter = yytext; + yyextra->delimiter = yytext; BEGIN(HereDocEnd); } "'"{ID}/"'" { // PHP nowdoc - g_delimiter = &yytext[1]; + yyextra->delimiter = &yytext[1]; BEGIN(HereDocEnd); } ^{ID} { // id at start of the line could mark the end of the block - if (g_delimiter==yytext) // it is the end marker + if (yyextra->delimiter==yytext) // it is the end marker { - BEGIN(g_lastHereDocContext); + BEGIN(yyextra->lastHereDocContext); } } . { } ^{ID} { // id at start of the line could mark the end of the block - *g_pCopyHereDocGString += yytext; - if (g_delimiter==yytext) // it is the end marker + *yyextra->pCopyHereDocGString += yytext; + if (yyextra->delimiter==yytext) // it is the end marker { - BEGIN(g_lastHereDocContext); + BEGIN(yyextra->lastHereDocContext); } } \n { - *g_pCopyHereDocGString += yytext; + *yyextra->pCopyHereDocGString += yytext; } {ID} { - *g_pCopyHereDocGString += yytext; + *yyextra->pCopyHereDocGString += yytext; } . { - *g_pCopyHereDocGString += yytext; + *yyextra->pCopyHereDocGString += yytext; } "Q_OBJECT" { // Qt object macro } "Q_PROPERTY" { // Qt property declaration - g_current->protection = Public ; // see bug734245 & bug735462 - g_current->mtype = g_mtype = Property; - g_current->type.resize(0); + yyextra->current->protection = Public ; // see bug734245 & bug735462 + yyextra->current->mtype = yyextra->mtype = Property; + yyextra->current->type.resize(0); BEGIN(QtPropType); } "(" { // start of property arguments @@ -2265,25 +1965,25 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "const"|"volatile"|"unsigned"|"signed"|"long"|"short" { - g_current->type+=yytext; + yyextra->current->type+=yytext; } {B}+ { - g_current->type+=yytext; + yyextra->current->type+=yytext; } ({TSCOPE}"::")*{TSCOPE} { - g_current->type+=yytext; + yyextra->current->type+=yytext; BEGIN(QtPropName); } {ID} { - g_current->name=yytext; + yyextra->current->name=yytext; BEGIN(QtPropAttr); } "READ" { - g_current->spec |= Entry::Readable; + yyextra->current->spec |= Entry::Readable; BEGIN(QtPropRead); } "WRITE" { - g_current->spec |= Entry::Writable; + yyextra->current->spec |= Entry::Writable; BEGIN(QtPropWrite); } "RESET"{B}+{ID} { // reset method => not supported yet @@ -2293,163 +1993,163 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "DESIGNABLE"{B}+{ID} { // designable property => not supported yet } {ID} { - g_current->read = yytext; + yyextra->current->read = yytext; BEGIN(QtPropAttr); } {ID} { - g_current->write = yytext; + yyextra->current->write = yytext; BEGIN(QtPropAttr); } "friend"{BN}+("class"|"union"|"struct"){BN}+ { - g_current->name=yytext; + yyextra->current->name=yytext; BEGIN(FindMembers); } {SCOPENAME} { - if (g_insideCpp || g_insideObjC) + if (yyextra->insideCpp || yyextra->insideObjC) { - g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); + yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext); } - g_yyBegColNr=g_yyColNr; - g_yyBegLineNr=g_yyLineNr; - lineCount(); - if (g_insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0) + yyextra->yyBegColNr=yyextra->yyColNr; + yyextra->yyBegLineNr=yyextra->yyLineNr; + lineCount(yyscanner); + if (yyextra->insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0) { BEGIN(CppQuote); } - else if ((g_insideIDL || g_insideJava || g_insideD) && yyleng==6 && qstrcmp(yytext,"import")==0) + else if ((yyextra->insideIDL || yyextra->insideJava || yyextra->insideD) && yyleng==6 && qstrcmp(yytext,"import")==0) { - if (g_insideIDL) + if (yyextra->insideIDL) BEGIN(NextSemi); - else // g_insideJava or g_insideD + else // yyextra->insideJava or yyextra->insideD BEGIN(JavaImport); } - else if (g_insidePHP && qstrcmp(yytext,"use")==0) + else if (yyextra->insidePHP && qstrcmp(yytext,"use")==0) { BEGIN(PHPUse); } - else if (g_insideJava && qstrcmp(yytext,"package")==0) + else if (yyextra->insideJava && qstrcmp(yytext,"package")==0) { - lineCount(); + lineCount(yyscanner); BEGIN(PackageName); } - else if (g_insideIDL && qstrcmp(yytext,"case")==0) + else if (yyextra->insideIDL && qstrcmp(yytext,"case")==0) { BEGIN(IDLUnionCase); } - else if (g_insideTryBlock && qstrcmp(yytext,"catch")==0) + else if (yyextra->insideTryBlock && qstrcmp(yytext,"catch")==0) { - g_insideTryBlock=FALSE; + yyextra->insideTryBlock=FALSE; BEGIN(TryFunctionBlock); } - else if (g_insideCpp && qstrcmp(yytext,"alignas")==0) + else if (yyextra->insideCpp && qstrcmp(yytext,"alignas")==0) { - g_lastAlignAsContext = YY_START; + yyextra->lastAlignAsContext = YY_START; BEGIN(AlignAs); } - else if (g_insideJS && qstrcmp(yytext,"var")==0) + else if (yyextra->insideJS && qstrcmp(yytext,"var")==0) { // javascript variable - g_current->type="var"; + yyextra->current->type="var"; } - else if (g_insideJS && qstrcmp(yytext,"function")==0) + else if (yyextra->insideJS && qstrcmp(yytext,"function")==0) { // javascript function - g_current->type="function"; + yyextra->current->type="function"; } - else if (g_insideCS && qstrcmp(yytext,"this")==0) + else if (yyextra->insideCS && qstrcmp(yytext,"this")==0) { // C# indexer - addType(); - g_current->name="this"; + addType(yyscanner); + yyextra->current->name="this"; BEGIN(CSIndexer); } - else if (g_insideCpp && qstrcmp(yytext,"static_assert")==0) + else if (yyextra->insideCpp && qstrcmp(yytext,"static_assert")==0) { // C++11 static_assert BEGIN(StaticAssert); } - else if (g_insideCpp && qstrcmp(yytext,"decltype")==0) + else if (yyextra->insideCpp && qstrcmp(yytext,"decltype")==0) { // C++11 decltype(x) - g_current->type+=yytext; + yyextra->current->type+=yytext; BEGIN(DeclType); } - else if (g_insideSlice && qstrcmp(yytext,"optional")==0) + else if (yyextra->insideSlice && qstrcmp(yytext,"optional")==0) { - if (g_current->type.isEmpty()) + if (yyextra->current->type.isEmpty()) { - g_current->type = "optional"; + yyextra->current->type = "optional"; } else { - g_current->type += " optional"; + yyextra->current->type += " optional"; } - g_lastModifierContext = YY_START; + yyextra->lastModifierContext = YY_START; BEGIN(SliceOptional); } else { if (YY_START==FindMembers) { - addType(); + addType(yyscanner); } - bool javaLike = g_insideJava || g_insideCS || g_insideD || g_insidePHP || g_insideJS; + bool javaLike = yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS; if (javaLike && qstrcmp(yytext,"public")==0) { - g_current->protection = Public; + yyextra->current->protection = Public; } else if (javaLike && qstrcmp(yytext,"protected")==0) { - g_current->protection = Protected; + yyextra->current->protection = Protected; } - else if ((g_insideCS || g_insideD || g_insidePHP || g_insideJS) && qstrcmp(yytext,"internal")==0) + else if ((yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS) && qstrcmp(yytext,"internal")==0) { - g_current->protection = Package; + yyextra->current->protection = Package; } else if (javaLike && qstrcmp(yytext,"private")==0) { - g_current->protection = Private; + yyextra->current->protection = Private; } else if (javaLike && qstrcmp(yytext,"static")==0) { if (YY_START==FindMembers) - g_current->name = yytext; + yyextra->current->name = yytext; else - g_current->name += yytext; - g_current->stat = TRUE; + yyextra->current->name += yytext; + yyextra->current->stat = TRUE; } else { if (YY_START==FindMembers) - g_current->name = yytext; + yyextra->current->name = yytext; else - g_current->name += yytext; - if (g_current->name.left(7)=="static ") + yyextra->current->name += yytext; + if (yyextra->current->name.left(7)=="static ") { - g_current->stat = TRUE; - g_current->name= g_current->name.mid(7); + yyextra->current->stat = TRUE; + yyextra->current->name= yyextra->current->name.mid(7); } - else if (g_current->name.left(7)=="inline ") + else if (yyextra->current->name.left(7)=="inline ") { - if (g_current->type.isEmpty()) + if (yyextra->current->type.isEmpty()) { - g_current->type="inline"; + yyextra->current->type="inline"; } else { - g_current->type+="inline "; + yyextra->current->type+="inline "; } - g_current->name= g_current->name.mid(7); + yyextra->current->name= yyextra->current->name.mid(7); } - else if (g_current->name.left(6)=="const ") + else if (yyextra->current->name.left(6)=="const ") { - if (g_current->type.isEmpty()) + if (yyextra->current->type.isEmpty()) { - g_current->type="const"; + yyextra->current->type="const"; } else { - g_current->type+="const "; + yyextra->current->type+="const "; } - g_current->name=g_current->name.mid(6); + yyextra->current->name=yyextra->current->name.mid(6); } } QCString tmp=yytext; @@ -2459,64 +2159,64 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - g_externC=FALSE; // see bug759247 + yyextra->externC=FALSE; // see bug759247 BEGIN(FindMembers); } } } "(" { - g_lastSkipRoundContext = FindMembers; - g_roundCount=0; + yyextra->lastSkipRoundContext = FindMembers; + yyextra->roundCount=0; BEGIN(SkipRound); } -{BN}+ { lineCount(); } +{BN}+ { lineCount(yyscanner); } . { // variable with static_assert as name? unput(*yytext); BEGIN(FindMembers); } "(" { - g_current->type+=yytext; - g_lastRoundContext=FindMembers; - g_pCopyRoundString=&g_current->type; - g_roundCount=0; + yyextra->current->type+=yytext; + yyextra->lastRoundContext=FindMembers; + yyextra->pCopyRoundString=&yyextra->current->type; + yyextra->roundCount=0; BEGIN(CopyRound); } -{BN}+ { lineCount(); } +{BN}+ { lineCount(yyscanner); } . { unput(*yytext); BEGIN(FindMembers); } "["[^\n\]]*"]" { - g_current->name+=removeRedundantWhiteSpace(yytext); + yyextra->current->name+=removeRedundantWhiteSpace(yytext); BEGIN(FindMembers); } [0-9]{ID} { // some number where we did not expect one } "." { - if (g_insideJava || g_insideCS || g_insideD) + if (yyextra->insideJava || yyextra->insideCS || yyextra->insideD) { - g_current->name+="."; + yyextra->current->name+="."; } } "::" { - g_current->name+=yytext; + yyextra->current->name+=yytext; } "("{B}*"\"" { - g_insideCppQuote=TRUE; + yyextra->insideCppQuote=TRUE; BEGIN(FindMembers); } "::" ":" { BEGIN(FindMembers); } -\n { lineCount(); } +\n { lineCount(yyscanner); } . -\n { lineCount(); } +\n { lineCount(yyscanner); } "{" { - g_curlyCount=0; - g_lastCurlyContext = TryFunctionBlockEnd ; + yyextra->curlyCount=0; + yyextra->lastCurlyContext = TryFunctionBlockEnd ; BEGIN( SkipCurly ); } . -{BN}*"catch" { lineCount(); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193 +{BN}*"catch" { lineCount(yyscanner); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193 } \n { unput(*yytext); // rule added to fix bug id 601138 BEGIN( FindMembers ); @@ -2525,159 +2225,159 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } ")" { - g_insideCppQuote=FALSE; + yyextra->insideCppQuote=FALSE; BEGIN(FindMembers); } -{B}*"#" { if (g_insidePHP) +{B}*"#" { if (yyextra->insidePHP) REJECT; - g_lastCPPContext = YY_START; + yyextra->lastCPPContext = YY_START; BEGIN( SkipCPP ) ; } {B}*"#"{B}*("cmake")?"define" { - if (g_insidePHP) + if (yyextra->insidePHP) REJECT; - g_current->bodyLine = g_yyLineNr; - g_lastDefineContext = YY_START; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->lastDefineContext = YY_START; BEGIN( Define ); } {B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */ - g_yyLineNr = atoi(&yytext[1]); - //printf("setting line number to %d\n",g_yyLineNr); - g_lastPreLineCtrlContext = YY_START; + yyextra->yyLineNr = atoi(&yytext[1]); + //printf("setting line number to %d\n",yyextra->yyLineNr); + yyextra->lastPreLineCtrlContext = YY_START; if (YY_START==ReadBody || YY_START==ReadNSBody || YY_START==ReadBodyIntf) { - g_current->program+=yytext; + yyextra->current->program+=yytext; } BEGIN( PreLineCtrl ); } "\""[^\n\"]*"\"" { - g_yyFileName = stripQuotes(yytext); - if (g_lastPreLineCtrlContext==ReadBody || - g_lastPreLineCtrlContext==ReadNSBody || - g_lastPreLineCtrlContext==ReadBodyIntf) + yyextra->yyFileName = stripQuotes(yytext); + if (yyextra->lastPreLineCtrlContext==ReadBody || + yyextra->lastPreLineCtrlContext==ReadNSBody || + yyextra->lastPreLineCtrlContext==ReadBodyIntf) { - g_current->program+=yytext; + yyextra->current->program+=yytext; } } . { - if (g_lastPreLineCtrlContext==ReadBody || - g_lastPreLineCtrlContext==ReadNSBody || - g_lastPreLineCtrlContext==ReadBodyIntf) + if (yyextra->lastPreLineCtrlContext==ReadBody || + yyextra->lastPreLineCtrlContext==ReadNSBody || + yyextra->lastPreLineCtrlContext==ReadBodyIntf) { - g_current->program+=yytext; + yyextra->current->program+=yytext; } } \n { - if (g_lastPreLineCtrlContext==ReadBody || - g_lastPreLineCtrlContext==ReadNSBody || - g_lastPreLineCtrlContext==ReadBodyIntf) + if (yyextra->lastPreLineCtrlContext==ReadBody || + yyextra->lastPreLineCtrlContext==ReadNSBody || + yyextra->lastPreLineCtrlContext==ReadBodyIntf) { - g_current->program+=yytext; + yyextra->current->program+=yytext; } - lineCount(); - BEGIN( g_lastPreLineCtrlContext ); + lineCount(yyscanner); + BEGIN( yyextra->lastPreLineCtrlContext ); } . -\\[\r]*"\n"[\r]* { lineCount(); } -[\r]*\n[\r]* { lineCount(); - BEGIN( g_lastCPPContext) ; +\\[\r]*"\n"[\r]* { lineCount(yyscanner); } +[\r]*\n[\r]* { lineCount(yyscanner); + BEGIN( yyextra->lastCPPContext) ; } {ID}{B}*"(" { - g_current->name = yytext; - g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); - g_current->args = "("; - g_current->bodyLine = g_yyLineNr; - g_currentArgumentContext = DefineEnd; - g_fullArgString=g_current->args.copy(); - g_copyArgString=&g_current->args; + yyextra->current->name = yytext; + yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); + yyextra->current->args = "("; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->currentArgumentContext = DefineEnd; + yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; } /* ")" { //printf("Define with args\n"); - g_current->args += ')'; + yyextra->current->args += ')'; BEGIN( DefineEnd ); } . { - g_current->args += *yytext; + yyextra->current->args += *yytext; } */ {ID} { //printf("Define '%s' without args\n",yytext); - if (g_insideCpp || g_insideObjC) + if (yyextra->insideCpp || yyextra->insideObjC) { - g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); + yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext); } - g_current->bodyLine = g_yyLineNr; - g_current->name = yytext; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->name = yytext; BEGIN(DefineEnd); } \n { - //printf("End define: doc=%s docFile=%s docLine=%d\n",g_current->doc.data(),g_current->docFile.data(),g_current->docLine); - lineCount(); - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->type.resize(0); - g_current->args = g_current->args.simplifyWhiteSpace(); - g_current->name = g_current->name.stripWhiteSpace(); - g_current->section = Entry::DEFINE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); - BEGIN(g_lastDefineContext); + //printf("End define: doc=%s docFile=%s docLine=%d\n",yyextra->current->doc.data(),yyextra->current->docFile.data(),yyextra->current->docLine); + lineCount(yyscanner); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->type.resize(0); + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->section = Entry::DEFINE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); + BEGIN(yyextra->lastDefineContext); } ";" { //printf("End define\n"); - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->type.resize(0); - g_current->type = "const"; - QCString init = g_current->initializer.data(); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->type.resize(0); + yyextra->current->type = "const"; + QCString init = yyextra->current->initializer.data(); init = init.simplifyWhiteSpace(); init = init.left(init.length()-1); - g_current->initializer = init; - g_current->name = g_current->name.stripWhiteSpace(); - g_current->section = Entry::VARIABLE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->initializer = init; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->section = Entry::VARIABLE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(FindMembers); } . \\[\r]?\n { - lineCount(); + lineCount(yyscanner); } \" { - if (g_insideIDL && g_insideCppQuote) + if (yyextra->insideIDL && yyextra->insideCppQuote) { BEGIN(EndCppQuote); } else { - g_lastStringContext=DefineEnd; + yyextra->lastStringContext=DefineEnd; BEGIN(SkipString); } } . {ID}["']{BN}*","{BN}* { - g_current->name = yytext; - g_current->name = g_current->name.stripWhiteSpace(); - g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); - g_current->name = g_current->name.left(g_current->name.length()-1); - g_current->bodyLine = g_yyLineNr; - g_lastRoundContext = DefinePHPEnd; - g_pCopyRoundGString = &g_current->initializer; - g_roundCount = 0; + yyextra->current->name = yytext; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); + yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1); + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->lastRoundContext = DefinePHPEnd; + yyextra->pCopyRoundGString = &yyextra->current->initializer; + yyextra->roundCount = 0; BEGIN( GCopyRound ); } [\^%] { // ^ and % are C++/CLI extensions - if (g_insideCli) + if (yyextra->insideCli) { - addType(); - g_current->name = yytext ; + addType(yyscanner); + yyextra->current->name = yytext ; } else { @@ -2685,128 +2385,128 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } [*&]+ { - g_current->name += yytext ; - addType(); + yyextra->current->name += yytext ; + addType(yyscanner); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { - if (g_current->bodyLine==-1) + if (yyextra->current->bodyLine==-1) { - g_current->bodyLine=g_yyLineNr; + yyextra->current->bodyLine=yyextra->yyLineNr; } - g_docBlockContext = YY_START; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; - //printf("indent=%d\n",computeIndent(yytext+1,g_column)); - lineCount(); + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; + //printf("indent=%d\n",computeIndent(yytext+1,yyextra->column)); + lineCount(yyscanner); - g_docBlockTerm = ';'; - if (YY_START==EnumBaseType && g_current->section==Entry::ENUM_SEC) + yyextra->docBlockTerm = ';'; + if (YY_START==EnumBaseType && yyextra->current->section==Entry::ENUM_SEC) { - g_current->bitfields = ":"+g_current->args; - g_current->args.resize(0); - g_current->section=Entry::VARIABLE_SEC; + yyextra->current->bitfields = ":"+yyextra->current->args; + yyextra->current->args.resize(0); + yyextra->current->section=Entry::VARIABLE_SEC; } if (yytext[yyleng-3]=='/') { - startCommentBlock(TRUE); + startCommentBlock(yyscanner,TRUE); BEGIN( DocLine ); } else { - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } } ","{BN}*("/**"|"//!"|"/*!"|"///")"<" { - g_docBlockContext = YY_START; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; - lineCount(); + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; + lineCount(yyscanner); - g_docBlockTerm = ','; - if (YY_START==EnumBaseType && g_current->section==Entry::ENUM_SEC) + yyextra->docBlockTerm = ','; + if (YY_START==EnumBaseType && yyextra->current->section==Entry::ENUM_SEC) { - g_current->bitfields = ":"+g_current->args; - g_current->args.resize(0); - g_current->section=Entry::VARIABLE_SEC; + yyextra->current->bitfields = ":"+yyextra->current->args; + yyextra->current->args.resize(0); + yyextra->current->section=Entry::VARIABLE_SEC; } if (yytext[yyleng-3]=='/') { - startCommentBlock(TRUE); + startCommentBlock(yyscanner,TRUE); BEGIN( DocLine ); } else { - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } } {BN}*("/**"|"//!"|"/*!"|"///")"<" { - if (g_current->bodyLine==-1) + if (yyextra->current->bodyLine==-1) { - g_current->bodyLine=g_yyLineNr; + yyextra->current->bodyLine=yyextra->yyLineNr; } - g_docBlockContext = YY_START; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; - lineCount(); + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; + lineCount(yyscanner); - g_docBlockTerm = 0; + yyextra->docBlockTerm = 0; if (yytext[yyleng-3]=='/') { - startCommentBlock(TRUE); + startCommentBlock(yyscanner,TRUE); BEGIN( DocLine ); } else { - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } } ("//"([!/]){B}*{CMD}"{")|("/*"([!*]){B}*{CMD}"{") { - //handleGroupStartCommand(g_current->name); - if (g_previous && g_previous->section==Entry::GROUPDOC_SEC) + //handleGroupStartCommand(yyextra->current->name); + if (yyextra->previous && yyextra->previous->section==Entry::GROUPDOC_SEC) { - // link open command to the group defined in the g_previous entry - Doxygen::docGroup.open(g_previous,g_yyFileName,g_yyLineNr); + // link open command to the group defined in the yyextra->previous entry + Doxygen::docGroup.open(yyextra->previous,yyextra->yyFileName,yyextra->yyLineNr); } else { - // link open command to the g_current entry - Doxygen::docGroup.open(g_current.get(),g_yyFileName,g_yyLineNr); + // link open command to the yyextra->current entry + Doxygen::docGroup.open(yyextra->current.get(),yyextra->yyFileName,yyextra->yyLineNr); } - //g_current = tmp; - initEntry(); + //yyextra->current = tmp; + initEntry(yyscanner); if (yytext[1]=='/') { if (yytext[2]=='!' || yytext[2]=='/') { - g_docBlockContext = YY_START; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = FALSE; - g_docBlock.resize(0); - g_docBlockTerm = 0; - startCommentBlock(TRUE); + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = FALSE; + yyextra->docBlock.resize(0); + yyextra->docBlockTerm = 0; + startCommentBlock(yyscanner,TRUE); BEGIN(DocLine); } else { - g_lastCContext=YY_START; + yyextra->lastCContext=YY_START; BEGIN(SkipCxxComment); } } @@ -2814,498 +2514,498 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { if (yytext[2]=='!' || yytext[2]=='*') { - g_docBlockContext = YY_START; - g_docBlockInBody = FALSE; - g_docBlock.resize(0); - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = FALSE; + yyextra->docBlock.resize(0); + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); - g_docBlockTerm = 0; - startCommentBlock(FALSE); + yyextra->docBlockTerm = 0; + startCommentBlock(yyscanner,FALSE); BEGIN(DocBlock); } else { - g_lastCContext=YY_START; + yyextra->lastCContext=YY_START; BEGIN(SkipComment); } } } "//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" { - bool g_insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && g_lastInitializerContext==FindFields); // see bug746226 - Doxygen::docGroup.close(g_current.get(),g_yyFileName,g_yyLineNr,g_insideEnum); - lineCount(); + bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && yyextra->lastInitializerContext==FindFields); // see bug746226 + Doxygen::docGroup.close(yyextra->current.get(),yyextra->yyFileName,yyextra->yyLineNr,insideEnum); + lineCount(yyscanner); } "=" { // in PHP code this could also be due to "bodyLine = g_yyLineNr; - g_current->initializer = yytext; - g_lastInitializerContext = YY_START; - g_initBracketCount=0; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->initializer = yytext; + yyextra->lastInitializerContext = YY_START; + yyextra->initBracketCount=0; BEGIN(ReadInitializer); } {BN}*[gs]"et"{BN}+"raises"{BN}*"("{BN}*{SCOPENAME}{BN}*(","{BN}*{SCOPENAME}{BN}*)*")"{BN}*";" { - lineCount(); - g_current->exception += " "; - g_current->exception += removeRedundantWhiteSpace(yytext); + lineCount(yyscanner); + yyextra->current->exception += " "; + yyextra->current->exception += removeRedundantWhiteSpace(yytext); } "}" { - g_current->exception += " }"; + yyextra->current->exception += " }"; BEGIN(FindMembers); } /* Read initializer rules */ "(" { - g_lastRoundContext=YY_START; - g_pCopyRoundGString=&g_current->initializer; - g_roundCount=0; - g_current->initializer+=*yytext; + yyextra->lastRoundContext=YY_START; + yyextra->pCopyRoundGString=&yyextra->current->initializer; + yyextra->roundCount=0; + yyextra->current->initializer+=*yytext; BEGIN(GCopyRound); } "[" { - if (!g_insidePHP) REJECT; - g_lastSquareContext=YY_START; - g_pCopySquareGString=&g_current->initializer; - g_squareCount=0; - g_current->initializer+=*yytext; + if (!yyextra->insidePHP) REJECT; + yyextra->lastSquareContext=YY_START; + yyextra->pCopySquareGString=&yyextra->current->initializer; + yyextra->squareCount=0; + yyextra->current->initializer+=*yytext; BEGIN(GCopySquare); } "{" { - g_lastCurlyContext=YY_START; - g_pCopyCurlyGString=&g_current->initializer; - g_curlyCount=0; - g_current->initializer+=*yytext; + yyextra->lastCurlyContext=YY_START; + yyextra->pCopyCurlyGString=&yyextra->current->initializer; + yyextra->curlyCount=0; + yyextra->current->initializer+=*yytext; BEGIN(GCopyCurly); } [;,] { - //printf(">> initializer '%s' <<\n",g_current->initializer.data()); - if (*yytext==';' && (g_current_root->spec&Entry::Enum)) - { - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - g_current->args = g_current->args.simplifyWhiteSpace(); - g_current->name = g_current->name.stripWhiteSpace(); - g_current->section = Entry::VARIABLE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + //printf(">> initializer '%s' <<\n",yyextra->current->initializer.data()); + if (*yytext==';' && (yyextra->current_root->spec&Entry::Enum)) + { + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->section = Entry::VARIABLE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(FindMembers); } - else if (*yytext==';' || (g_lastInitializerContext==FindFields && g_initBracketCount==0)) // g_initBracketCount==0 was added for bug 665778 + else if (*yytext==';' || (yyextra->lastInitializerContext==FindFields && yyextra->initBracketCount==0)) // yyextra->initBracketCount==0 was added for bug 665778 { unput(*yytext); - BEGIN(g_lastInitializerContext); + BEGIN(yyextra->lastInitializerContext); } - else if (*yytext==',' && g_initBracketCount==0) // for "int a=0,b=0" + else if (*yytext==',' && yyextra->initBracketCount==0) // for "int a=0,b=0" { unput(*yytext); - BEGIN(g_lastInitializerContext); + BEGIN(yyextra->lastInitializerContext); } else { - g_current->initializer+=*yytext; + yyextra->current->initializer+=*yytext; } } {RAWBEGIN} { // C++11 raw string - if (!g_insideCpp) + if (!yyextra->insideCpp) { REJECT; } else { QCString text=yytext; - g_current->initializer+=text; + yyextra->current->initializer+=text; int i=text.find('"'); - g_delimiter = yytext+i+1; - g_delimiter=g_delimiter.left(g_delimiter.length()-1); - g_lastRawStringContext = YY_START; - g_pCopyRawGString = &g_current->initializer; + yyextra->delimiter = yytext+i+1; + yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); + yyextra->lastRawStringContext = YY_START; + yyextra->pCopyRawGString = &yyextra->current->initializer; BEGIN(RawGString); //printf("RawGString delimiter='%s'\n",delimiter.data()); } } {RAWEND} { - *g_pCopyRawGString+=yytext; + *yyextra->pCopyRawGString+=yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); - if (delimiter==g_delimiter) + if (delimiter==yyextra->delimiter) { - BEGIN(g_lastRawStringContext); + BEGIN(yyextra->lastRawStringContext); } } [^)\n]+ { - *g_pCopyRawGString+=yytext; + *yyextra->pCopyRawGString+=yytext; } . { - *g_pCopyRawGString+=yytext; + *yyextra->pCopyRawGString+=yytext; } \n { - *g_pCopyRawGString+=yytext; - lineCount(); + *yyextra->pCopyRawGString+=yytext; + lineCount(yyscanner); } {RAWEND} { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); - if (delimiter==g_delimiter) + if (delimiter==yyextra->delimiter) { - BEGIN(g_lastRawStringContext); + BEGIN(yyextra->lastRawStringContext); } } [^)]+ { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; } . { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; } \n { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; - lineCount(); + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; + lineCount(yyscanner); } \" { - if (g_insideIDL && g_insideCppQuote) + if (yyextra->insideIDL && yyextra->insideCppQuote) { BEGIN(EndCppQuote); } else { - g_lastStringContext=YY_START; - g_current->initializer+=yytext; - g_pCopyQuotedGString=&g_current->initializer; + yyextra->lastStringContext=YY_START; + yyextra->current->initializer+=yytext; + yyextra->pCopyQuotedGString=&yyextra->current->initializer; BEGIN(CopyGString); } } "->" { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } "<<" { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } ">>" { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } [<\[{(] { - g_initBracketCount++; - g_current->initializer+=*yytext; + yyextra->initBracketCount++; + yyextra->current->initializer+=*yytext; } [>\]})] { - g_initBracketCount--; - g_current->initializer+=*yytext; + yyextra->initBracketCount--; + yyextra->current->initializer+=*yytext; } \' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_current->initializer+=yytext; - g_pCopyQuotedGString = &g_current->initializer; - g_lastStringContext=YY_START; + yyextra->current->initializer+=yytext; + yyextra->pCopyQuotedGString = &yyextra->current->initializer; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } } \n { - g_current->initializer+=*yytext; - lineCount(); + yyextra->current->initializer+=*yytext; + lineCount(yyscanner); } "@\"" { - //printf("g_insideCS=%d\n",g_insideCS); - g_current->initializer+=yytext; - if (!g_insideCS && !g_insideObjC) + //printf("yyextra->insideCS=%d\n",yyextra->insideCS); + yyextra->current->initializer+=yytext; + if (!yyextra->insideCS && !yyextra->insideObjC) { REJECT; } else { // C#/ObjC verbatim string - g_lastSkipVerbStringContext=YY_START; - g_pSkipVerbString=&g_current->initializer; + yyextra->lastSkipVerbStringContext=YY_START; + yyextra->pSkipVerbString=&yyextra->current->initializer; BEGIN(SkipVerbString); } } [^\n"]+ { - *g_pSkipVerbString+=yytext; + *yyextra->pSkipVerbString+=yytext; } "\"\"" { // quote escape - *g_pSkipVerbString+=yytext; + *yyextra->pSkipVerbString+=yytext; } "\"" { - *g_pSkipVerbString+=*yytext; - BEGIN(g_lastSkipVerbStringContext); + *yyextra->pSkipVerbString+=*yytext; + BEGIN(yyextra->lastSkipVerbStringContext); } \n { - *g_pSkipVerbString+=*yytext; - lineCount(); + *yyextra->pSkipVerbString+=*yytext; + lineCount(yyscanner); } . { - *g_pSkipVerbString+=*yytext; + *yyextra->pSkipVerbString+=*yytext; } "?>" { - if (g_insidePHP) + if (yyextra->insidePHP) BEGIN( FindMembersPHP ); else - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } . { - g_current->initializer+=*yytext; + yyextra->current->initializer+=*yytext; } /* generic quoted string copy rules */ \\. { - *g_pCopyQuotedString+=yytext; + *yyextra->pCopyQuotedString+=yytext; } \" { - *g_pCopyQuotedString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedString+=*yytext; + BEGIN( yyextra->lastStringContext ); } \' { - *g_pCopyQuotedString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedString+=*yytext; + BEGIN( yyextra->lastStringContext ); } "/*"|"*/"|"//" { - *g_pCopyQuotedString+=yytext; + *yyextra->pCopyQuotedString+=yytext; } \n { - *g_pCopyQuotedString+=*yytext; - lineCount(); + *yyextra->pCopyQuotedString+=*yytext; + lineCount(yyscanner); } . { - *g_pCopyQuotedString+=*yytext; + *yyextra->pCopyQuotedString+=*yytext; } /* generic quoted growable string copy rules */ \\. { - *g_pCopyQuotedGString+=yytext; + *yyextra->pCopyQuotedGString+=yytext; } \" { - *g_pCopyQuotedGString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedGString+=*yytext; + BEGIN( yyextra->lastStringContext ); } \' { - *g_pCopyQuotedGString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedGString+=*yytext; + BEGIN( yyextra->lastStringContext ); } "pCopyQuotedGString += yytext; + BEGIN( yyextra->lastStringContext ); } "/*"|"*/"|"//" { - *g_pCopyQuotedGString+=yytext; + *yyextra->pCopyQuotedGString+=yytext; } \n { - *g_pCopyQuotedGString+=*yytext; - lineCount(); + *yyextra->pCopyQuotedGString+=*yytext; + lineCount(yyscanner); } . { - *g_pCopyQuotedGString+=*yytext; + *yyextra->pCopyQuotedGString+=*yytext; } /* generic round bracket list copy rules */ \" { - *g_pCopyRoundString+=*yytext; - g_pCopyQuotedString=g_pCopyRoundString; - g_lastStringContext=YY_START; + *yyextra->pCopyRoundString+=*yytext; + yyextra->pCopyQuotedString=yyextra->pCopyRoundString; + yyextra->lastStringContext=YY_START; BEGIN(CopyString); } "(" { - *g_pCopyRoundString+=*yytext; - g_roundCount++; + *yyextra->pCopyRoundString+=*yytext; + yyextra->roundCount++; } ")" { - *g_pCopyRoundString+=*yytext; - if (--g_roundCount<0) - BEGIN(g_lastRoundContext); + *yyextra->pCopyRoundString+=*yytext; + if (--yyextra->roundCount<0) + BEGIN(yyextra->lastRoundContext); } \n { - lineCount(); - *g_pCopyRoundString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyRoundString+=*yytext; } \' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_current->initializer+=yytext; - g_pCopyQuotedString = g_pCopyRoundString; - g_lastStringContext=YY_START; + yyextra->current->initializer+=yytext; + yyextra->pCopyQuotedString = yyextra->pCopyRoundString; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPString); } else { - *g_pCopyRoundString+=yytext; + *yyextra->pCopyRoundString+=yytext; } } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyRoundString+=yytext; + *yyextra->pCopyRoundString+=yytext; } } [^"'()\n]+ { - *g_pCopyRoundString+=yytext; + *yyextra->pCopyRoundString+=yytext; } . { - *g_pCopyRoundString+=*yytext; + *yyextra->pCopyRoundString+=*yytext; } /* generic round bracket list copy rules for growable strings */ \" { - *g_pCopyRoundGString+=*yytext; - g_pCopyQuotedGString=g_pCopyRoundGString; - g_lastStringContext=YY_START; + *yyextra->pCopyRoundGString+=*yytext; + yyextra->pCopyQuotedGString=yyextra->pCopyRoundGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyGString); } "(" { - *g_pCopyRoundGString+=*yytext; - g_roundCount++; + *yyextra->pCopyRoundGString+=*yytext; + yyextra->roundCount++; } ")" { - *g_pCopyRoundGString+=*yytext; - if (--g_roundCount<0) - BEGIN(g_lastRoundContext); + *yyextra->pCopyRoundGString+=*yytext; + if (--yyextra->roundCount<0) + BEGIN(yyextra->lastRoundContext); } \n { - lineCount(); - *g_pCopyRoundGString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyRoundGString+=*yytext; } \' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_current->initializer+=yytext; - g_pCopyQuotedGString = g_pCopyRoundGString; - g_lastStringContext=YY_START; + yyextra->current->initializer+=yytext; + yyextra->pCopyQuotedGString = yyextra->pCopyRoundGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - *g_pCopyRoundGString+=yytext; + *yyextra->pCopyRoundGString+=yytext; } } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyRoundGString+=yytext; + *yyextra->pCopyRoundGString+=yytext; } } [^"'()\n/]+ { - *g_pCopyRoundGString+=yytext; + *yyextra->pCopyRoundGString+=yytext; } . { - *g_pCopyRoundGString+=*yytext; + *yyextra->pCopyRoundGString+=*yytext; } /* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with the round bracket version */ \" { - *g_pCopySquareGString+=*yytext; - g_pCopyQuotedGString=g_pCopySquareGString; - g_lastStringContext=YY_START; + *yyextra->pCopySquareGString+=*yytext; + yyextra->pCopyQuotedGString=yyextra->pCopySquareGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyGString); } "[" { - *g_pCopySquareGString+=*yytext; - g_squareCount++; + *yyextra->pCopySquareGString+=*yytext; + yyextra->squareCount++; } "]" { - *g_pCopySquareGString+=*yytext; - if (--g_squareCount<0) - BEGIN(g_lastSquareContext); + *yyextra->pCopySquareGString+=*yytext; + if (--yyextra->squareCount<0) + BEGIN(yyextra->lastSquareContext); } \n { - lineCount(); - *g_pCopySquareGString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopySquareGString+=*yytext; } \' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_current->initializer+=yytext; - g_pCopyQuotedGString = g_pCopySquareGString; - g_lastStringContext=YY_START; + yyextra->current->initializer+=yytext; + yyextra->pCopyQuotedGString = yyextra->pCopySquareGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - *g_pCopySquareGString+=yytext; + *yyextra->pCopySquareGString+=yytext; } } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_pCopySquareGString+=yytext; + *yyextra->pCopySquareGString+=yytext; } } [^"\[\]\n/]+ { - *g_pCopySquareGString+=yytext; + *yyextra->pCopySquareGString+=yytext; } . { - *g_pCopySquareGString+=*yytext; + *yyextra->pCopySquareGString+=*yytext; } /* generic curly bracket list copy rules */ \" { - *g_pCopyCurlyString+=*yytext; - g_pCopyQuotedString=g_pCopyCurlyString; - g_lastStringContext=YY_START; + *yyextra->pCopyCurlyString+=*yytext; + yyextra->pCopyQuotedString=yyextra->pCopyCurlyString; + yyextra->lastStringContext=YY_START; BEGIN(CopyString); } \' { - *g_pCopyCurlyString+=*yytext; - if (g_insidePHP) + *yyextra->pCopyCurlyString+=*yytext; + if (yyextra->insidePHP) { - g_pCopyQuotedString=g_pCopyCurlyString; - g_lastStringContext=YY_START; + yyextra->pCopyQuotedString=yyextra->pCopyCurlyString; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPString); } } "{" { - *g_pCopyCurlyString+=*yytext; - g_curlyCount++; + *yyextra->pCopyCurlyString+=*yytext; + yyextra->curlyCount++; } "}" { - *g_pCopyCurlyString+=*yytext; - if (--g_curlyCount<0) - BEGIN(g_lastCurlyContext); + *yyextra->pCopyCurlyString+=*yytext; + if (--yyextra->curlyCount<0) + BEGIN(yyextra->lastCurlyContext); } -{CHARLIT} { if (g_insidePHP) +{CHARLIT} { if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyCurlyString+=yytext; + *yyextra->pCopyCurlyString+=yytext; } } [^"'{}\/\n]+ { - *g_pCopyCurlyString+=yytext; + *yyextra->pCopyCurlyString+=yytext; } -"/" { *g_pCopyCurlyString+=yytext; } +"/" { *yyextra->pCopyCurlyString+=yytext; } \n { - lineCount(); - *g_pCopyCurlyString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyCurlyString+=*yytext; } . { - *g_pCopyCurlyString+=*yytext; + *yyextra->pCopyCurlyString+=*yytext; } /* generic curly bracket list copy rules for growable strings */ @@ -3315,444 +3015,444 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) QCString line = QCString(yytext); int s = line.find(' '); int e = line.find('"',s); - g_yyLineNr = line.mid(s,e-s).toInt(); + yyextra->yyLineNr = line.mid(s,e-s).toInt(); if (yytext[yyleng-1]=='\n') { - lineCount(); - g_column=0; + lineCount(yyscanner); + yyextra->column=0; } } \" { - *g_pCopyCurlyGString+=*yytext; - g_pCopyQuotedGString=g_pCopyCurlyGString; - g_lastStringContext=YY_START; + *yyextra->pCopyCurlyGString+=*yytext; + yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyGString); } \' { - *g_pCopyCurlyGString+=*yytext; - if (g_insidePHP) + *yyextra->pCopyCurlyGString+=*yytext; + if (yyextra->insidePHP) { - g_pCopyQuotedGString=g_pCopyCurlyGString; - g_lastStringContext=YY_START; + yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPGString); } } "{" { - *g_pCopyCurlyGString+=*yytext; - g_curlyCount++; + *yyextra->pCopyCurlyGString+=*yytext; + yyextra->curlyCount++; } "}" { - *g_pCopyCurlyGString+=*yytext; - if (--g_curlyCount<0) - BEGIN(g_lastCurlyContext); + *yyextra->pCopyCurlyGString+=*yytext; + if (--yyextra->curlyCount<0) + BEGIN(yyextra->lastCurlyContext); } -{CHARLIT} { if (g_insidePHP) +{CHARLIT} { if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyCurlyGString+=yytext; + *yyextra->pCopyCurlyGString+=yytext; } } [^"'{}\/\n,]+ { - *g_pCopyCurlyGString+=yytext; + *yyextra->pCopyCurlyGString+=yytext; } [,]+ { - *g_pCopyCurlyGString+=yytext; + *yyextra->pCopyCurlyGString+=yytext; } -"/" { *g_pCopyCurlyGString+=yytext; } +"/" { *yyextra->pCopyCurlyGString+=yytext; } \n { - lineCount(); - *g_pCopyCurlyGString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyCurlyGString+=*yytext; } . { - *g_pCopyCurlyGString+=*yytext; + *yyextra->pCopyCurlyGString+=*yytext; } /* ---------------------- */ ":" { - if (g_current->type.isEmpty() && - g_current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}' + if (yyextra->current->type.isEmpty() && + yyextra->current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}' { - g_current->section=Entry::ENUM_SEC; - g_current->name.resize(0); - g_current->args.resize(0); + yyextra->current->section=Entry::ENUM_SEC; + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); BEGIN(EnumBaseType); } else { - if (g_current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" + if (yyextra->current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" { - addType(); - g_current->name.sprintf("__pad%d__",g_padCount++); + addType(yyscanner); + yyextra->current->name.sprintf("__pad%d__",yyextra->padCount++); } BEGIN(BitFields); - g_current->bitfields+=":"; + yyextra->current->bitfields+=":"; } } . { - g_current->bitfields+=*yytext; + yyextra->current->bitfields+=*yytext; } . { - g_current->args+=*yytext; + yyextra->current->args+=*yytext; } \n { - lineCount(); - g_current->args+=' '; + lineCount(yyscanner); + yyextra->current->args+=' '; } [;,] { - QCString oldType = g_current->type; - if (g_current->bodyLine==-1) + QCString oldType = yyextra->current->type; + if (yyextra->current->bodyLine==-1) { - g_current->bodyLine = g_yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; } - if ( g_insidePHP && g_current->type.left(3) == "var" ) + if ( yyextra->insidePHP && yyextra->current->type.left(3) == "var" ) { - g_current->type = g_current->type.mid(3); + yyextra->current->type = yyextra->current->type.mid(3); } - if (g_isTypedef && g_current->type.left(8)!="typedef ") + if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ") { - g_current->type.prepend("typedef "); + yyextra->current->type.prepend("typedef "); } - bool stat = g_current->stat; - if (!g_current->name.isEmpty() && g_current->section!=Entry::ENUM_SEC) + bool stat = yyextra->current->stat; + if (!yyextra->current->name.isEmpty() && yyextra->current->section!=Entry::ENUM_SEC) { - g_current->type=g_current->type.simplifyWhiteSpace(); - g_current->args=removeRedundantWhiteSpace(g_current->args); - g_current->name=g_current->name.stripWhiteSpace(); - if (g_current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" + yyextra->current->type=yyextra->current->type.simplifyWhiteSpace(); + yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args); + yyextra->current->name=yyextra->current->name.stripWhiteSpace(); + if (yyextra->current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" { - g_current->spec = 0; + yyextra->current->spec = 0; } - g_current->section = Entry::VARIABLE_SEC ; - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyBegLineNr; - g_current->startColumn = g_yyBegColNr; - g_current_root->moveToSubEntryAndRefresh( g_current ) ; - initEntry(); + yyextra->current->section = Entry::VARIABLE_SEC ; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyBegLineNr; + yyextra->current->startColumn = yyextra->yyBegColNr; + yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ; + initEntry(yyscanner); } if ( *yytext == ',') { - g_current->stat = stat; // the static attribute holds for all variables - g_current->name.resize(0); - g_current->args.resize(0); - g_current->brief.resize(0); - g_current->doc.resize(0); - g_current->initializer.resize(0); - g_current->bitfields.resize(0); + yyextra->current->stat = stat; // the static attribute holds for all variables + yyextra->current->name.resize(0); + yyextra->current->args.resize(0); + yyextra->current->brief.resize(0); + yyextra->current->doc.resize(0); + yyextra->current->initializer.resize(0); + yyextra->current->bitfields.resize(0); int i=oldType.length(); while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--; - g_current->type = oldType.left(i); + yyextra->current->type = oldType.left(i); } else { - g_mtype = Method; - g_virt = Normal; - g_current->groups.clear(); - initEntry(); + yyextra->mtype = Method; + yyextra->virt = Normal; + yyextra->current->groups.clear(); + initEntry(yyscanner); } } "[" { - if (g_insideSlice) + if (yyextra->insideSlice) { - g_squareCount=1; - g_lastSquareContext = YY_START; - g_current->metaData += "["; + yyextra->squareCount=1; + yyextra->lastSquareContext = YY_START; + yyextra->current->metaData += "["; BEGIN( SliceMetadata ); } - else if (!g_insideCS && - (g_current->name.isEmpty() || - g_current->name=="typedef" + else if (!yyextra->insideCS && + (yyextra->current->name.isEmpty() || + yyextra->current->name=="typedef" ) ) // IDL function property { - g_squareCount=1; - g_lastSquareContext = YY_START; - g_idlAttr.resize(0); - g_idlProp.resize(0); - g_current->mtype = g_mtype; + yyextra->squareCount=1; + yyextra->lastSquareContext = YY_START; + yyextra->idlAttr.resize(0); + yyextra->idlProp.resize(0); + yyextra->current->mtype = yyextra->mtype; if (Config_getBool(IDL_PROPERTY_SUPPORT) && - g_current->mtype == Property) - { // we are g_inside the properties section of a dispinterface - g_odlProp = true; - g_current->spec |= Entry::Gettable; - g_current->spec |= Entry::Settable; + yyextra->current->mtype == Property) + { // we are yyextra->inside the properties section of a dispinterface + yyextra->odlProp = true; + yyextra->current->spec |= Entry::Gettable; + yyextra->current->spec |= Entry::Settable; } BEGIN( IDLAttribute ); } - else if (g_insideCS && - g_current->name.isEmpty()) + else if (yyextra->insideCS && + yyextra->current->name.isEmpty()) { - g_squareCount=1; - g_lastSquareContext = YY_START; + yyextra->squareCount=1; + yyextra->lastSquareContext = YY_START; // Skip the C# attribute // for this member - g_current->args.resize(0); + yyextra->current->args.resize(0); BEGIN( SkipSquare ); } else { - g_current->args += yytext ; - g_squareCount=1; - g_externC=FALSE; // see bug759247 + yyextra->current->args += yytext ; + yyextra->squareCount=1; + yyextra->externC=FALSE; // see bug759247 BEGIN( Array ) ; } } "[" { // Global metadata. - g_squareCount++; - g_current->metaData += "["; + yyextra->squareCount++; + yyextra->current->metaData += "["; } {BN}* { - lineCount(); + lineCount(yyscanner); } \"[^\"]*\" { - g_current->metaData += yytext; + yyextra->current->metaData += yytext; } "," { - g_current->metaData += yytext; + yyextra->current->metaData += yytext; } "]" { - g_current->metaData += yytext; - if (--g_squareCount<=0) + yyextra->current->metaData += yytext; + if (--yyextra->squareCount<=0) { - BEGIN (g_lastSquareContext); + BEGIN (yyextra->lastSquareContext); } } "(" { - g_current->type += "("; - g_roundCount++; + yyextra->current->type += "("; + yyextra->roundCount++; } [0-9]+ { - g_current->type += yytext; + yyextra->current->type += yytext; } ")" { - g_current->type += ")"; - if(--g_roundCount<=0) + yyextra->current->type += ")"; + if(--yyextra->roundCount<=0) { - BEGIN (g_lastModifierContext); + BEGIN (yyextra->lastModifierContext); } } "]" { // end of IDL function attribute - if (--g_squareCount<=0) + if (--yyextra->squareCount<=0) { - lineCount(); - if (g_current->mtype == Property) + lineCount(yyscanner); + if (yyextra->current->mtype == Property) BEGIN( IDLPropName ); else - BEGIN( g_lastSquareContext ); + BEGIN( yyextra->lastSquareContext ); } } "propput" { if (Config_getBool(IDL_PROPERTY_SUPPORT)) { - g_current->mtype = Property; + yyextra->current->mtype = Property; } - g_current->spec |= Entry::Settable; + yyextra->current->spec |= Entry::Settable; } "propget" { if (Config_getBool(IDL_PROPERTY_SUPPORT)) { - g_current->mtype = Property; + yyextra->current->mtype = Property; } - g_current->spec |= Entry::Gettable; + yyextra->current->spec |= Entry::Gettable; } "property" { // UNO IDL property - g_current->spec |= Entry::Property; + yyextra->current->spec |= Entry::Property; } "attribute" { // UNO IDL attribute - g_current->spec |= Entry::Attribute; + yyextra->current->spec |= Entry::Attribute; } "optional" { // on UNO IDL interface/service/attribute/property - g_current->spec |= Entry::Optional; + yyextra->current->spec |= Entry::Optional; } "readonly" { // on UNO IDL attribute or property - if (Config_getBool(IDL_PROPERTY_SUPPORT) && g_odlProp) + if (Config_getBool(IDL_PROPERTY_SUPPORT) && yyextra->odlProp) { - g_current->spec ^= Entry::Settable; + yyextra->current->spec ^= Entry::Settable; } else { - g_current->spec |= Entry::Readonly; + yyextra->current->spec |= Entry::Readonly; } } "bound" { // on UNO IDL attribute or property - g_current->spec |= Entry::Bound; + yyextra->current->spec |= Entry::Bound; } "removable" { // on UNO IDL property - g_current->spec |= Entry::Removable; + yyextra->current->spec |= Entry::Removable; } "constrained" { // on UNO IDL property - g_current->spec |= Entry::Constrained; + yyextra->current->spec |= Entry::Constrained; } "transient" { // on UNO IDL property - g_current->spec |= Entry::Transient; + yyextra->current->spec |= Entry::Transient; } "maybevoid" { // on UNO IDL property - g_current->spec |= Entry::MaybeVoid; + yyextra->current->spec |= Entry::MaybeVoid; } "maybedefault" { // on UNO IDL property - g_current->spec |= Entry::MaybeDefault; + yyextra->current->spec |= Entry::MaybeDefault; } "maybeambiguous" { // on UNO IDL property - g_current->spec |= Entry::MaybeAmbiguous; + yyextra->current->spec |= Entry::MaybeAmbiguous; } . { } {BN}*{ID}{BN}* { // return type (probably HRESULT) - skip it - if (g_odlProp) + if (yyextra->odlProp) { // property type - g_idlProp = yytext; + yyextra->idlProp = yytext; } } {ID}{BN}*"(" { - g_current->name = yytext; - g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; + yyextra->current->name = yytext; + yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; BEGIN( IDLProp ); } {BN}*"("{BN}*{ID}{BN}*")"{BN}* { - if (g_odlProp) + if (yyextra->odlProp) { - g_idlProp += yytext; + yyextra->idlProp += yytext; } } {ID}{BN}*/";" { - if (g_odlProp) + if (yyextra->odlProp) { - g_current->name = yytext; - g_idlProp = g_idlProp.stripWhiteSpace(); - g_odlProp = false; + yyextra->current->name = yytext; + yyextra->idlProp = yyextra->idlProp.stripWhiteSpace(); + yyextra->odlProp = false; BEGIN( IDLProp ); } } {BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter - g_idlAttr = yytext; - g_idlAttr=g_idlAttr.stripWhiteSpace(); + yyextra->idlAttr = yytext; + yyextra->idlAttr=yyextra->idlAttr.stripWhiteSpace(); } {ID} { // property type - g_idlProp = yytext; + yyextra->idlProp = yytext; } {BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);) - if (!g_current->args) - g_current->args = "("; + if (!yyextra->current->args) + yyextra->current->args = "("; else - g_current->args += ", "; - g_current->args += g_idlAttr; - g_current->args += " "; - g_current->args += g_idlProp; // prop was actually type of extra parameter - g_current->args += " "; - g_current->args += yytext; - g_current->args = g_current->args.left(g_current->args.length() - 1); // strip comma - g_idlProp.resize(0); - g_idlAttr.resize(0); + yyextra->current->args += ", "; + yyextra->current->args += yyextra->idlAttr; + yyextra->current->args += " "; + yyextra->current->args += yyextra->idlProp; // prop was actually type of extra parameter + yyextra->current->args += " "; + yyextra->current->args += yytext; + yyextra->current->args = yyextra->current->args.left(yyextra->current->args.length() - 1); // strip comma + yyextra->idlProp.resize(0); + yyextra->idlAttr.resize(0); BEGIN( IDLProp ); } {BN}*{ID}{BN}*")"{BN}* { // the parameter name for the property - just skip. } ";" { - g_current->fileName = g_yyFileName; - g_current->type = g_idlProp; - g_current->args = g_current->args.simplifyWhiteSpace(); - if (g_current->args) - g_current->args += ")"; - g_current->name = g_current->name.stripWhiteSpace(); - g_current->section = Entry::VARIABLE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->type = yyextra->idlProp; + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + if (yyextra->current->args) + yyextra->current->args += ")"; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->section = Entry::VARIABLE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN( FindMembers ); } . { // spaces, *, or other stuff - //g_idlProp+=yytext; + //yyextra->idlProp+=yytext; } -"]" { g_current->args += *yytext ; - if (--g_squareCount<=0) +"]" { yyextra->current->args += *yytext ; + if (--yyextra->squareCount<=0) BEGIN( FindMembers ) ; } -"]" { g_current->args += *yytext ; - if (--g_squareCount<=0) +"]" { yyextra->current->args += *yytext ; + if (--yyextra->squareCount<=0) BEGIN( Function ) ; } -"[" { g_current->args += *yytext ; - g_squareCount++; +"[" { yyextra->current->args += *yytext ; + yyextra->squareCount++; } -. { g_current->args += *yytext ; } -"[" { g_squareCount++; } +. { yyextra->current->args += *yytext ; } +"[" { yyextra->squareCount++; } "]" { - if (--g_squareCount<=0) - BEGIN( g_lastSquareContext ); + if (--yyextra->squareCount<=0) + BEGIN( yyextra->lastSquareContext ); } \" { - g_lastStringContext=YY_START; + yyextra->lastStringContext=YY_START; BEGIN( SkipString ); } [^\n\[\]\"]+ -"<" { addType(); - g_current->type += yytext ; +"<" { addType(yyscanner); + yyextra->current->type += yytext ; BEGIN( Sharp ) ; } -">" { g_current->type += *yytext ; - if (--g_sharpCount<=0) +">" { yyextra->current->type += *yytext ; + if (--yyextra->sharpCount<=0) BEGIN( FindMembers ) ; } -"<" { g_current->type += *yytext ; - g_sharpCount++; +"<" { yyextra->current->type += *yytext ; + yyextra->sharpCount++; } {BN}+ { - g_current->type += ' '; - lineCount(); + yyextra->current->type += ' '; + lineCount(yyscanner); } -. { g_current->type += *yytext ; } +. { yyextra->current->type += *yytext ; } {ID} { - if (g_insideCpp || g_insideObjC) + if (yyextra->insideCpp || yyextra->insideObjC) { - g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); + yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext); } - g_current->bodyLine = g_yyLineNr; - g_current->name = yytext; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->name = yytext; } "(" { // Java enum initializer unput('('); - g_lastInitializerContext = YY_START; - g_initBracketCount=0; - g_current->initializer = "="; + yyextra->lastInitializerContext = YY_START; + yyextra->initBracketCount=0; + yyextra->current->initializer = "="; BEGIN(ReadInitializer); } "=" { - g_lastInitializerContext = YY_START; - g_initBracketCount=0; - g_current->initializer = yytext; + yyextra->lastInitializerContext = YY_START; + yyextra->initBracketCount=0; + yyextra->current->initializer = yytext; BEGIN(ReadInitializer); } ";" { - if (g_insideJava) // g_last enum field in Java class + if (yyextra->insideJava) // yyextra->last enum field in Java class { - if (!g_current->name.isEmpty()) + if (!yyextra->current->name.isEmpty()) { - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - if (!(g_current_root->spec&Entry::Enum)) + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + if (!(yyextra->current_root->spec&Entry::Enum)) { - g_current->type = "@"; // enum marker + yyextra->current->type = "@"; // enum marker } - g_current->args = g_current->args.simplifyWhiteSpace(); - g_current->name = g_current->name.stripWhiteSpace(); - g_current->section = Entry::VARIABLE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->section = Entry::VARIABLE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); } BEGIN( FindMembers ); @@ -3763,70 +3463,70 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } \n { - lineCount(); + lineCount(yyscanner); } [^\n]* "," { //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n", - // g_current->type.data(), g_current->name.data(), - // g_current->args.data(), g_current_root->name.data(),g_current->mGrpId); - if (!g_current->name.isEmpty()) - { - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyLineNr; - g_current->startColumn = g_yyColNr; - if (!(g_current_root->spec&Entry::Enum)) + // yyextra->current->type.data(), yyextra->current->name.data(), + // yyextra->current->args.data(), yyextra->current_root->name.data(),yyextra->current->mGrpId); + if (!yyextra->current->name.isEmpty()) + { + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + if (!(yyextra->current_root->spec&Entry::Enum)) { - g_current->type = "@"; // enum marker + yyextra->current->type = "@"; // enum marker } - g_current->args = g_current->args.simplifyWhiteSpace(); - g_current->name = g_current->name.stripWhiteSpace(); - g_current->section = Entry::VARIABLE_SEC; + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + yyextra->current->section = Entry::VARIABLE_SEC; // add to the scope of the enum - if (!g_insideCS && !g_insideJava && - !(g_current_root->spec&Entry::Strong)) + if (!yyextra->insideCS && !yyextra->insideJava && + !(yyextra->current_root->spec&Entry::Strong)) // for C# and Java 1.5+ enum values always have to be explicitly qualified, // same for C++11 style enums (enum class Name {}) { // add to the scope surrounding the enum (copy!) // we cannot during it directly as that would invalidate the iterator in parseCompounds. - //printf("*** adding outer scope entry for %s\n",g_current->name.data()); - g_outerScopeEntries.emplace_back(g_current_root->parent(), std::make_unique(*g_current)); + //printf("*** adding outer scope entry for %s\n",yyextra->current->name.data()); + yyextra->outerScopeEntries.emplace_back(yyextra->current_root->parent(), std::make_unique(*yyextra->current)); } - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); } else // probably a redundant , { - g_current->reset(); - initEntry(); + yyextra->current->reset(); + initEntry(yyscanner); } } "[" { // attribute list in IDL - g_squareCount=1; - g_lastSquareContext = YY_START; + yyextra->squareCount=1; + yyextra->lastSquareContext = YY_START; BEGIN(SkipSquare); } /* "," { unput(*yytext); BEGIN(FindFields); } */ -[^\r\n\#{}"@'/<]* { g_current->program += yytext ; } -"//".* { g_current->program += yytext ; } -"#".* { if (!g_insidePHP) +[^\r\n\#{}"@'/<]* { yyextra->current->program += yytext ; } +"//".* { yyextra->current->program += yytext ; } +"#".* { if (!yyextra->insidePHP) REJECT; // append PHP comment. - g_current->program += yytext ; + yyextra->current->program += yytext ; } -@\" { g_current->program += yytext ; - g_pSkipVerbString = &g_current->program; - g_lastSkipVerbStringContext=YY_START; +@\" { yyextra->current->program += yytext ; + yyextra->pSkipVerbString = &yyextra->current->program; + yyextra->lastSkipVerbStringContext=YY_START; BEGIN( SkipVerbString ); } -"<<<" { if (g_insidePHP) +"<<<" { if (yyextra->insidePHP) { - g_current->program += yytext ; - g_pCopyHereDocGString = &g_current->program; - g_lastHereDocContext=YY_START; + yyextra->current->program += yytext ; + yyextra->pCopyHereDocGString = &yyextra->current->program; + yyextra->lastHereDocContext=YY_START; BEGIN( CopyHereDoc ); } else @@ -3834,154 +3534,154 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) REJECT; } } -\" { g_current->program += yytext ; - g_pCopyQuotedGString = &g_current->program; - g_lastStringContext=YY_START; +\" { yyextra->current->program += yytext ; + yyextra->pCopyQuotedGString = &yyextra->current->program; + yyextra->lastStringContext=YY_START; BEGIN( CopyGString ); } -"/*"{B}* { g_current->program += yytext ; - g_lastContext = YY_START ; +"/*"{B}* { yyextra->current->program += yytext ; + yyextra->lastContext = YY_START ; BEGIN( Comment ) ; } -"/*"{BL} { g_current->program += yytext ; - ++g_yyLineNr ; - g_lastContext = YY_START ; +"/*"{BL} { yyextra->current->program += yytext ; + ++yyextra->yyLineNr ; + yyextra->lastContext = YY_START ; BEGIN( Comment ) ; } "'" { - if (!g_insidePHP) + if (!yyextra->insidePHP) { - g_current->program += yytext; + yyextra->current->program += yytext; } else { // begin of single quoted string - g_current->program += yytext; - g_pCopyQuotedGString = &g_current->program; - g_lastStringContext=YY_START; + yyextra->current->program += yytext; + yyextra->pCopyQuotedGString = &yyextra->current->program; + yyextra->lastStringContext=YY_START; BEGIN(CopyPHPGString); } } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; // for PHP code single quotes // are used for strings of arbitrary length } else { - g_current->program += yytext; + yyextra->current->program += yytext; } } -"{" { g_current->program += yytext ; - ++g_curlyCount ; +"{" { yyextra->current->program += yytext ; + ++yyextra->curlyCount ; } "}" { - g_current->program += yytext ; - --g_curlyCount ; + yyextra->current->program += yytext ; + --yyextra->curlyCount ; } -"}" { //err("ReadBody count=%d\n",g_curlyCount); - if ( g_curlyCount>0 ) +"}" { //err("ReadBody count=%d\n",yyextra->curlyCount); + if ( yyextra->curlyCount>0 ) { - g_current->program += yytext ; - --g_curlyCount ; + yyextra->current->program += yytext ; + --yyextra->curlyCount ; } else { - g_current->endBodyLine = g_yyLineNr; - Entry * original_root = g_current_root; // save root this namespace is in - if (g_current->section == Entry::NAMESPACE_SEC && g_current->type == "namespace") + yyextra->current->endBodyLine = yyextra->yyLineNr; + Entry * original_root = yyextra->current_root; // save root this namespace is in + if (yyextra->current->section == Entry::NAMESPACE_SEC && yyextra->current->type == "namespace") { int split_point; // save documentation values - QCString doc = g_current->doc; - int docLine = g_current->docLine; - QCString docFile = g_current->docFile; - QCString brief = g_current->brief; - int briefLine = g_current->briefLine; - QCString briefFile = g_current->briefFile; + QCString doc = yyextra->current->doc; + int docLine = yyextra->current->docLine; + QCString docFile = yyextra->current->docFile; + QCString brief = yyextra->current->brief; + int briefLine = yyextra->current->briefLine; + QCString briefFile = yyextra->current->briefFile; // reset documentation values - g_current->doc = ""; - g_current->docLine = 0; - g_current->docFile = ""; - g_current->brief = ""; - g_current->briefLine = 0; - g_current->briefFile = ""; - while ((split_point = g_current->name.find("::")) != -1) + yyextra->current->doc = ""; + yyextra->current->docLine = 0; + yyextra->current->docFile = ""; + yyextra->current->brief = ""; + yyextra->current->briefLine = 0; + yyextra->current->briefFile = ""; + while ((split_point = yyextra->current->name.find("::")) != -1) { - std::unique_ptr new_g_current = std::make_unique(*g_current); - g_current->program = ""; - new_g_current->name = g_current->name.mid(split_point + 2); - g_current->name = g_current->name.left(split_point); - if (!g_current_root->name.isEmpty()) g_current->name.prepend(g_current_root->name+"::"); - - Entry *tmp = g_current.get(); - g_current_root->moveToSubEntryAndKeep(g_current); - g_current_root = tmp; - g_current.swap(new_g_current); + std::unique_ptr new_current = std::make_unique(*yyextra->current); + yyextra->current->program = ""; + new_current->name = yyextra->current->name.mid(split_point + 2); + yyextra->current->name = yyextra->current->name.left(split_point); + if (!yyextra->current_root->name.isEmpty()) yyextra->current->name.prepend(yyextra->current_root->name+"::"); + + Entry *tmp = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndKeep(yyextra->current); + yyextra->current_root = tmp; + yyextra->current.swap(new_current); } // restore documentation values - g_current->doc = doc; - g_current->docLine = docLine; - g_current->docFile = docFile; - g_current->brief = brief; - g_current->briefLine = briefLine; - g_current->briefFile = briefFile; + yyextra->current->doc = doc; + yyextra->current->docLine = docLine; + yyextra->current->docFile = docFile; + yyextra->current->brief = brief; + yyextra->current->briefLine = briefLine; + yyextra->current->briefFile = briefFile; } - QCString &cn = g_current->name; - QCString rn = g_current_root->name.copy(); - //printf("cn='%s' rn='%s' g_isTypedef=%d\n",cn.data(),rn.data(),g_isTypedef); + QCString &cn = yyextra->current->name; + QCString rn = yyextra->current_root->name.copy(); + //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef); if (!cn.isEmpty() && !rn.isEmpty()) { - prependScope(); + prependScope(yyscanner); } - if (g_isTypedef && cn.isEmpty()) + if (yyextra->isTypedef && cn.isEmpty()) { //printf("Typedef Name\n"); BEGIN( TypedefName ); } else { - if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) + if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum)) { - g_current->program+=','; // add field terminator + yyextra->current->program+=','; // add field terminator } // add compound definition to the tree - g_current->args=removeRedundantWhiteSpace(g_current->args); - // was: g_current->args.simplifyWhiteSpace(); - g_current->type = g_current->type.simplifyWhiteSpace(); - g_current->name = g_current->name.stripWhiteSpace(); - //printf("adding '%s' '%s' '%s' brief=%s g_insideObjC=%d %x\n",g_current->type.data(),g_current->name.data(),g_current->args.data(),g_current->brief.data(),g_insideObjC,g_current->section); - if (g_insideObjC && - ((g_current->spec&Entry::Interface) || (g_current->spec==Entry::Category)) + yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args); + // was: yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->type = yyextra->current->type.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + //printf("adding '%s' '%s' '%s' brief=%s yyextra->insideObjC=%d %x\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data(),yyextra->current->brief.data(),yyextra->insideObjC,yyextra->current->section); + if (yyextra->insideObjC && + ((yyextra->current->spec&Entry::Interface) || (yyextra->current->spec==Entry::Category)) ) // method definition follows { BEGIN( ReadBodyIntf ) ; } else { - g_memspecEntry = g_current.get(); - g_current_root->copyToSubEntry( g_current ) ; - if (g_current->section==Entry::NAMESPACE_SEC || - (g_current->spec==Entry::Interface) || - g_insideJava || g_insidePHP || g_insideCS || g_insideD || g_insideJS || - g_insideSlice + yyextra->memspecEntry = yyextra->current.get(); + yyextra->current_root->copyToSubEntry( yyextra->current ) ; + if (yyextra->current->section==Entry::NAMESPACE_SEC || + (yyextra->current->spec==Entry::Interface) || + yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideJS || + yyextra->insideSlice ) { // namespaces and interfaces and java classes ends with a closing bracket without semicolon - g_current->reset(); - g_current_root = original_root; // restore scope from before namespace descent - initEntry(); - g_memspecEntry = 0; + yyextra->current->reset(); + yyextra->current_root = original_root; // restore scope from before namespace descent + initEntry(yyscanner); + yyextra->memspecEntry = 0; BEGIN( FindMembers ) ; } else { static QRegExp re("@[0-9]+$"); - if (!g_isTypedef && g_memspecEntry && - g_memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071) + if (!yyextra->isTypedef && yyextra->memspecEntry && + yyextra->memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071) { // enabled the next two lines for bug 623424 - g_current->doc.resize(0); - g_current->brief.resize(0); + yyextra->current->doc.resize(0); + yyextra->current->brief.resize(0); } BEGIN( MemberSpec ) ; } @@ -3989,113 +3689,113 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } } -"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",g_curlyCount); - lineCount(); - if ( g_curlyCount>0 ) +"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",yyextra->curlyCount); + lineCount(yyscanner); + if ( yyextra->curlyCount>0 ) { - g_current->program += yytext ; - --g_curlyCount ; + yyextra->current->program += yytext ; + --yyextra->curlyCount ; } else { - g_isTypedef = TRUE; - g_current->endBodyLine = g_yyLineNr; - QCString &cn = g_current->name; - QCString rn = g_current_root->name.copy(); + yyextra->isTypedef = TRUE; + yyextra->current->endBodyLine = yyextra->yyLineNr; + QCString &cn = yyextra->current->name; + QCString rn = yyextra->current_root->name.copy(); if (!cn.isEmpty() && !rn.isEmpty()) { - prependScope(); + prependScope(yyscanner); } BEGIN( TypedefName ); } } ("const"|"volatile"){BN} { // late "const" or "volatile" keyword - lineCount(); - g_current->type.prepend(yytext); + lineCount(yyscanner); + yyextra->current->type.prepend(yytext); } {ID} { - if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) + if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum)) { - g_current->program+=","; // add field terminator + yyextra->current->program+=","; // add field terminator } - g_current->name=yytext; - prependScope(); - g_current->args = g_current->args.simplifyWhiteSpace(); - g_current->type = g_current->type.simplifyWhiteSpace(); - //printf("Adding compound %s %s %s\n",g_current->type.data(),g_current->name.data(),g_current->args.data()); - if (!g_firstTypedefEntry) + yyextra->current->name=yytext; + prependScope(yyscanner); + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->type = yyextra->current->type.simplifyWhiteSpace(); + //printf("Adding compound %s %s %s\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + if (!yyextra->firstTypedefEntry) { - g_firstTypedefEntry = g_current.get(); + yyextra->firstTypedefEntry = yyextra->current.get(); } - g_current_root->moveToSubEntryAndRefresh( g_current ) ; - initEntry(); - g_isTypedef=TRUE; // to undo reset by initEntry() + yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ; + initEntry(yyscanner); + yyextra->isTypedef=TRUE; // to undo reset by initEntry(yyscanner) BEGIN(MemberSpecSkip); } ";" { /* typedef of anonymous type */ - g_current->name.sprintf("@%d",g_anonCount++); - if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) + yyextra->current->name.sprintf("@%d",yyextra->anonCount++); + if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum)) { - g_current->program+=','; // add field terminator + yyextra->current->program+=','; // add field terminator } // add compound definition to the tree - g_current->args = g_current->args.simplifyWhiteSpace(); - g_current->type = g_current->type.simplifyWhiteSpace(); - g_memspecEntry = g_current.get(); - g_current_root->moveToSubEntryAndRefresh( g_current ) ; - initEntry(); + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->type = yyextra->current->type.simplifyWhiteSpace(); + yyextra->memspecEntry = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ; + initEntry(yyscanner); unput(';'); BEGIN( MemberSpec ) ; } ([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part could be improved. - lineCount(); + lineCount(yyscanner); int i=0,l=(int)yyleng,j; while (imsName = QCString(yytext).right(l-i).stripWhiteSpace(); + j=yyextra->msName.find("["); if (j!=-1) { - g_msArgs=g_msName.right(g_msName.length()-j); - g_msName=g_msName.left(j); + yyextra->msArgs=yyextra->msName.right(yyextra->msName.length()-j); + yyextra->msName=yyextra->msName.left(j); } - g_msType=QCString(yytext).left(i); + yyextra->msType=QCString(yytext).left(i); // handle *pName in: typedef { ... } name, *pName; - if (g_firstTypedefEntry) + if (yyextra->firstTypedefEntry) { - if (g_firstTypedefEntry->spec&Entry::Struct) + if (yyextra->firstTypedefEntry->spec&Entry::Struct) { - g_msType.prepend("struct "+g_firstTypedefEntry->name); + yyextra->msType.prepend("struct "+yyextra->firstTypedefEntry->name); } - else if (g_firstTypedefEntry->spec&Entry::Union) + else if (yyextra->firstTypedefEntry->spec&Entry::Union) { - g_msType.prepend("union "+g_firstTypedefEntry->name); + yyextra->msType.prepend("union "+yyextra->firstTypedefEntry->name); } - else if (g_firstTypedefEntry->section==Entry::ENUM_SEC) + else if (yyextra->firstTypedefEntry->section==Entry::ENUM_SEC) { - g_msType.prepend("enum "+g_firstTypedefEntry->name); + yyextra->msType.prepend("enum "+yyextra->firstTypedefEntry->name); } else { - g_msType.prepend(g_firstTypedefEntry->name); + yyextra->msType.prepend(yyextra->firstTypedefEntry->name); } } } "(" { // function with struct return type - addType(); - g_current->name = g_msName; - g_current->spec = 0; + addType(yyscanner); + yyextra->current->name = yyextra->msName; + yyextra->current->spec = 0; unput('('); BEGIN(FindMembers); } [,;] { - if (g_msName.isEmpty() && !g_current->name.isEmpty()) + if (yyextra->msName.isEmpty() && !yyextra->current->name.isEmpty()) { - // see if the compound does not have a name or is g_inside another + // see if the compound does not have a name or is yyextra->inside another // anonymous compound. If so we insert a // special 'anonymous' variable. - //Entry *p=g_current_root; - const Entry *p=g_current.get(); + //Entry *p=yyextra->current_root; + const Entry *p=yyextra->current.get(); while (p) { // only look for class scopes, not namespace scopes @@ -4106,164 +3806,164 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) int pi = (i==-1) ? 0 : i+2; if (p->name.at(pi)=='@') { - // anonymous compound g_inside -> insert dummy variable name + // anonymous compound yyextra->inside -> insert dummy variable name //printf("Adding anonymous variable for scope %s\n",p->name.data()); - g_msName.sprintf("@%d",g_anonCount++); + yyextra->msName.sprintf("@%d",yyextra->anonCount++); break; } } //p=p->parent; - if (p==g_current.get()) p=g_current_root; else p=p->parent(); + if (p==yyextra->current.get()) p=yyextra->current_root; else p=p->parent(); } } - //printf("g_msName=%s g_current->name=%s\n",g_msName.data(),g_current->name.data()); - if (!g_msName.isEmpty() - /*&& g_msName!=g_current->name*/) // skip typedef T {} T;, removed due to bug608493 + //printf("yyextra->msName=%s yyextra->current->name=%s\n",yyextra->msName.data(),yyextra->current->name.data()); + if (!yyextra->msName.isEmpty() + /*&& yyextra->msName!=yyextra->current->name*/) // skip typedef T {} T;, removed due to bug608493 { bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); // case 1: typedef struct _S { ... } S_t; // -> omit typedef and use S_t as the struct name if (typedefHidesStruct && - g_isTypedef && - ((g_current->spec&(Entry::Struct|Entry::Union)) || - g_current->section==Entry::ENUM_SEC )&& - g_msType.stripWhiteSpace().isEmpty() && - g_memspecEntry) + yyextra->isTypedef && + ((yyextra->current->spec&(Entry::Struct|Entry::Union)) || + yyextra->current->section==Entry::ENUM_SEC )&& + yyextra->msType.stripWhiteSpace().isEmpty() && + yyextra->memspecEntry) { - g_memspecEntry->name=g_msName; + yyextra->memspecEntry->name=yyextra->msName; } else // case 2: create a typedef field { std::unique_ptr varEntry=std::make_unique(); - varEntry->lang = g_language; - varEntry->protection = g_current->protection ; - varEntry->mtype = g_current->mtype; - varEntry->virt = g_current->virt; - varEntry->stat = g_current->stat; + varEntry->lang = yyextra->language; + varEntry->protection = yyextra->current->protection ; + varEntry->mtype = yyextra->current->mtype; + varEntry->virt = yyextra->current->virt; + varEntry->stat = yyextra->current->stat; varEntry->section = Entry::VARIABLE_SEC; - varEntry->name = g_msName.stripWhiteSpace(); - varEntry->type = g_current->type.simplifyWhiteSpace()+" "; - varEntry->args = g_msArgs; - if (g_isTypedef) + varEntry->name = yyextra->msName.stripWhiteSpace(); + varEntry->type = yyextra->current->type.simplifyWhiteSpace()+" "; + varEntry->args = yyextra->msArgs; + if (yyextra->isTypedef) { varEntry->type.prepend("typedef "); - // //printf("g_current->name = %s %s\n",g_current->name.data(),g_msName.data()); + // //printf("yyextra->current->name = %s %s\n",yyextra->current->name.data(),yyextra->msName.data()); } if (typedefHidesStruct && - g_isTypedef && - (g_current->spec&(Entry::Struct|Entry::Union)) && - g_memspecEntry + yyextra->isTypedef && + (yyextra->current->spec&(Entry::Struct|Entry::Union)) && + yyextra->memspecEntry ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;" { - varEntry->type+=g_memspecEntry->name+g_msType; + varEntry->type+=yyextra->memspecEntry->name+yyextra->msType; } else // case 2: use _S as type for for pS_t { - varEntry->type+=g_current->name+g_msType; + varEntry->type+=yyextra->current->name+yyextra->msType; } - varEntry->fileName = g_yyFileName; - varEntry->startLine = g_yyLineNr; - varEntry->startColumn = g_yyColNr; - varEntry->doc = g_current->doc.copy(); - varEntry->brief = g_current->brief.copy(); - varEntry->mGrpId = g_current->mGrpId; - varEntry->initializer = g_current->initializer; - varEntry->groups = g_current->groups; - varEntry->sli = g_current->sli; + varEntry->fileName = yyextra->yyFileName; + varEntry->startLine = yyextra->yyLineNr; + varEntry->startColumn = yyextra->yyColNr; + varEntry->doc = yyextra->current->doc.copy(); + varEntry->brief = yyextra->current->brief.copy(); + varEntry->mGrpId = yyextra->current->mGrpId; + varEntry->initializer = yyextra->current->initializer; + varEntry->groups = yyextra->current->groups; + varEntry->sli = yyextra->current->sli; //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", // varEntry->type.data(),varEntry->name.data(), // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data()); - g_current_root->moveToSubEntryAndKeep(varEntry); + yyextra->current_root->moveToSubEntryAndKeep(varEntry); } } if (*yytext==';') // end of a struct/class ... { - if (!g_isTypedef && g_msName.isEmpty() && g_memspecEntry && (g_current->section&Entry::COMPOUND_MASK)) + if (!yyextra->isTypedef && yyextra->msName.isEmpty() && yyextra->memspecEntry && (yyextra->current->section&Entry::COMPOUND_MASK)) { // case where a class/struct has a doc block after it - if (!g_current->doc.isEmpty()) + if (!yyextra->current->doc.isEmpty()) { - g_memspecEntry->doc += g_current->doc; + yyextra->memspecEntry->doc += yyextra->current->doc; } - if (!g_current->brief.isEmpty()) + if (!yyextra->current->brief.isEmpty()) { - g_memspecEntry->brief += g_current->brief; + yyextra->memspecEntry->brief += yyextra->current->brief; } } - g_msType.resize(0); - g_msName.resize(0); - g_msArgs.resize(0); - g_isTypedef=FALSE; - g_firstTypedefEntry=0; - g_memspecEntry=0; - g_current->reset(); - initEntry(); + yyextra->msType.resize(0); + yyextra->msName.resize(0); + yyextra->msArgs.resize(0); + yyextra->isTypedef=FALSE; + yyextra->firstTypedefEntry=0; + yyextra->memspecEntry=0; + yyextra->current->reset(); + initEntry(yyscanner); BEGIN( FindMembers ); } else { - g_current->doc.resize(0); - g_current->brief.resize(0); + yyextra->current->doc.resize(0); + yyextra->current->brief.resize(0); } } "=" { - g_lastInitializerContext=YY_START; - g_initBracketCount=0; - g_current->initializer = yytext; + yyextra->lastInitializerContext=YY_START; + yyextra->initBracketCount=0; + yyextra->current->initializer = yytext; BEGIN(ReadInitializer); /* BEGIN(MemberSpecSkip); */ } /* "{" { - g_curlyCount=0; - g_lastCurlyContext = MemberSpecSkip; - g_previous = g_current; + yyextra->curlyCount=0; + yyextra->lastCurlyContext = MemberSpecSkip; + yyextra->previous = yyextra->current; BEGIN(SkipCurly); } */ "," { BEGIN(MemberSpec); } ";" { unput(';'); BEGIN(MemberSpec); } -{BN}{1,80} { g_current->program += yytext ; - lineCount() ; +{BN}{1,80} { yyextra->current->program += yytext ; + lineCount(yyscanner) ; } "@end"/[^a-z_A-Z0-9] { // end of Objective C block - g_current_root->moveToSubEntryAndRefresh( g_current ) ; - initEntry(); - g_language = g_current->lang = SrcLangExt_Cpp; // see bug746361 - g_insideObjC=FALSE; + yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ; + initEntry(yyscanner); + yyextra->language = yyextra->current->lang = SrcLangExt_Cpp; // see bug746361 + yyextra->insideObjC=FALSE; BEGIN( FindMembers ); } -. { g_current->program += yytext ; } +. { yyextra->current->program += yytext ; } "("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A::func_t)(args...) */ ("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */ - if (g_insidePHP) // reference parameter + if (yyextra->insidePHP) // reference parameter { REJECT } else { - g_current->bodyLine = g_yyLineNr; - lineCount(); - addType(); - g_funcPtrType=yytext; - g_roundCount=0; - //g_current->type += yytext; + yyextra->current->bodyLine = yyextra->yyLineNr; + lineCount(yyscanner); + addType(yyscanner); + yyextra->funcPtrType=yytext; + yyextra->roundCount=0; + //yyextra->current->type += yytext; BEGIN( FuncPtr ); } } {SCOPENAME} { - g_current->name = yytext; - if (nameIsOperator(g_current->name)) + yyextra->current->name = yytext; + if (nameIsOperator(yyextra->current->name)) { BEGIN( FuncPtrOperator ); } else { - if (g_current->name=="const" || g_current->name=="volatile") + if (yyextra->current->name=="const" || yyextra->current->name=="volatile") { - g_funcPtrType += g_current->name; + yyextra->funcPtrType += yyextra->current->name; } else { @@ -4272,213 +3972,213 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } . { - //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,g_yyLineNr,g_yyFileName); + //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,yyextra->yyLineNr,yyextra->yyFileName); } "("{BN}*")"{BN}*/"(" { - g_current->name += yytext; - g_current->name = g_current->name.simplifyWhiteSpace(); - lineCount(); + yyextra->current->name += yytext; + yyextra->current->name = yyextra->current->name.simplifyWhiteSpace(); + lineCount(yyscanner); } \n { - lineCount(); - g_current->name += *yytext; + lineCount(yyscanner); + yyextra->current->name += *yytext; } "(" { unput(*yytext); BEGIN( EndFuncPtr ); } . { - g_current->name += *yytext; + yyextra->current->name += *yytext; } ")"{BN}*/";" { // a variable with extra braces - lineCount(); - g_current->type+=g_funcPtrType.data()+1; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType.data()+1; BEGIN(FindMembers); } ")"{BN}*/"(" { // a function pointer - lineCount(); - g_current->type+=g_funcPtrType+")"; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType+")"; BEGIN(FindMembers); } ")"{BN}*/"[" { // an array of variables - lineCount(); - g_current->type+=g_funcPtrType.data(); - g_current->args += ")"; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType.data(); + yyextra->current->args += ")"; BEGIN(FindMembers); } "(" { // a function returning a function or // a function returning a pointer to an array - g_current->args += *yytext ; - //g_roundCount=0; + yyextra->current->args += *yytext ; + //yyextra->roundCount=0; //BEGIN( FuncFunc ); - g_current->bodyLine = g_yyLineNr; - g_currentArgumentContext = FuncFuncEnd; - g_fullArgString=g_current->args.copy(); - g_copyArgString=&g_current->args; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->currentArgumentContext = FuncFuncEnd; + yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; } "["[^\n\]]*"]" { - g_funcPtrType+=yytext; + yyextra->funcPtrType+=yytext; } ")" { BEGIN(FindMembers); } "(" { - g_current->args += *yytext ; - ++g_roundCount; + yyextra->current->args += *yytext ; + ++yyextra->roundCount; } ")" { - g_current->args += *yytext ; - if ( g_roundCount ) - --g_roundCount; + yyextra->current->args += *yytext ; + if ( yyextra->roundCount ) + --yyextra->roundCount; else { BEGIN(FuncFuncEnd); } } ")"{BN}*"(" { - lineCount(); - g_current->type+=g_funcPtrType+")("; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType+")("; BEGIN(FuncFuncType); } ")"{BN}*/[;{] { - lineCount(); - g_current->type+=g_funcPtrType.data()+1; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType.data()+1; BEGIN(Function); } ")"{BN}*/"[" { // function returning a pointer to an array - lineCount(); - g_current->type+=g_funcPtrType; - g_current->args+=")"; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType; + yyextra->current->args+=")"; BEGIN(FuncFuncArray); } . { - g_current->args += *yytext; + yyextra->current->args += *yytext; } "(" { - g_current->type += *yytext; - g_roundCount++; + yyextra->current->type += *yytext; + yyextra->roundCount++; } ")" { - g_current->type += *yytext; - if (g_roundCount) - --g_roundCount; + yyextra->current->type += *yytext; + if (yyextra->roundCount) + --yyextra->roundCount; else BEGIN(Function); } -{BN}*","{BN}* { lineCount() ; g_current->type += ", " ; } -{BN}+ { lineCount() ; g_current->type += ' ' ; } +{BN}*","{BN}* { lineCount(yyscanner) ; yyextra->current->type += ", " ; } +{BN}+ { lineCount(yyscanner) ; yyextra->current->type += ' ' ; } . { - g_current->type += *yytext; + yyextra->current->type += *yytext; } "("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")"{BN}*"(" { // for catching typedef void (__stdcall *f)() like definitions - if (g_current->type.left(7)=="typedef" && g_current->bodyLine==-1) + if (yyextra->current->type.left(7)=="typedef" && yyextra->current->bodyLine==-1) // the bodyLine check is to prevent this guard to be true more than once { - g_current->bodyLine = g_yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( GetCallType ); } - else if (!g_current->name.isEmpty()) // normal function + else if (!yyextra->current->name.isEmpty()) // normal function { - g_current->args = yytext; - g_current->bodyLine = g_yyLineNr; - g_currentArgumentContext = FuncQual; - g_fullArgString=g_current->args.copy(); - g_copyArgString=&g_current->args; + yyextra->current->args = yytext; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->currentArgumentContext = FuncQual; + yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; //printf(">>> Read function arguments!\n"); } } {BN}*{ID}{BN}*"*" { - lineCount(); - addType(); - g_funcPtrType="("; - g_funcPtrType+=yytext; - g_roundCount=0; + lineCount(yyscanner); + addType(yyscanner); + yyextra->funcPtrType="("; + yyextra->funcPtrType+=yytext; + yyextra->roundCount=0; BEGIN( FuncPtr ); } "(" { - if (!g_current->name.isEmpty()) + if (!yyextra->current->name.isEmpty()) { - g_current->args = yytext; - g_current->bodyLine = g_yyLineNr; - g_currentArgumentContext = FuncQual; - g_fullArgString=g_current->args.copy(); - g_copyArgString=&g_current->args; + yyextra->current->args = yytext; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->currentArgumentContext = FuncQual; + yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; - //printf(">>> Read function arguments g_current->argList.size()=%d\n",g_current->argList.size()); + //printf(">>> Read function arguments yyextra->current->argList.size()=%d\n",yyextra->current->argList.size()); } } /* "("{BN}*("void"{BN}*)?")" { - lineCount(); - g_current->args = "()"; + lineCount(yyscanner); + yyextra->current->args = "()"; BEGIN( FuncQual ); } */ /*- Function argument reading rules ---------------------------------------*/ -[^ \/\r\t\n\)\(\"\'#]+ { *g_copyArgString+=yytext; - g_fullArgString+=yytext; +[^ \/\r\t\n\)\(\"\'#]+ { *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } -[^\n\\\"\']+ { *g_copyArgString+=yytext; - g_fullArgString+=yytext; +[^\n\\\"\']+ { *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } [^\/\n\)\(\"\']+ { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } {BN}* { - *g_copyArgString+=" "; - g_fullArgString+=" "; - lineCount(); + *yyextra->copyArgString+=" "; + yyextra->fullArgString+=" "; + lineCount(yyscanner); } {RAWBEGIN} { - g_delimiter = yytext+2; - g_delimiter=g_delimiter.left(g_delimiter.length()-1); - g_lastRawStringContext = YY_START; - g_pCopyRawString = g_copyArgString; - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; + yyextra->delimiter = yytext+2; + yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); + yyextra->lastRawStringContext = YY_START; + yyextra->pCopyRawString = yyextra->copyArgString; + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; BEGIN(RawString); } \" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_lastCopyArgStringContext = YY_START; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->lastCopyArgStringContext = YY_START; BEGIN( CopyArgString ); } "(" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_argRoundCount=0; - g_lastCopyArgContext = YY_START; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->argRoundCount=0; + yyextra->lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } ")" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - stringToArgumentList(g_fullArgString,g_current->argList); - if (g_insideJS) + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + stringToArgumentList(yyextra->fullArgString,yyextra->current->argList); + if (yyextra->insideJS) { - fixArgumentListForJavaScript(g_current->argList); + fixArgumentListForJavaScript(yyextra->current->argList); } - handleParametersCommentBlocks(g_current->argList); + handleParametersCommentBlocks(yyscanner,yyextra->current->argList); - /* remember the g_current documentation block, since + /* remember the yyextra->current documentation block, since we could overwrite it with the documentation of a function argument, which we then have to correct later on */ - g_docBackup = g_current->doc; - g_briefBackup = g_current->brief; + yyextra->docBackup = yyextra->current->doc; + yyextra->briefBackup = yyextra->current->brief; - BEGIN( g_currentArgumentContext ); + BEGIN( yyextra->currentArgumentContext ); } /* a special comment */ ("/*"[*!]|"//"[/!])("<"?) { - if (g_currentArgumentContext==DefineEnd) + if (yyextra->currentArgumentContext==DefineEnd) { // for defines we interpret a comment // as documentation for the define @@ -4486,17 +4186,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { unput(yytext[i]); } - stringToArgumentList(g_fullArgString,g_current->argList); - handleParametersCommentBlocks(g_current->argList); - BEGIN( g_currentArgumentContext ); + stringToArgumentList(yyextra->fullArgString,yyextra->current->argList); + handleParametersCommentBlocks(yyscanner,yyextra->current->argList); + BEGIN( yyextra->currentArgumentContext ); } else // not a define { // for functions we interpret a comment // as documentation for the argument - g_fullArgString+=yytext; - g_lastCopyArgChar=0; - g_lastCommentInArgContext=YY_START; + yyextra->fullArgString+=yytext; + yyextra->lastCopyArgChar=0; + yyextra->lastCommentInArgContext=YY_START; if (yytext[1]=='/') BEGIN( CopyArgCommentLine ); else @@ -4506,30 +4206,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /* a non-special comment */ "/**/" { /* empty comment */ } "/*" { - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN( SkipComment ); } "//" { - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN( SkipCxxComment ); } /* -"'#" { if (g_insidePHP) +"'#" { if (yyextra->insidePHP) REJECT; - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } "#" { - if (!g_insidePHP) + if (!yyextra->insidePHP) REJECT; - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN( SkipCxxComment ); } */ /* ')' followed by a special comment */ ")"{BN}*("/*"[*!]|"//"[/!])"<" { - lineCount(); - if (g_currentArgumentContext==DefineEnd) + lineCount(yyscanner); + if (yyextra->currentArgumentContext==DefineEnd) { // for defines we interpret a comment // as documentation for the define @@ -4537,21 +4237,21 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { unput(yytext[i]); } - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - stringToArgumentList(g_fullArgString,g_current->argList); - handleParametersCommentBlocks(g_current->argList); - BEGIN( g_currentArgumentContext ); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + stringToArgumentList(yyextra->fullArgString,yyextra->current->argList); + handleParametersCommentBlocks(yyscanner,yyextra->current->argList); + BEGIN( yyextra->currentArgumentContext ); } else { // for functions we interpret a comment - // as documentation for the g_last argument - g_lastCopyArgChar=*yytext; + // as documentation for the yyextra->last argument + yyextra->lastCopyArgChar=*yytext; QCString text=&yytext[1]; text=text.stripWhiteSpace(); - g_lastCommentInArgContext=YY_START; - g_fullArgString+=text; + yyextra->lastCommentInArgContext=YY_START; + yyextra->fullArgString+=text; if (text.find("//")!=-1) BEGIN( CopyArgCommentLine ); else @@ -4559,152 +4259,152 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ^{B}*"*"+/{BN}+ -[^\n\\\@\*]+ { g_fullArgString+=yytext; } -"*/" { g_fullArgString+=yytext; - if (g_lastCopyArgChar!=0) - unput(g_lastCopyArgChar); - BEGIN( g_lastCommentInArgContext ); - } -\n { g_fullArgString+=yytext; - lineCount(); - if (g_lastCopyArgChar!=0) - unput(g_lastCopyArgChar); - BEGIN( g_lastCommentInArgContext ); +[^\n\\\@\*]+ { yyextra->fullArgString+=yytext; } +"*/" { yyextra->fullArgString+=yytext; + if (yyextra->lastCopyArgChar!=0) + unput(yyextra->lastCopyArgChar); + BEGIN( yyextra->lastCommentInArgContext ); + } +\n { yyextra->fullArgString+=yytext; + lineCount(yyscanner); + if (yyextra->lastCopyArgChar!=0) + unput(yyextra->lastCopyArgChar); + BEGIN( yyextra->lastCommentInArgContext ); } {CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) - g_docBlockName=&yytext[1]; - g_fullArgString+=yytext; + yyextra->docBlockName=&yytext[1]; + yyextra->fullArgString+=yytext; BEGIN(CopyArgVerbatim); } {CMD}("f$"|"f["|"f{") { - g_docBlockName=&yytext[1]; - if (g_docBlockName.at(1)=='[') + yyextra->docBlockName=&yytext[1]; + if (yyextra->docBlockName.at(1)=='[') { - g_docBlockName.at(1)='}'; + yyextra->docBlockName.at(1)='}'; } - if (g_docBlockName.at(1)=='{') + if (yyextra->docBlockName.at(1)=='{') { - g_docBlockName.at(1)='}'; + yyextra->docBlockName.at(1)='}'; } - g_fullArgString+=yytext; + yyextra->fullArgString+=yytext; BEGIN(CopyArgVerbatim); } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9\-] { // end of verbatim block - g_fullArgString+=yytext; + yyextra->fullArgString+=yytext; if (yytext[1]=='f') // end of formula { BEGIN(CopyArgCommentLine); } - if (&yytext[4]==g_docBlockName) + if (&yytext[4]==yyextra->docBlockName) { BEGIN(CopyArgCommentLine); } } -[^\\\@\n]+ { g_fullArgString+=yytext; } -. { g_fullArgString+=*yytext; } -\n { g_fullArgString+=*yytext; lineCount(); } -. { g_fullArgString+=*yytext; } +[^\\\@\n]+ { yyextra->fullArgString+=yytext; } +. { yyextra->fullArgString+=*yytext; } +\n { yyextra->fullArgString+=*yytext; lineCount(yyscanner); } +. { yyextra->fullArgString+=*yytext; } {CMD}("brief"|"short"){B}+ { - warn(g_yyFileName,g_yyLineNr, - "Ignoring %cbrief command g_inside argument documentation",*yytext + warn(yyextra->yyFileName,yyextra->yyLineNr, + "Ignoring %cbrief command yyextra->inside argument documentation",*yytext ); - g_fullArgString+=' '; + yyextra->fullArgString+=' '; } "<" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_argSharpCount=1; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->argSharpCount=1; BEGIN( CopyArgSharp ); } ">" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - //printf("end template list '%s'\n",g_copyArgString->data()); - stringToArgumentList(g_fullArgString,*g_currentArgumentList); - BEGIN( g_currentArgumentContext ); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + //printf("end template list '%s'\n",yyextra->copyArgString->data()); + stringToArgumentList(yyextra->fullArgString,*yyextra->currentArgumentList); + BEGIN( yyextra->currentArgumentContext ); } "(" { - g_argRoundCount++; - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + yyextra->argRoundCount++; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } ")" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - if (g_argRoundCount>0) - g_argRoundCount--; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + if (yyextra->argRoundCount>0) + yyextra->argRoundCount--; else - BEGIN( g_lastCopyArgContext ); + BEGIN( yyextra->lastCopyArgContext ); } "(" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_argRoundCount=0; - g_lastCopyArgContext = YY_START; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->argRoundCount=0; + yyextra->lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } "<" { - g_argSharpCount++; - //printf("g_argSharpCount++=%d copy\n",g_argSharpCount); - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + yyextra->argSharpCount++; + //printf("yyextra->argSharpCount++=%d copy\n",yyextra->argSharpCount); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } ">" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_argSharpCount--; - if (g_argSharpCount>0) + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->argSharpCount--; + if (yyextra->argSharpCount>0) { - //printf("g_argSharpCount--=%d copy\n",g_argSharpCount); + //printf("yyextra->argSharpCount--=%d copy\n",yyextra->argSharpCount); } else { BEGIN( ReadTempArgs ); - //printf("end of g_argSharpCount\n"); + //printf("end of yyextra->argSharpCount\n"); } } \\. { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } \" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - BEGIN( g_lastCopyArgStringContext ); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + BEGIN( yyextra->lastCopyArgStringContext ); } \' { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - BEGIN( g_lastCopyArgStringContext ); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + BEGIN( yyextra->lastCopyArgStringContext ); } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } } \' { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; - if (g_insidePHP) + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; + if (yyextra->insidePHP) { - g_lastCopyArgStringContext=YY_START; + yyextra->lastCopyArgStringContext=YY_START; BEGIN(CopyArgPHPString); } } \n { - lineCount(); - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + lineCount(yyscanner); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } . { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } @@ -4712,29 +4412,29 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /*------------------------------------------------------------------------*/ -"(" { g_current->args += *yytext ; - ++g_roundCount ; +"(" { yyextra->current->args += *yytext ; + ++yyextra->roundCount ; } -")" { g_current->args += *yytext ; - if ( g_roundCount ) - --g_roundCount ; +")" { yyextra->current->args += *yytext ; + if ( yyextra->roundCount ) + --yyextra->roundCount ; else BEGIN( FuncQual ) ; } /* -"#" { if (g_insidePHP) +"#" { if (yyextra->insidePHP) REJECT; - g_lastCPPContext = YY_START; + yyextra->lastCPPContext = YY_START; BEGIN(SkipCPP); } */ [{:;,] { if ( qstrcmp(yytext,";")==0 && - g_insidePHP && - !containsWord(g_current->type,"function") ) + yyextra->insidePHP && + !containsWord(yyextra->current->type,"function") ) { - g_current->reset(); - initEntry(); + yyextra->current->reset(); + initEntry(yyscanner); BEGIN( FindMembers ); } else @@ -4743,89 +4443,89 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {BN}*"abstract"{BN}* { // pure virtual member function - lineCount() ; - g_current->virt = Pure; - g_current->args += " override "; + lineCount(yyscanner) ; + yyextra->current->virt = Pure; + yyextra->current->args += " override "; } {BN}*"override"{BN}* { // C++11 overridden virtual member function - lineCount() ; - g_current->spec |= Entry::Override; - g_current->args += " override "; + lineCount(yyscanner) ; + yyextra->current->spec |= Entry::Override; + yyextra->current->args += " override "; BEGIN(FuncQual); } {BN}*"final"{BN}* { // C++11 final method - lineCount() ; - g_current->spec |= Entry::Final; - g_current->args += " final "; + lineCount(yyscanner) ; + yyextra->current->spec |= Entry::Final; + yyextra->current->args += " final "; BEGIN(FuncQual); } {BN}*"sealed"{BN}* { // sealed member function - lineCount() ; - g_current->spec |= Entry::Sealed; - g_current->args += " sealed "; + lineCount(yyscanner) ; + yyextra->current->spec |= Entry::Sealed; + yyextra->current->args += " sealed "; } {BN}*"new"{BN}* { // new member function - lineCount() ; - g_current->spec |= Entry::New; - g_current->args += " new "; + lineCount(yyscanner) ; + yyextra->current->spec |= Entry::New; + yyextra->current->args += " new "; } {BN}*"const"{BN}* { // const member function - lineCount() ; - g_current->args += " const "; - g_current->argList.constSpecifier=TRUE; + lineCount(yyscanner) ; + yyextra->current->args += " const "; + yyextra->current->argList.constSpecifier=TRUE; } {BN}*"volatile"{BN}* { // volatile member function - lineCount() ; - g_current->args += " volatile "; - g_current->argList.volatileSpecifier=TRUE; + lineCount(yyscanner) ; + yyextra->current->args += " volatile "; + yyextra->current->argList.volatileSpecifier=TRUE; } {BN}*"noexcept"{BN}* { // noexcept qualifier - lineCount() ; - g_current->args += " noexcept "; - g_current->spec |= Entry::NoExcept; + lineCount(yyscanner) ; + yyextra->current->args += " noexcept "; + yyextra->current->spec |= Entry::NoExcept; } {BN}*"noexcept"{BN}*"(" { // noexcept expression - lineCount() ; - g_current->args += " noexcept("; - g_current->spec |= Entry::NoExcept; - g_lastRoundContext=FuncQual; - g_pCopyRoundString=&g_current->args; - g_roundCount=0; + lineCount(yyscanner) ; + yyextra->current->args += " noexcept("; + yyextra->current->spec |= Entry::NoExcept; + yyextra->lastRoundContext=FuncQual; + yyextra->pCopyRoundString=&yyextra->current->args; + yyextra->roundCount=0; BEGIN(CopyRound); } {BN}*"&" { - g_current->args += " &"; - g_current->argList.refQualifier=RefQualifierLValue; + yyextra->current->args += " &"; + yyextra->current->argList.refQualifier=RefQualifierLValue; } {BN}*"&&" { - g_current->args += " &&"; - g_current->argList.refQualifier=RefQualifierRValue; + yyextra->current->args += " &&"; + yyextra->current->argList.refQualifier=RefQualifierRValue; } {BN}*"="{BN}*"0"{BN}* { // pure virtual member function - lineCount() ; - g_current->args += " = 0"; - g_current->virt = Pure; - g_current->argList.pureSpecifier=TRUE; + lineCount(yyscanner) ; + yyextra->current->args += " = 0"; + yyextra->current->virt = Pure; + yyextra->current->argList.pureSpecifier=TRUE; BEGIN(FuncQual); } {BN}*"="{BN}*"delete"{BN}* { // C++11 explicitly delete member - lineCount(); - g_current->args += " = delete"; - g_current->spec |= Entry::Delete; - g_current->argList.isDeleted=TRUE; + lineCount(yyscanner); + yyextra->current->args += " = delete"; + yyextra->current->spec |= Entry::Delete; + yyextra->current->argList.isDeleted=TRUE; BEGIN(FuncQual); } {BN}*"="{BN}*"default"{BN}* { // C++11 explicitly defaulted constructor/assignment operator - lineCount(); - g_current->args += " = default"; - g_current->spec |= Entry::Default; + lineCount(yyscanner); + yyextra->current->args += " = default"; + yyextra->current->spec |= Entry::Default; BEGIN(FuncQual); } {BN}*"->"{BN}* { - lineCount(); - g_current->argList.trailingReturnType = " -> "; - g_current->args += " -> "; + lineCount(yyscanner); + yyextra->current->argList.trailingReturnType = " -> "; + yyextra->current->args += " -> "; BEGIN(TrailingReturn); } [{;] { @@ -4833,30 +4533,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } . { - g_current->argList.trailingReturnType+=yytext; - g_current->args+=yytext; + yyextra->current->argList.trailingReturnType+=yytext; + yyextra->current->args+=yytext; } \n { - lineCount(); - g_current->argList.trailingReturnType+=yytext; - g_current->args+=' '; + lineCount(yyscanner); + yyextra->current->argList.trailingReturnType+=yytext; + yyextra->current->args+=' '; } {BN}*","{BN}* { - lineCount() ; - g_current->args += ", " ; + lineCount(yyscanner) ; + yyextra->current->args += ", " ; } {BN}+ { - lineCount() ; - g_current->args += ' ' ; + lineCount(yyscanner) ; + yyextra->current->args += ' ' ; } -"#" { if (g_insidePHP) +"#" { if (yyextra->insidePHP) REJECT; - g_lastCPPContext = YY_START; + yyextra->lastCPPContext = YY_START; BEGIN(SkipCPP); } "=" { - if (g_insideCli && - (g_current_root->section&Entry::COMPOUND_MASK) + if (yyextra->insideCli && + (yyextra->current_root->section&Entry::COMPOUND_MASK) ) { BEGIN(CliOverride); @@ -4864,9 +4564,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { // typically an initialized function pointer - g_lastInitializerContext=YY_START; - g_initBracketCount=0; - g_current->initializer = yytext; + yyextra->lastInitializerContext=YY_START; + yyextra->initBracketCount=0; + yyextra->current->initializer = yytext; BEGIN(ReadInitializer); } } @@ -4877,7 +4577,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } \n { - lineCount(); + lineCount(yyscanner); } . { } @@ -4886,96 +4586,96 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } \" { - g_current->args += *yytext; - g_pCopyQuotedString=&g_current->args; - g_lastStringContext=FuncPtrInit; + yyextra->current->args += *yytext; + yyextra->pCopyQuotedString=&yyextra->current->args; + yyextra->lastStringContext=FuncPtrInit; BEGIN(CopyString); } \' { - g_current->args += *yytext; - if (g_insidePHP) + yyextra->current->args += *yytext; + if (yyextra->insidePHP) { - g_pCopyQuotedString=&g_current->args; - g_lastStringContext=FuncPtrInit; + yyextra->pCopyQuotedString=&yyextra->current->args; + yyextra->lastStringContext=FuncPtrInit; BEGIN(CopyPHPString); } } {CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - g_current->args += yytext; + yyextra->current->args += yytext; } } {ID} { - g_current->args += yytext; + yyextra->current->args += yytext; } . { - g_current->args += *yytext; + yyextra->current->args += *yytext; } \n { - g_current->args += *yytext; - lineCount(); + yyextra->current->args += *yytext; + lineCount(yyscanner); } {ID} { // typically a K&R style C function - if (g_insideCS && qstrcmp(yytext,"where")==0) + if (yyextra->insideCS && qstrcmp(yytext,"where")==0) { // type constraint for a method - g_current->typeConstr.clear(); - g_current->typeConstr.push_back(Argument()); - g_lastCSConstraint = YY_START; + yyextra->current->typeConstr.clear(); + yyextra->current->typeConstr.push_back(Argument()); + yyextra->lastCSConstraint = YY_START; BEGIN( CSConstraintName ); } - else if (checkForKnRstyleC()) + else if (checkForKnRstyleC(yyscanner)) { - g_current->args = yytext; - g_oldStyleArgType.resize(0); + yyextra->current->args = yytext; + yyextra->oldStyleArgType.resize(0); BEGIN(OldStyleArgs); } else { - g_current->args += yytext; + yyextra->current->args += yytext; } } [,;] { QCString oldStyleArgPtr; QCString oldStyleArgName; - splitKnRArg(oldStyleArgPtr,oldStyleArgName); + splitKnRArg(yyscanner,oldStyleArgPtr,oldStyleArgName); QCString doc,brief; - if (g_current->doc!=g_docBackup) + if (yyextra->current->doc!=yyextra->docBackup) { - doc=g_current->doc.copy(); - g_current->doc=g_docBackup; + doc=yyextra->current->doc.copy(); + yyextra->current->doc=yyextra->docBackup; } - if (g_current->brief!=g_briefBackup) + if (yyextra->current->brief!=yyextra->briefBackup) { - brief=g_current->brief.copy(); - g_current->brief=g_briefBackup; + brief=yyextra->current->brief.copy(); + yyextra->current->brief=yyextra->briefBackup; } - addKnRArgInfo(g_oldStyleArgType+oldStyleArgPtr, + addKnRArgInfo(yyscanner,yyextra->oldStyleArgType+oldStyleArgPtr, oldStyleArgName,brief,doc); - g_current->args.resize(0); - if (*yytext==';') g_oldStyleArgType.resize(0); + yyextra->current->args.resize(0); + if (*yytext==';') yyextra->oldStyleArgType.resize(0); } -{ID} { g_current->args += yytext; } +{ID} { yyextra->current->args += yytext; } "{" { - if (g_current->argList.empty()) + if (yyextra->current->argList.empty()) { - g_current->argList.noParameters=TRUE; + yyextra->current->argList.noParameters=TRUE; } - g_current->args = argListToString(g_current->argList); + yyextra->current->args = argListToString(yyextra->current->argList); unput('{'); BEGIN(FuncQual); } -. { g_current->args += *yytext; } -. { g_current->args += *yytext; } +. { yyextra->current->args += *yytext; } +. { yyextra->current->args += *yytext; } {BN}*"try:" | {BN}*"try"{BN}+ { /* try-function-block */ - g_insideTryBlock=TRUE; - lineCount(); + yyextra->insideTryBlock=TRUE; + lineCount(yyscanner); if (yytext[yyleng-1]==':') { unput(':'); @@ -4983,33 +4683,33 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {BN}*"throw"{BN}*"(" { // C++ style throw clause - g_current->exception = " throw (" ; - g_roundCount=0; - lineCount() ; + yyextra->current->exception = " throw (" ; + yyextra->roundCount=0; + lineCount(yyscanner) ; BEGIN( ExcpRound ) ; } {BN}*"raises"{BN}*"(" { - g_current->exception = " raises (" ; - lineCount() ; - g_roundCount=0; + yyextra->current->exception = " raises (" ; + lineCount(yyscanner) ; + yyextra->roundCount=0; BEGIN( ExcpRound ) ; } {BN}*"throws"{BN}+ { // Java style throw clause - g_current->exception = " throws " ; - lineCount() ; + yyextra->current->exception = " throws " ; + lineCount(yyscanner) ; BEGIN( ExcpList ); } -"(" { g_current->exception += *yytext ; - ++g_roundCount ; +"(" { yyextra->current->exception += *yytext ; + ++yyextra->roundCount ; } -")" { g_current->exception += *yytext ; - if ( g_roundCount ) - --g_roundCount ; +")" { yyextra->current->exception += *yytext ; + if ( yyextra->roundCount ) + --yyextra->roundCount ; else BEGIN( FuncQual ) ; } . { - g_current->exception += *yytext; + yyextra->current->exception += *yytext; } "{" { unput('{'); BEGIN( FuncQual ); @@ -5018,101 +4718,101 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); BEGIN( FuncQual ); } "\n" { - g_current->exception += ' '; - lineCount(); + yyextra->current->exception += ' '; + lineCount(yyscanner); } . { - g_current->exception += *yytext; + yyextra->current->exception += *yytext; } -"(" { g_current->type += g_current->name ; - g_current->name = g_current->args ; - g_current->args = yytext ; - g_roundCount=0; +"(" { yyextra->current->type += yyextra->current->name ; + yyextra->current->name = yyextra->current->args ; + yyextra->current->args = yytext ; + yyextra->roundCount=0; BEGIN( FuncRound ) ; } ":" { - if (!g_insidePHP) BEGIN(SkipInits); + if (!yyextra->insidePHP) BEGIN(SkipInits); } [;{,] { - g_current->name=g_current->name.simplifyWhiteSpace(); - g_current->type=g_current->type.simplifyWhiteSpace(); - g_current->args=removeRedundantWhiteSpace(g_current->args); - // was: g_current->args.simplifyWhiteSpace(); - g_current->fileName = g_yyFileName; - g_current->startLine = g_yyBegLineNr; - g_current->startColumn = g_yyBegColNr; + yyextra->current->name=yyextra->current->name.simplifyWhiteSpace(); + yyextra->current->type=yyextra->current->type.simplifyWhiteSpace(); + yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args); + // was: yyextra->current->args.simplifyWhiteSpace(); + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyBegLineNr; + yyextra->current->startColumn = yyextra->yyBegColNr; static QRegExp re("([^)]*[*&][^)]*)"); // (...*...) - if (*yytext!=';' || (g_current_root->section&Entry::COMPOUND_MASK) ) + if (*yytext!=';' || (yyextra->current_root->section&Entry::COMPOUND_MASK) ) { - int tempArg=g_current->name.find('<'); - int ts=g_current->type.find('<'); - int te=g_current->type.findRev('>'); - int ti=g_current->type.find(re,0); + int tempArg=yyextra->current->name.find('<'); + int ts=yyextra->current->type.find('<'); + int te=yyextra->current->type.findRev('>'); + int ti=yyextra->current->type.find(re,0); // bug677315: A get(); is not a function pointer bool isFunction = ti==-1 || // not a (...*...) pattern (ts!=-1 && tstype.data(),ts,te,ti,isFunction); + // yyextra->current->type.data(),ts,te,ti,isFunction); QCString tempName; - if (tempArg==-1) tempName=g_current->name; else tempName=g_current->name.left(tempArg); - if (!g_current->type.isEmpty() && - (!isFunction || g_current->type.left(8)=="typedef ")) + if (tempArg==-1) tempName=yyextra->current->name; else tempName=yyextra->current->name.left(tempArg); + if (!yyextra->current->type.isEmpty() && + (!isFunction || yyextra->current->type.left(8)=="typedef ")) { - //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", g_current->type.data(),g_current->name.data(),g_current->args.data()); - if (g_isTypedef && g_current->type.left(8)!="typedef ") + //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ") { - g_current->type.prepend("typedef "); + yyextra->current->type.prepend("typedef "); } - g_current->section = Entry::VARIABLE_SEC ; + yyextra->current->section = Entry::VARIABLE_SEC ; } else { - //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", g_current->type.data(),g_current->name.data(),g_current->args.data()); - g_current->section = Entry::FUNCTION_SEC ; - g_current->proto = *yytext==';'; + //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + yyextra->current->section = Entry::FUNCTION_SEC ; + yyextra->current->proto = *yytext==';'; } } else // a global function prototype or function variable { - //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",g_current->type.data(),g_current->name.data(),g_current->args.data()); - if (!g_current->type.isEmpty() && - (g_current->type.find(re,0)!=-1 || g_current->type.left(8)=="typedef ")) + //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + if (!yyextra->current->type.isEmpty() && + (yyextra->current->type.find(re,0)!=-1 || yyextra->current->type.left(8)=="typedef ")) { - if (g_isTypedef && g_current->type.left(8)!="typedef ") + if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ") { - g_current->type.prepend("typedef "); + yyextra->current->type.prepend("typedef "); } //printf("Scanner.l: found function variable!\n"); - g_current->section = Entry::VARIABLE_SEC; + yyextra->current->section = Entry::VARIABLE_SEC; } else { //printf("Scanner.l: found prototype\n"); - g_current->section = Entry::FUNCTION_SEC; - g_current->proto = TRUE; + yyextra->current->section = Entry::FUNCTION_SEC; + yyextra->current->proto = TRUE; } } - //printf("Adding entry '%s'\n",g_current->name.data()); - if ( g_insidePHP) + //printf("Adding entry '%s'\n",yyextra->current->name.data()); + if ( yyextra->insidePHP) { - if (findAndRemoveWord(g_current->type,"final")) + if (findAndRemoveWord(yyextra->current->type,"final")) { - g_current->spec |= Entry::Final; + yyextra->current->spec |= Entry::Final; } - if (findAndRemoveWord(g_current->type,"abstract")) + if (findAndRemoveWord(yyextra->current->type,"abstract")) { - g_current->spec |= Entry::Abstract; + yyextra->current->spec |= Entry::Abstract; } } - if ( g_insidePHP && !containsWord(g_current->type,"function")) + if ( yyextra->insidePHP && !containsWord(yyextra->current->type,"function")) { - initEntry(); + initEntry(yyscanner); if ( *yytext == '{' ) { - g_lastCurlyContext = FindMembers; - g_curlyCount=0; + yyextra->lastCurlyContext = FindMembers; + yyextra->curlyCount=0; BEGIN( SkipCurly ); } else @@ -5122,66 +4822,66 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - if ( g_insidePHP) + if ( yyextra->insidePHP) { - findAndRemoveWord(g_current->type,"function"); + findAndRemoveWord(yyextra->current->type,"function"); } - g_previous = g_current.get(); - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->previous = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); // Objective C 2.0: Required/Optional section - if (g_previous->spec & (Entry::Optional | Entry::Required)) + if (yyextra->previous->spec & (Entry::Optional | Entry::Required)) { - g_current->spec |= g_previous->spec & (Entry::Optional|Entry::Required); + yyextra->current->spec |= yyextra->previous->spec & (Entry::Optional|Entry::Required); } - g_lastCurlyContext = FindMembers; + yyextra->lastCurlyContext = FindMembers; if ( *yytext == ',' ) { - g_current->type = g_previous->type; + yyextra->current->type = yyextra->previous->type; // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases) - int i=g_current->type.length(); - while (i>0 && (g_current->type[i-1]=='*' || g_current->type[i-1]=='&' || g_current->type[i-1]==' ')) i--; - g_current->type = g_current->type.left(i); + int i=yyextra->current->type.length(); + while (i>0 && (yyextra->current->type[i-1]=='*' || yyextra->current->type[i-1]=='&' || yyextra->current->type[i-1]==' ')) i--; + yyextra->current->type = yyextra->current->type.left(i); } if ( *yytext == '{' ) { - if ( !g_insidePHP && (g_current_root->section & Entry::COMPOUND_MASK) ) + if ( !yyextra->insidePHP && (yyextra->current_root->section & Entry::COMPOUND_MASK) ) { - g_previous->spec |= Entry::Inline; + yyextra->previous->spec |= Entry::Inline; } //addToBody(yytext); - g_curlyCount=0; + yyextra->curlyCount=0; BEGIN( SkipCurly ) ; } else { - if (g_previous->section!=Entry::VARIABLE_SEC) - g_previous->bodyLine=-1; // a function/member declaration + if (yyextra->previous->section!=Entry::VARIABLE_SEC) + yyextra->previous->bodyLine=-1; // a function/member declaration BEGIN( FindMembers ) ; } } } ">"{BN}*"{" { // C++11 style initializer (see bug 790788) - lineCount(); - g_curlyCount=1; + lineCount(yyscanner); + yyextra->curlyCount=1; BEGIN(SkipC11Inits); } {ID}{BN}*"{" { // C++11 style initializer (see bug 688647) - lineCount(); - g_curlyCount=1; + lineCount(yyscanner); + yyextra->curlyCount=1; BEGIN(SkipC11Inits); } "{" { - ++g_curlyCount; + ++yyextra->curlyCount; } "}" { - if ( --g_curlyCount<=0 ) + if ( --yyextra->curlyCount<=0 ) { BEGIN(SkipInits); } } "]]" { - BEGIN(g_lastC11AttributeContext); + BEGIN(yyextra->lastC11AttributeContext); } "{" { // C++11 style initializer unput('{'); @@ -5189,197 +4889,197 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } "{" { //addToBody(yytext); - ++g_curlyCount ; + ++yyextra->curlyCount ; } "}"/{BN}*("/*!"|"/**"|"//!"|"///")" Inner block starts at line %d objC=%d\n",g_yyLineNr,g_insideObjC); - g_current = std::make_unique(); - g_stat = FALSE; - initEntry(); + yyextra->yyLineNr = ce->startLine ; + yyextra->yyColNr = ce->startColumn ; + yyextra->insideObjC = ce->lang==SrcLangExt_ObjC; + //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC); + yyextra->current = std::make_unique(); + yyextra->stat = FALSE; + initEntry(yyscanner); // deep copy group list from parent (see bug 727732) bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS); @@ -7070,99 +7097,102 @@ static void parseCompounds(const std::unique_ptr &rt) // set default protection based on the compound type if( ce->section==Entry::CLASS_SEC ) // class { - if (g_insidePHP || g_insideD || g_insideJS || g_insideIDL || g_insideSlice) + if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice) { - g_current->protection = g_protection = Public ; + yyextra->current->protection = yyextra->protection = Public ; } - else if (g_insideJava) + else if (yyextra->insideJava) { - g_current->protection = g_protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; + yyextra->current->protection = yyextra->protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; } else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union)) { if (ce->lang==SrcLangExt_ObjC) { - g_current->protection = g_protection = Protected ; + yyextra->current->protection = yyextra->protection = Protected ; } else { - g_current->protection = g_protection = Public ; + yyextra->current->protection = yyextra->protection = Public ; } } else { - g_current->protection = g_protection = Private ; + yyextra->current->protection = yyextra->protection = Private ; } } else if (ce->section == Entry::ENUM_SEC ) // enum { - g_current->protection = g_protection = ce->protection; + yyextra->current->protection = yyextra->protection = ce->protection; } else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace { if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace { - g_current->stat = g_stat = TRUE; + yyextra->current->stat = yyextra->stat = TRUE; } - g_current->protection = g_protection = ce->protection; + yyextra->current->protection = yyextra->protection = ce->protection; } else // named struct, union, protocol, category { - g_current->protection = g_protection = Public ; + yyextra->current->protection = yyextra->protection = Public ; } - g_mtype = Method; - g_virt = Normal; - //printf("name=%s g_current->stat=%d g_stat=%d\n",ce->name.data(),g_current->stat,g_stat); + yyextra->mtype = Method; + yyextra->virt = Normal; + //printf("name=%s yyextra->current->stat=%d yyextra->stat=%d\n",ce->name.data(),yyextra->current->stat,yyextra->stat); //memberGroupId = DOX_NOGROUP; //memberGroupRelates.resize(0); //memberGroupInside.resize(0); QCString name = ce->name; - Doxygen::docGroup.enterCompound(g_yyFileName,g_yyLineNr,name); + Doxygen::docGroup.enterCompound(yyextra->yyFileName,yyextra->yyLineNr,name); - scannerYYlex() ; - g_lexInit=TRUE; + scannerYYlex(yyscanner); + yyextra->lexInit=TRUE; //forceEndGroup(); - Doxygen::docGroup.leaveCompound(g_yyFileName,g_yyLineNr,name); + Doxygen::docGroup.leaveCompound(yyextra->yyFileName,yyextra->yyLineNr,name); ce->program.resize(0); //if (depthIf>0) //{ - // warn(g_yyFileName,g_yyLineNr,"Documentation block ended in the middle of a conditional section!"); + // warn(yyextra->yyFileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!"); //} } - parseCompounds(ce); + parseCompounds(yyscanner,ce); } } //---------------------------------------------------------------------------- -static void parseMain(const char *fileName, +static void parseMain(yyscan_t yyscanner, + const char *fileName, const char *fileBuf, const std::unique_ptr &rt, bool sameTranslationUnit, QStrList & filesInSameTranslationUnit) { - initParser(); + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + initParser(yyscanner); - g_inputString = fileBuf; - g_inputPosition = 0; - g_column = 0; + yyextra->inputString = fileBuf; + yyextra->inputPosition = 0; + yyextra->column = 0; + scannerYYrestart(0,yyscanner); - //g_anonCount = 0; // don't reset per file + //yyextra->anonCount = 0; // don't reset per file //depthIf = 0; - g_protection = Public; - g_mtype = Method; - g_stat = FALSE; - g_virt = Normal; - g_current_root = rt.get(); - g_yyLineNr= 1 ; - g_yyFileName = fileName; - setContext(); - bool processWithClang = g_insideCpp || g_insideObjC; + yyextra->protection = Public; + yyextra->mtype = Method; + yyextra->stat = FALSE; + yyextra->virt = Normal; + yyextra->current_root = rt.get(); + yyextra->yyLineNr= 1 ; + yyextra->yyFileName = fileName; + setContext(yyscanner); + bool processWithClang = yyextra->insideCpp || yyextra->insideObjC; if (processWithClang) { if (!sameTranslationUnit) // new file @@ -7174,25 +7204,24 @@ static void parseMain(const char *fileName, ClangParser::instance()->switchToFile(fileName); } } - rt->lang = g_language; - msg("Parsing file %s...\n",g_yyFileName.data()); - - g_current_root = rt.get() ; - initParser(); - Doxygen::docGroup.enterFile(g_yyFileName,g_yyLineNr); - g_current = std::make_unique(); - //printf("g_current=%p g_current_root=%p\n",g_current,g_current_root); - int sec=guessSection(g_yyFileName); + rt->lang = yyextra->language; + msg("Parsing file %s...\n",yyextra->yyFileName.data()); + + yyextra->current_root = rt.get() ; + initParser(yyscanner); + Doxygen::docGroup.enterFile(yyextra->yyFileName,yyextra->yyLineNr); + yyextra->current = std::make_unique(); + //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root); + int sec=guessSection(yyextra->yyFileName); if (sec) { - g_current->name = g_yyFileName; - g_current->section = sec; - g_current_root->moveToSubEntryAndRefresh(g_current); + yyextra->current->name = yyextra->yyFileName; + yyextra->current->section = sec; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); } - g_current->reset(); - initEntry(); - scannerYYrestart( scannerYYin ); - if ( g_insidePHP ) + yyextra->current->reset(); + initEntry(yyscanner); + if ( yyextra->insidePHP ) { BEGIN( FindMembersPHP ); } @@ -7201,44 +7230,45 @@ static void parseMain(const char *fileName, BEGIN( FindMembers ); } - scannerYYlex(); - g_lexInit=TRUE; + scannerYYlex(yyscanner); + yyextra->lexInit=TRUE; if (YY_START==Comment) { - warn(g_yyFileName,g_yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); + warn(yyextra->yyFileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); } //forceEndGroup(); - Doxygen::docGroup.leaveFile(g_yyFileName,g_yyLineNr); + Doxygen::docGroup.leaveFile(yyextra->yyFileName,yyextra->yyLineNr); rt->program.resize(0); - parseCompounds(rt); + parseCompounds(yyscanner,rt); - g_anonNSCount++; + yyextra->anonNSCount++; // add additional entries that were created during processing - for (auto &kv: g_outerScopeEntries) + for (auto &kv: yyextra->outerScopeEntries) { //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); kv.first->moveToSubEntryAndKeep(kv.second); } - g_outerScopeEntries.clear(); + yyextra->outerScopeEntries.clear(); } //---------------------------------------------------------------------------- -static void parsePrototype(const QCString &text) +static void parsePrototype(yyscan_t yyscanner,const QCString &text) { + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("**** parsePrototype(%s) begin\n",text.data()); if (text.isEmpty()) { - warn(g_yyFileName,g_yyLineNr,"Empty prototype found!"); + warn(yyextra->yyFileName,yyextra->yyLineNr,"Empty prototype found!"); return; } - if (!g_current) // nothing to store (see bug683516) + if (!yyextra->current) // nothing to store (see bug683516) { return; } @@ -7249,44 +7279,34 @@ static void parsePrototype(const QCString &text) // save scanner state orgState = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(scannerYYin, YY_BUF_SIZE)); - orgInputString = g_inputString; - orgInputPosition = g_inputPosition; + yy_switch_to_buffer(yy_create_buffer(0, YY_BUF_SIZE, yyscanner), yyscanner); + orgInputString = yyextra->inputString; + orgInputPosition = yyextra->inputPosition; // set new string - g_inputString = text; - g_inputPosition = 0; - g_column = 0; - scannerYYrestart( scannerYYin ); + yyextra->inputString = text; + yyextra->inputPosition = 0; + yyextra->column = 0; + scannerYYrestart(0, yyscanner); BEGIN(Prototype); - scannerYYlex(); - g_lexInit=TRUE; + scannerYYlex(yyscanner); + yyextra->lexInit=TRUE; - g_current->name = g_current->name.stripWhiteSpace(); - if (g_current->section == Entry::MEMBERDOC_SEC && g_current->args.isEmpty()) - g_current->section = Entry::VARIABLEDOC_SEC; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); + if (yyextra->current->section == Entry::MEMBERDOC_SEC && yyextra->current->args.isEmpty()) + yyextra->current->section = Entry::VARIABLEDOC_SEC; // restore original scanner state YY_BUFFER_STATE tmpState = YY_CURRENT_BUFFER; - yy_switch_to_buffer(orgState); - yy_delete_buffer(tmpState); - g_inputString = orgInputString; - g_inputPosition = orgInputPosition; + yy_switch_to_buffer(orgState, yyscanner); + yy_delete_buffer(tmpState, yyscanner); + yyextra->inputString = orgInputString; + yyextra->inputPosition = orgInputPosition; //printf("**** parsePrototype end\n"); } -void scanFreeScanner() -{ -#if defined(YY_FLEX_SUBMINOR_VERSION) - if (g_lexInit) - { - scannerYYlex_destroy(); - } -#endif -} - //static void handleGroupStartCommand(const char *header) //{ // memberGroupHeader=header; @@ -7301,13 +7321,32 @@ void scanFreeScanner() //---------------------------------------------------------------------------- +struct CLanguageScanner::Private +{ + yyscan_t yyscanner; + scannerYY_state state; +}; + +CLanguageScanner::CLanguageScanner() +{ + p = new Private; + scannerYYlex_init_extra(&p->state,&p->yyscanner); +} + +CLanguageScanner::~CLanguageScanner() +{ + scannerYYlex_destroy(p->yyscanner); + delete p; +} + void CLanguageScanner::startTranslationUnit(const char *) { } void CLanguageScanner::finishTranslationUnit() { - bool processWithClang = g_insideCpp || g_insideObjC; + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + bool processWithClang = yyextra->insideCpp || yyextra->insideObjC; if (processWithClang) { ClangParser::instance()->finish(); @@ -7320,11 +7359,12 @@ void CLanguageScanner::parseInput(const char *fileName, bool sameTranslationUnit, QStrList & filesInSameTranslationUnit) { - g_thisParser = this; + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + yyextra->thisParser = this; printlex(yy_flex_debug, TRUE, __FILE__, fileName); - ::parseMain(fileName,fileBuf,root, + ::parseMain(p->yyscanner, fileName,fileBuf,root, sameTranslationUnit,filesInSameTranslationUnit); printlex(yy_flex_debug, FALSE, __FILE__, fileName); @@ -7347,7 +7387,8 @@ void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, bool collectXRefs ) { - g_codeScanner.parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + yyextra->codeScanner.parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef, showLineNumbers,searchCtx,collectXRefs); } @@ -7364,12 +7405,13 @@ bool CLanguageScanner::needsPreprocessing(const QCString &extension) const void CLanguageScanner::resetCodeParserState() { - g_codeScanner.reset(); + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + yyextra->codeScanner.reset(); } void CLanguageScanner::parsePrototype(const char *text) { - ::parsePrototype(text); + ::parsePrototype(p->yyscanner,text); } //---------------------------------------------------------------------------- -- cgit v0.12