diff options
Diffstat (limited to 'src/scanner.l')
-rw-r--r-- | src/scanner.l | 6700 |
1 files changed, 3371 insertions, 3329 deletions
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<Entry> g_current; -static Entry* g_current_root = 0 ; -static Entry* g_previous = 0 ; -static std::unique_ptr<Entry> 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<Grouping> 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<Entry*,std::unique_ptr<Entry> > > 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 (i<si && ((c=g_current->args.at(i))=='*' || isspace((uchar)c))) i++; - g_oldStyleArgType += g_current->args.mid(s,i-s); - s=i; - while (i<si && isId(g_current->args.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 (i<si && ((c=g_current->args.at(i))=='*' || isspace((uchar)c))) i++; - g_oldStyleArgType += g_current->args.mid(s,i-s); - s=i; - while (i<si && isId(g_current->args.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 (j<l && ((c=g_current->args.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<Entry> current; + Entry* current_root = 0 ; + Entry* previous = 0 ; + std::unique_ptr<Entry> 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<Grouping> 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<Entry*,std::unique_ptr<Entry> > > 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}) %% <NextSemi>"{" { - g_curlyCount=0; - g_needsSemi = TRUE; + yyextra->curlyCount=0; + yyextra->needsSemi = TRUE; BEGIN(SkipCurlyBlock); } <NextSemi>"(" { - g_roundCount=0; + yyextra->roundCount=0; BEGIN(SkipRoundBlock); } <SkipRoundBlock>"(" { - ++g_roundCount; + ++yyextra->roundCount; } <SkipRoundBlock>")" { - if (g_roundCount ) - --g_roundCount ; + if (yyextra->roundCount ) + --yyextra->roundCount ; else BEGIN( NextSemi ) ; } <SkipCurlyBlock>"{" { - ++g_curlyCount ; + ++yyextra->curlyCount ; } <SkipCurlyBlock>"}" { - 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}) } } <NextSemi>\' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_lastStringContext=NextSemi; + yyextra->lastStringContext=NextSemi; BEGIN(SkipPHPString); } } -<NextSemi>{CHARLIT} { if (g_insidePHP) REJECT; } +<NextSemi>{CHARLIT} { if (yyextra->insidePHP) REJECT; } <NextSemi>\" { - g_lastStringContext=NextSemi; + yyextra->lastStringContext=NextSemi; BEGIN(SkipString); } <NextSemi>[;,] { @@ -772,22 +472,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } <EnumBaseType>[{;,] { - g_current->args = g_current->args.simplifyWhiteSpace(); + yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); unput(*yytext); BEGIN( ClassVar ); } <FindMembers>"<?php" { // PHP code with unsupported extension? - g_insidePHP = TRUE; + yyextra->insidePHP = TRUE; } <FindMembersPHP>"<?"("php"?) { // PHP code start BEGIN( FindMembers ); } <FindMembersPHP>"<script"{BN}+"language"{BN}*"="{BN}*['"]?"php"['"]?{BN}*">" { // PHP code start - lineCount() ; + lineCount(yyscanner) ; BEGIN( FindMembers ); } <FindMembers>"?>"|"</script>" { // PHP code end - if (g_insidePHP) + if (yyextra->insidePHP) BEGIN( FindMembersPHP ); else REJECT; @@ -795,100 +495,100 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) <FindMembersPHP>[^\n<]+ { // Non-PHP code text, ignore } <FindMembersPHP>\n { // Non-PHP code text, ignore - lineCount(); + lineCount(yyscanner); } <FindMembersPHP>. { // Non-PHP code text, ignore } -<FindMembers>{PHPKW} { if (g_insidePHP) +<FindMembers>{PHPKW} { if (yyextra->insidePHP) BEGIN( NextSemi ); else REJECT; } <FindMembers>"%{"[^\n]* { // Mozilla XPIDL lang-specific block - if (!g_insideIDL) + if (!yyextra->insideIDL) REJECT; } <FindMembers>"%}" { // Mozilla XPIDL lang-specific block end - if (!g_insideIDL) + if (!yyextra->insideIDL) REJECT; } <FindMembers>{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) ; } -<FindMembers>{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() ; +<FindMembers>{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) ; } -<FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { g_current->mtype = g_mtype = Signal; +<FindMembers>{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) ; } <FindMembers>{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); } <FindMembers>{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); } <FindMembers>{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); } <FindMembers>{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) ; } <FindMembers>{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}) } } <FindMembers>{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) ; } <FindMembers>{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) ; } <FindMembers>{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}) } } <FindMembers>{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}) } } <CliPropertyType>{ID} { - addType(); - g_current->name = yytext; + addType(yyscanner); + yyextra->current->name = yytext; } <CliPropertyType>"[" { // C++/CLI indexed property - g_current->args = "["; + yyextra->current->args = "["; BEGIN( CliPropertyIndex ); } <CliPropertyType>"{" { - 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 ); } <CliPropertyType>";" { @@ -967,84 +667,84 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } <CliPropertyType>\n { - lineCount(); + lineCount(yyscanner); } <CliPropertyType>{B}* { } <CliPropertyType>. { - addType(); - g_current->type += yytext; + addType(yyscanner); + yyextra->current->type += yytext; } <CliPropertyIndex>"]" { BEGIN( CliPropertyType ); - g_current->args+=yytext; + yyextra->current->args+=yytext; } <CliPropertyIndex>. { - g_current->args+=yytext; + yyextra->current->args+=yytext; } /* <FindMembers>{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); } } */ <FindMembers>{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) ; } <FindMembers>{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) ; } <FindMembers>{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) ; } <FindMembers>[\-+]{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 ); } <ObjCMethod>{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); } } <ObjCMethod>":"{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 ); } <ObjCReturnType>[^)]* { // TODO: check if nested braches are possible. - g_current->type = yytext; + yyextra->current->type = yytext; } <ObjCReturnType>")" { 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); } <ObjCParams>{ID}{BN}* { // name of parameter - lineCount(); - g_current->argList.back().name=QCString(yytext).stripWhiteSpace(); + lineCount(yyscanner); + yyextra->current->argList.back().name=QCString(yytext).stripWhiteSpace(); } <ObjCParams>","{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); } /* <ObjCParams>":" { - g_current->name += ':'; + yyextra->current->name += ':'; } */ <ObjCParams>"(" { - g_roundCount=0; - g_current->argList.back().type.resize(0); + yyextra->roundCount=0; + yyextra->current->argList.back().type.resize(0); BEGIN( ObjCParamType ); } <ObjCParamType>"(" { - g_roundCount++; - g_current->argList.back().type+=yytext; + yyextra->roundCount++; + yyextra->current->argList.back().type+=yytext; } <ObjCParamType>")"/{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--; } } <ObjCParamType>[^()]* { - g_current->argList.back().type+=QCString(yytext).stripWhiteSpace(); + yyextra->current->argList.back().type+=QCString(yytext).stripWhiteSpace(); } <ObjCMethod,ObjCParams>";" { // 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 ); } <ObjCMethod,ObjCParams>(";"{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 ); } <FindMembers>{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; } <FindMembers>{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; } <FindMembers>{BN}{1,80} { - lineCount(); + lineCount(yyscanner); } <FindMembers>"@"({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}) } } <ObjCPropAttr>"getter="{ID} { - g_current->read = yytext+7; + yyextra->current->read = yytext+7; } <ObjCPropAttr>"setter="{ID} { - g_current->write = yytext+7; + yyextra->current->write = yytext+7; } <ObjCPropAttr>"readonly" { - g_current->spec&=~Entry::Writable; + yyextra->current->spec&=~Entry::Writable; } <ObjCPropAttr>"readwrite" { // default } <ObjCPropAttr>"assign" { // default } <ObjCPropAttr>"unsafe_unretained" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Unretained; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Unretained; } <ObjCPropAttr>"retain" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Retain; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Retain; } <ObjCPropAttr>"copy" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Copy; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Copy; } <ObjCPropAttr>"weak" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Weak; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Weak; } <ObjCPropAttr>"strong" { - g_current->spec&=~Entry::Assign; - g_current->spec|=Entry::Strong; + yyextra->current->spec&=~Entry::Assign; + yyextra->current->spec|=Entry::Strong; } <ObjCPropAttr>"nonatomic" { - g_current->spec|=Entry::NonAtomic; + yyextra->current->spec|=Entry::NonAtomic; } <ObjCPropAttr>")" { BEGIN(FindMembers); } <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); } <PackageName>{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); } <PackageName>";" { - 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); } <PackageName>"{" { - g_curlyCount=0; + yyextra->curlyCount=0; BEGIN( ReadNSBody ); } <FindMembers>{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); } -<FindMembers>{B}*"static"{BN}+ { g_current->type += " static "; - g_current->stat = TRUE; - lineCount(); +<FindMembers>{B}*"static"{BN}+ { yyextra->current->type += " static "; + yyextra->current->stat = TRUE; + lineCount(yyscanner); } <FindMembers>{B}*"extern"{BN}+ { - g_current->stat = FALSE; - g_current->explicitExternal = TRUE; - lineCount(); + yyextra->current->stat = FALSE; + yyextra->current->explicitExternal = TRUE; + lineCount(yyscanner); } -<FindMembers>{B}*"const"{BN}+ { g_current->type += " const "; - if (g_insideCS) g_current->stat = TRUE; - lineCount(); +<FindMembers>{B}*"const"{BN}+ { yyextra->current->type += " const "; + if (yyextra->insideCS) yyextra->current->stat = TRUE; + lineCount(yyscanner); } -<FindMembers>{B}*"virtual"{BN}+ { g_current->type += " virtual "; - g_current->virt = Virtual; - lineCount(); +<FindMembers>{B}*"virtual"{BN}+ { yyextra->current->type += " virtual "; + yyextra->current->virt = Virtual; + lineCount(yyscanner); } <FindMembers>{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}) } } <FindMembers>{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}) } } <FindMembers>{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); } -<FindMembers>{B}*"inline"{BN}+ { g_current->spec|=Entry::Inline; - lineCount(); +<FindMembers>{B}*"inline"{BN}+ { yyextra->current->spec|=Entry::Inline; + lineCount(yyscanner); } -<FindMembers>{B}*"mutable"{BN}+ { g_current->spec|=Entry::Mutable; - lineCount(); +<FindMembers>{B}*"mutable"{BN}+ { yyextra->current->spec|=Entry::Mutable; + lineCount(yyscanner); } -<FindMembers>{B}*"explicit"{BN}+ { g_current->spec|=Entry::Explicit; - lineCount(); +<FindMembers>{B}*"explicit"{BN}+ { yyextra->current->spec|=Entry::Explicit; + lineCount(yyscanner); } -<FindMembers>{B}*"local"{BN}+ { g_current->spec|=Entry::Local; - lineCount(); +<FindMembers>{B}*"local"{BN}+ { yyextra->current->spec|=Entry::Local; + lineCount(yyscanner); } <FindMembers>{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); } <FindMembers>{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); } /* <FindMembers>{B}*"import"{BN}+ { // IDL import keyword BEGIN( NextSemi ); } */ -<FindMembers>{B}*"typename"{BN}+ { lineCount(); } +<FindMembers>{B}*"typename"{BN}+ { lineCount(yyscanner); } <FindMembers>{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}) } } <FindMembers>{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(); } } <FindMembers>{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(); } } <FindMembers>{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(); } } <FindMembers>{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(); } } <FindMembers>{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(); } } <FindMembers>{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(); } } <FindMembers>{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 ); } <FindMembers>{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 ); } <FindMembers>{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 ); } <FindMembers>{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 ); } <FindMembers>"@class" | // for Objective C class declarations <FindMembers>{B}*{TYPEDEFPREFIX}"class{" | <FindMembers>{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 ) ; } <FindMembers>{B}*"value class{" | // C++/CLI extension <FindMembers>{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 ) ; } <FindMembers>{B}*"ref class{" | // C++/CLI extension <FindMembers>{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 ) ; } <FindMembers>{B}*"interface class{" | // C++/CLI extension <FindMembers>{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 ) ; } <FindMembers>{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); } } <FindMembers>{B}*{TYPEDEFPREFIX}"struct{" | <FindMembers>{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 ) ; } <FindMembers>{B}*"value struct{" | // C++/CLI extension <FindMembers>{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 ) ; } <FindMembers>{B}*"ref struct{" | // C++/CLI extension <FindMembers>{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 ) ; } <FindMembers>{B}*"interface struct{" | // C++/CLI extension <FindMembers>{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 ) ; } <FindMembers>{B}*{TYPEDEFPREFIX}"union{" | <FindMembers>{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 ) ; } <FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" | <FindMembers>{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 ) ; } <Operator>"("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"(" { // A::operator()<int>(int arg) - lineCount(); - g_current->name += "()"; + lineCount(yyscanner); + yyextra->current->name += "()"; BEGIN( FindMembers ); } <Operator>"("{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 ) ; } <Operator>";" { // can occur when importing members @@ -1871,85 +1571,85 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ) ; } <Operator>[^(] { - lineCount(); - g_current->name += *yytext ; + lineCount(yyscanner); + yyextra->current->name += *yytext ; } <Operator>"<>" { /* skip guided templ specifiers */ } <Operator>"(" { - g_current->name = g_current->name.simplifyWhiteSpace(); + yyextra->current->name = yyextra->current->name.simplifyWhiteSpace(); unput(*yytext); BEGIN( FindMembers ) ; } <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 ); } <FindMembers>"namespace"{BN}+/{ID}{BN}*"=" { // namespace alias - lineCount(); + lineCount(yyscanner); BEGIN( NSAliasName ); } <NSAliasName>{ID} { - g_aliasName = yytext; + yyextra->aliasName = yytext; BEGIN( NSAliasArg ); } <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)); //} } <NSAliasArg>";" { BEGIN( FindMembers ); } <PHPUse>({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as" { - lineCount(); - g_aliasName=yytext; + lineCount(yyscanner); + yyextra->aliasName=yytext; BEGIN(PHPUseAs); } <PHPUse>({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); } <PHPUseAs>{BN}+"as"{BN}+ { - lineCount(); + lineCount(yyscanner); } <PHPUseAs>{PHPUSEKW} { } <PHPUseAs>{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); } <PHPUse,PHPUseAs>[,;] { if (*yytext==',') @@ -1962,62 +1662,62 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <JavaImport>({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); } <JavaImport>({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); } <FindMembers>"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); } -<Using>"namespace"{BN}+ { lineCount(); BEGIN(UsingDirective); } +<Using>"namespace"{BN}+ { lineCount(yyscanner); BEGIN(UsingDirective); } <Using>({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); } <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); } <UsingAlias>";"{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 ); } } <UsingAlias>">>" { - g_previous->args+="> >"; // see bug769552 + yyextra->previous->args+="> >"; // see bug769552 } <UsingAlias>. { - g_previous->args+=yytext; + yyextra->previous->args+=yytext; } <UsingAlias>\n { - g_previous->args+=yytext; - lineCount(); + yyextra->previous->args+=yytext; + lineCount(yyscanner); } <UsingAliasEnd>";" { - 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); } -<UsingDirective>{SCOPENAME} { g_current->name=removeRedundantWhiteSpace(yytext); - g_current->fileName = g_yyFileName; - g_current->section=Entry::USINGDIR_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); +<UsingDirective>{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); } <Using>";" { BEGIN(FindMembers); } <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); } <FindMembers>{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 ); } <FindMemberName>{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 ); } <EndTemplate>"<<<" { - if (!g_insidePHP) + if (!yyextra->insidePHP) { REJECT; } else { - g_lastHereDocContext = YY_START; + yyextra->lastHereDocContext = YY_START; BEGIN(HereDoc); } } <ClassTemplSpec,EndTemplate>"<<" { - g_current->name+=yytext; - // *g_currentTemplateSpec+=yytext; + yyextra->current->name+=yytext; + // *yyextra->currentTemplateSpec+=yytext; } <EndTemplate>"<" { - if (g_roundCount==0) + if (yyextra->roundCount==0) { - // *g_currentTemplateSpec+='<'; - g_sharpCount++; + // *yyextra->currentTemplateSpec+='<'; + yyextra->sharpCount++; } - g_current->name+=yytext; + yyextra->current->name+=yytext; } <ClassTemplSpec,EndTemplate>">>" { - 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; } <EndTemplate>">" { - 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); } } <EndTemplate>">"{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 ) ; } } <EndTemplate>">"{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); } } <EndTemplate>">"{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); } } -<ClassTemplSpec,EndTemplate>"(" { g_current->name+=*yytext; - g_roundCount++; +<ClassTemplSpec,EndTemplate>"(" { yyextra->current->name+=*yytext; + yyextra->roundCount++; } -<ClassTemplSpec,EndTemplate>")" { g_current->name+=*yytext; - if (g_roundCount>0) g_roundCount--; +<ClassTemplSpec,EndTemplate>")" { yyextra->current->name+=*yytext; + if (yyextra->roundCount>0) yyextra->roundCount--; } <EndTemplate>. { - g_current->name+=*yytext; - // *g_currentTemplateSpec+=*yytext; + yyextra->current->name+=*yytext; + // *yyextra->currentTemplateSpec+=*yytext; } <FindMembers>"define"{BN}*"("{BN}*["'] { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_current->bodyLine = g_yyLineNr; + yyextra->current->bodyLine = yyextra->yyLineNr; BEGIN( DefinePHP ); } else REJECT; } <CopyHereDoc>{ID} { // PHP heredoc - g_delimiter = yytext; - *g_pCopyHereDocGString += yytext; + yyextra->delimiter = yytext; + *yyextra->pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } <CopyHereDoc>"'"{ID}/"'" { // PHP nowdoc - g_delimiter = &yytext[1]; - *g_pCopyHereDocGString += yytext; + yyextra->delimiter = &yytext[1]; + *yyextra->pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } <HereDoc>{ID} { // PHP heredoc - g_delimiter = yytext; + yyextra->delimiter = yytext; BEGIN(HereDocEnd); } <HereDoc>"'"{ID}/"'" { // PHP nowdoc - g_delimiter = &yytext[1]; + yyextra->delimiter = &yytext[1]; BEGIN(HereDocEnd); } <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); } } <HereDocEnd>. { } <CopyHereDocEnd>^{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); } } <CopyHereDocEnd>\n { - *g_pCopyHereDocGString += yytext; + *yyextra->pCopyHereDocGString += yytext; } <CopyHereDocEnd>{ID} { - *g_pCopyHereDocGString += yytext; + *yyextra->pCopyHereDocGString += yytext; } <CopyHereDocEnd>. { - *g_pCopyHereDocGString += yytext; + *yyextra->pCopyHereDocGString += yytext; } <FindMembers>"Q_OBJECT" { // Qt object macro } <FindMembers>"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); } <QtPropType>"(" { // start of property arguments @@ -2265,25 +1965,25 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } <QtPropType>"const"|"volatile"|"unsigned"|"signed"|"long"|"short" { - g_current->type+=yytext; + yyextra->current->type+=yytext; } <QtPropType>{B}+ { - g_current->type+=yytext; + yyextra->current->type+=yytext; } <QtPropType>({TSCOPE}"::")*{TSCOPE} { - g_current->type+=yytext; + yyextra->current->type+=yytext; BEGIN(QtPropName); } <QtPropName>{ID} { - g_current->name=yytext; + yyextra->current->name=yytext; BEGIN(QtPropAttr); } <QtPropAttr>"READ" { - g_current->spec |= Entry::Readable; + yyextra->current->spec |= Entry::Readable; BEGIN(QtPropRead); } <QtPropAttr>"WRITE" { - g_current->spec |= Entry::Writable; + yyextra->current->spec |= Entry::Writable; BEGIN(QtPropWrite); } <QtPropAttr>"RESET"{B}+{ID} { // reset method => not supported yet @@ -2293,163 +1993,163 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) <QtPropAttr>"DESIGNABLE"{B}+{ID} { // designable property => not supported yet } <QtPropRead>{ID} { - g_current->read = yytext; + yyextra->current->read = yytext; BEGIN(QtPropAttr); } <QtPropWrite>{ID} { - g_current->write = yytext; + yyextra->current->write = yytext; BEGIN(QtPropAttr); } <FindMembers>"friend"{BN}+("class"|"union"|"struct"){BN}+ { - g_current->name=yytext; + yyextra->current->name=yytext; BEGIN(FindMembers); } <FindMembers,FindMemberName>{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); } } } <StaticAssert>"(" { - g_lastSkipRoundContext = FindMembers; - g_roundCount=0; + yyextra->lastSkipRoundContext = FindMembers; + yyextra->roundCount=0; BEGIN(SkipRound); } -<StaticAssert>{BN}+ { lineCount(); } +<StaticAssert>{BN}+ { lineCount(yyscanner); } <StaticAssert>. { // variable with static_assert as name? unput(*yytext); BEGIN(FindMembers); } <DeclType>"(" { - 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); } -<DeclType>{BN}+ { lineCount(); } +<DeclType>{BN}+ { lineCount(yyscanner); } <DeclType>. { unput(*yytext); BEGIN(FindMembers); } <CSIndexer>"["[^\n\]]*"]" { - g_current->name+=removeRedundantWhiteSpace(yytext); + yyextra->current->name+=removeRedundantWhiteSpace(yytext); BEGIN(FindMembers); } <FindMembers>[0-9]{ID} { // some number where we did not expect one } <FindMembers>"." { - if (g_insideJava || g_insideCS || g_insideD) + if (yyextra->insideJava || yyextra->insideCS || yyextra->insideD) { - g_current->name+="."; + yyextra->current->name+="."; } } <FindMembers>"::" { - g_current->name+=yytext; + yyextra->current->name+=yytext; } <CppQuote>"("{B}*"\"" { - g_insideCppQuote=TRUE; + yyextra->insideCppQuote=TRUE; BEGIN(FindMembers); } <IDLUnionCase>"::" <IDLUnionCase>":" { BEGIN(FindMembers); } -<IDLUnionCase>\n { lineCount(); } +<IDLUnionCase>\n { lineCount(yyscanner); } <IDLUnionCase>. -<TryFunctionBlock>\n { lineCount(); } +<TryFunctionBlock>\n { lineCount(yyscanner); } <TryFunctionBlock>"{" { - g_curlyCount=0; - g_lastCurlyContext = TryFunctionBlockEnd ; + yyextra->curlyCount=0; + yyextra->lastCurlyContext = TryFunctionBlockEnd ; BEGIN( SkipCurly ); } <TryFunctionBlock>. -<TryFunctionBlockEnd>{BN}*"catch" { lineCount(); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193 +<TryFunctionBlockEnd>{BN}*"catch" { lineCount(yyscanner); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193 } <TryFunctionBlockEnd>\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 ); } <EndCppQuote>")" { - g_insideCppQuote=FALSE; + yyextra->insideCppQuote=FALSE; BEGIN(FindMembers); } -<FindMembers,FindFields>{B}*"#" { if (g_insidePHP) +<FindMembers,FindFields>{B}*"#" { if (yyextra->insidePHP) REJECT; - g_lastCPPContext = YY_START; + yyextra->lastCPPContext = YY_START; BEGIN( SkipCPP ) ; } <FindMembers,FindFields>{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 ); } <FindMembers,ReadBody,ReadNSBody,ReadBodyIntf,SkipCurly,SkipCurlyCpp>{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 ); } <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; } } <PreLineCtrl>. { - 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; } } <PreLineCtrl>\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 ); } <SkipCPP>. -<SkipCPP>\\[\r]*"\n"[\r]* { lineCount(); } -<SkipCPP>[\r]*\n[\r]* { lineCount(); - BEGIN( g_lastCPPContext) ; +<SkipCPP>\\[\r]*"\n"[\r]* { lineCount(yyscanner); } +<SkipCPP>[\r]*\n[\r]* { lineCount(yyscanner); + BEGIN( yyextra->lastCPPContext) ; } <Define>{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 ) ; } /* <DefineArg>")" { //printf("Define with args\n"); - g_current->args += ')'; + yyextra->current->args += ')'; BEGIN( DefineEnd ); } <DefineArg>. { - g_current->args += *yytext; + yyextra->current->args += *yytext; } */ <Define>{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); } <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); } <DefinePHPEnd>";" { //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); } <DefinePHPEnd>. <DefineEnd>\\[\r]?\n { - lineCount(); + lineCount(yyscanner); } <DefineEnd>\" { - if (g_insideIDL && g_insideCppQuote) + if (yyextra->insideIDL && yyextra->insideCppQuote) { BEGIN(EndCppQuote); } else { - g_lastStringContext=DefineEnd; + yyextra->lastStringContext=DefineEnd; BEGIN(SkipString); } } <DefineEnd>. <DefinePHP>{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 ); } <FindMembers>[\^%] { // ^ 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}) } } <FindMembers>[*&]+ { - g_current->name += yytext ; - addType(); + yyextra->current->name += yytext ; + addType(yyscanner); } <FindMembers,MemberSpec,Function,NextSemi,EnumBaseType,BitFields,ReadInitializer,OldStyleArgs,DefinePHPEnd>";"{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 ); } } <MemberSpec,FindFields,FindMembers,NextSemi,EnumBaseType,BitFields,ReadInitializer,OldStyleArgs>","{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 ); } } <DefineEnd,FindFields,FindFieldArg,ReadInitializer,OldStyleArgs>{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 ); } } <FindMembers,FindFields>("//"([!/]){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); } } } <FindMembers,FindFields,ReadInitializer>"//"([!/]){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); } <FindMembers>"=" { // in PHP code this could also be due to "<?=" - g_current->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); } <UNOIDLAttributeBlock>{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); } <UNOIDLAttributeBlock>"}" { - g_current->exception += " }"; + yyextra->current->exception += " }"; BEGIN(FindMembers); } /* Read initializer rules */ <ReadInitializer>"(" { - 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); } <ReadInitializer>"[" { - 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); } <ReadInitializer>"{" { - 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); } <ReadInitializer>[;,] { - //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; } } <ReadInitializer>{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()); } } <RawGString>{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); } } <RawGString>[^)\n]+ { - *g_pCopyRawGString+=yytext; + *yyextra->pCopyRawGString+=yytext; } <RawGString>. { - *g_pCopyRawGString+=yytext; + *yyextra->pCopyRawGString+=yytext; } <RawGString>\n { - *g_pCopyRawGString+=yytext; - lineCount(); + *yyextra->pCopyRawGString+=yytext; + lineCount(yyscanner); } <RawString>{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); } } <RawString>[^)]+ { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; } <RawString>. { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; } <RawString>\n { - *g_pCopyRawString+=yytext; - g_fullArgString+=yytext; - lineCount(); + *yyextra->pCopyRawString+=yytext; + yyextra->fullArgString+=yytext; + lineCount(yyscanner); } <ReadInitializer>\" { - 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); } } <ReadInitializer>"->" { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } <ReadInitializer>"<<" { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } <ReadInitializer>">>" { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } <ReadInitializer>[<\[{(] { - g_initBracketCount++; - g_current->initializer+=*yytext; + yyextra->initBracketCount++; + yyextra->current->initializer+=*yytext; } <ReadInitializer>[>\]})] { - g_initBracketCount--; - g_current->initializer+=*yytext; + yyextra->initBracketCount--; + yyextra->current->initializer+=*yytext; } <ReadInitializer>\' { - 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; } } <ReadInitializer>{CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } } <ReadInitializer>\n { - g_current->initializer+=*yytext; - lineCount(); + yyextra->current->initializer+=*yytext; + lineCount(yyscanner); } <ReadInitializer>"@\"" { - //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); } } <SkipVerbString>[^\n"]+ { - *g_pSkipVerbString+=yytext; + *yyextra->pSkipVerbString+=yytext; } <SkipVerbString>"\"\"" { // quote escape - *g_pSkipVerbString+=yytext; + *yyextra->pSkipVerbString+=yytext; } <SkipVerbString>"\"" { - *g_pSkipVerbString+=*yytext; - BEGIN(g_lastSkipVerbStringContext); + *yyextra->pSkipVerbString+=*yytext; + BEGIN(yyextra->lastSkipVerbStringContext); } <SkipVerbString>\n { - *g_pSkipVerbString+=*yytext; - lineCount(); + *yyextra->pSkipVerbString+=*yytext; + lineCount(yyscanner); } <SkipVerbString>. { - *g_pSkipVerbString+=*yytext; + *yyextra->pSkipVerbString+=*yytext; } <ReadInitializer>"?>" { - if (g_insidePHP) + if (yyextra->insidePHP) BEGIN( FindMembersPHP ); else - g_current->initializer+=yytext; + yyextra->current->initializer+=yytext; } <ReadInitializer>. { - g_current->initializer+=*yytext; + yyextra->current->initializer+=*yytext; } /* generic quoted string copy rules */ <CopyString,CopyPHPString>\\. { - *g_pCopyQuotedString+=yytext; + *yyextra->pCopyQuotedString+=yytext; } <CopyString>\" { - *g_pCopyQuotedString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedString+=*yytext; + BEGIN( yyextra->lastStringContext ); } <CopyPHPString>\' { - *g_pCopyQuotedString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedString+=*yytext; + BEGIN( yyextra->lastStringContext ); } <CopyString,CopyPHPString>"/*"|"*/"|"//" { - *g_pCopyQuotedString+=yytext; + *yyextra->pCopyQuotedString+=yytext; } <CopyString,CopyPHPString>\n { - *g_pCopyQuotedString+=*yytext; - lineCount(); + *yyextra->pCopyQuotedString+=*yytext; + lineCount(yyscanner); } <CopyString,CopyPHPString>. { - *g_pCopyQuotedString+=*yytext; + *yyextra->pCopyQuotedString+=*yytext; } /* generic quoted growable string copy rules */ <CopyGString,CopyPHPGString>\\. { - *g_pCopyQuotedGString+=yytext; + *yyextra->pCopyQuotedGString+=yytext; } <CopyGString>\" { - *g_pCopyQuotedGString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedGString+=*yytext; + BEGIN( yyextra->lastStringContext ); } <CopyPHPGString>\' { - *g_pCopyQuotedGString+=*yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedGString+=*yytext; + BEGIN( yyextra->lastStringContext ); } <CopyGString,CopyPHPGString>"<?php" { // we had an odd number of quotes. - *g_pCopyQuotedGString += yytext; - BEGIN( g_lastStringContext ); + *yyextra->pCopyQuotedGString += yytext; + BEGIN( yyextra->lastStringContext ); } <CopyGString,CopyPHPGString>"/*"|"*/"|"//" { - *g_pCopyQuotedGString+=yytext; + *yyextra->pCopyQuotedGString+=yytext; } <CopyGString,CopyPHPGString>\n { - *g_pCopyQuotedGString+=*yytext; - lineCount(); + *yyextra->pCopyQuotedGString+=*yytext; + lineCount(yyscanner); } <CopyGString,CopyPHPGString>. { - *g_pCopyQuotedGString+=*yytext; + *yyextra->pCopyQuotedGString+=*yytext; } /* generic round bracket list copy rules */ <CopyRound>\" { - *g_pCopyRoundString+=*yytext; - g_pCopyQuotedString=g_pCopyRoundString; - g_lastStringContext=YY_START; + *yyextra->pCopyRoundString+=*yytext; + yyextra->pCopyQuotedString=yyextra->pCopyRoundString; + yyextra->lastStringContext=YY_START; BEGIN(CopyString); } <CopyRound>"(" { - *g_pCopyRoundString+=*yytext; - g_roundCount++; + *yyextra->pCopyRoundString+=*yytext; + yyextra->roundCount++; } <CopyRound>")" { - *g_pCopyRoundString+=*yytext; - if (--g_roundCount<0) - BEGIN(g_lastRoundContext); + *yyextra->pCopyRoundString+=*yytext; + if (--yyextra->roundCount<0) + BEGIN(yyextra->lastRoundContext); } <CopyRound>\n { - lineCount(); - *g_pCopyRoundString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyRoundString+=*yytext; } <CopyRound>\' { - 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; } } <CopyRound>{CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyRoundString+=yytext; + *yyextra->pCopyRoundString+=yytext; } } <CopyRound>[^"'()\n]+ { - *g_pCopyRoundString+=yytext; + *yyextra->pCopyRoundString+=yytext; } <CopyRound>. { - *g_pCopyRoundString+=*yytext; + *yyextra->pCopyRoundString+=*yytext; } /* generic round bracket list copy rules for growable strings */ <GCopyRound>\" { - *g_pCopyRoundGString+=*yytext; - g_pCopyQuotedGString=g_pCopyRoundGString; - g_lastStringContext=YY_START; + *yyextra->pCopyRoundGString+=*yytext; + yyextra->pCopyQuotedGString=yyextra->pCopyRoundGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyGString); } <GCopyRound>"(" { - *g_pCopyRoundGString+=*yytext; - g_roundCount++; + *yyextra->pCopyRoundGString+=*yytext; + yyextra->roundCount++; } <GCopyRound>")" { - *g_pCopyRoundGString+=*yytext; - if (--g_roundCount<0) - BEGIN(g_lastRoundContext); + *yyextra->pCopyRoundGString+=*yytext; + if (--yyextra->roundCount<0) + BEGIN(yyextra->lastRoundContext); } <GCopyRound>\n { - lineCount(); - *g_pCopyRoundGString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyRoundGString+=*yytext; } <GCopyRound>\' { - 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; } } <GCopyRound>{CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyRoundGString+=yytext; + *yyextra->pCopyRoundGString+=yytext; } } <GCopyRound>[^"'()\n/]+ { - *g_pCopyRoundGString+=yytext; + *yyextra->pCopyRoundGString+=yytext; } <GCopyRound>. { - *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 */ <GCopySquare>\" { - *g_pCopySquareGString+=*yytext; - g_pCopyQuotedGString=g_pCopySquareGString; - g_lastStringContext=YY_START; + *yyextra->pCopySquareGString+=*yytext; + yyextra->pCopyQuotedGString=yyextra->pCopySquareGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyGString); } <GCopySquare>"[" { - *g_pCopySquareGString+=*yytext; - g_squareCount++; + *yyextra->pCopySquareGString+=*yytext; + yyextra->squareCount++; } <GCopySquare>"]" { - *g_pCopySquareGString+=*yytext; - if (--g_squareCount<0) - BEGIN(g_lastSquareContext); + *yyextra->pCopySquareGString+=*yytext; + if (--yyextra->squareCount<0) + BEGIN(yyextra->lastSquareContext); } <GCopySquare>\n { - lineCount(); - *g_pCopySquareGString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopySquareGString+=*yytext; } <GCopySquare>\' { - 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; } } <GCopySquare>{CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_pCopySquareGString+=yytext; + *yyextra->pCopySquareGString+=yytext; } } <GCopySquare>[^"\[\]\n/]+ { - *g_pCopySquareGString+=yytext; + *yyextra->pCopySquareGString+=yytext; } <GCopySquare>. { - *g_pCopySquareGString+=*yytext; + *yyextra->pCopySquareGString+=*yytext; } /* generic curly bracket list copy rules */ <CopyCurly>\" { - *g_pCopyCurlyString+=*yytext; - g_pCopyQuotedString=g_pCopyCurlyString; - g_lastStringContext=YY_START; + *yyextra->pCopyCurlyString+=*yytext; + yyextra->pCopyQuotedString=yyextra->pCopyCurlyString; + yyextra->lastStringContext=YY_START; BEGIN(CopyString); } <CopyCurly>\' { - *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); } } <CopyCurly>"{" { - *g_pCopyCurlyString+=*yytext; - g_curlyCount++; + *yyextra->pCopyCurlyString+=*yytext; + yyextra->curlyCount++; } <CopyCurly>"}" { - *g_pCopyCurlyString+=*yytext; - if (--g_curlyCount<0) - BEGIN(g_lastCurlyContext); + *yyextra->pCopyCurlyString+=*yytext; + if (--yyextra->curlyCount<0) + BEGIN(yyextra->lastCurlyContext); } -<CopyCurly>{CHARLIT} { if (g_insidePHP) +<CopyCurly>{CHARLIT} { if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyCurlyString+=yytext; + *yyextra->pCopyCurlyString+=yytext; } } <CopyCurly>[^"'{}\/\n]+ { - *g_pCopyCurlyString+=yytext; + *yyextra->pCopyCurlyString+=yytext; } -<CopyCurly>"/" { *g_pCopyCurlyString+=yytext; } +<CopyCurly>"/" { *yyextra->pCopyCurlyString+=yytext; } <CopyCurly>\n { - lineCount(); - *g_pCopyCurlyString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyCurlyString+=*yytext; } <CopyCurly>. { - *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; } } <GCopyCurly>\" { - *g_pCopyCurlyGString+=*yytext; - g_pCopyQuotedGString=g_pCopyCurlyGString; - g_lastStringContext=YY_START; + *yyextra->pCopyCurlyGString+=*yytext; + yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString; + yyextra->lastStringContext=YY_START; BEGIN(CopyGString); } <GCopyCurly>\' { - *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); } } <GCopyCurly>"{" { - *g_pCopyCurlyGString+=*yytext; - g_curlyCount++; + *yyextra->pCopyCurlyGString+=*yytext; + yyextra->curlyCount++; } <GCopyCurly>"}" { - *g_pCopyCurlyGString+=*yytext; - if (--g_curlyCount<0) - BEGIN(g_lastCurlyContext); + *yyextra->pCopyCurlyGString+=*yytext; + if (--yyextra->curlyCount<0) + BEGIN(yyextra->lastCurlyContext); } -<GCopyCurly>{CHARLIT} { if (g_insidePHP) +<GCopyCurly>{CHARLIT} { if (yyextra->insidePHP) { REJECT; } else { - *g_pCopyCurlyGString+=yytext; + *yyextra->pCopyCurlyGString+=yytext; } } <GCopyCurly>[^"'{}\/\n,]+ { - *g_pCopyCurlyGString+=yytext; + *yyextra->pCopyCurlyGString+=yytext; } <GCopyCurly>[,]+ { - *g_pCopyCurlyGString+=yytext; + *yyextra->pCopyCurlyGString+=yytext; } -<GCopyCurly>"/" { *g_pCopyCurlyGString+=yytext; } +<GCopyCurly>"/" { *yyextra->pCopyCurlyGString+=yytext; } <GCopyCurly>\n { - lineCount(); - *g_pCopyCurlyGString+=*yytext; + lineCount(yyscanner); + *yyextra->pCopyCurlyGString+=*yytext; } <GCopyCurly>. { - *g_pCopyCurlyGString+=*yytext; + *yyextra->pCopyCurlyGString+=*yytext; } /* ---------------------- */ <FindMembers>":" { - 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+=":"; } } <BitFields>. { - g_current->bitfields+=*yytext; + yyextra->current->bitfields+=*yytext; } <EnumBaseType>. { - g_current->args+=*yytext; + yyextra->current->args+=*yytext; } <EnumBaseType>\n { - lineCount(); - g_current->args+=' '; + lineCount(yyscanner); + yyextra->current->args+=' '; } <FindMembers>[;,] { - 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); } } <FindMembers>"[" { - 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 ) ; } } <SliceMetadata>"[" { // Global metadata. - g_squareCount++; - g_current->metaData += "["; + yyextra->squareCount++; + yyextra->current->metaData += "["; } <SliceMetadata>{BN}* { - lineCount(); + lineCount(yyscanner); } <SliceMetadata>\"[^\"]*\" { - g_current->metaData += yytext; + yyextra->current->metaData += yytext; } <SliceMetadata>"," { - g_current->metaData += yytext; + yyextra->current->metaData += yytext; } <SliceMetadata>"]" { - g_current->metaData += yytext; - if (--g_squareCount<=0) + yyextra->current->metaData += yytext; + if (--yyextra->squareCount<=0) { - BEGIN (g_lastSquareContext); + BEGIN (yyextra->lastSquareContext); } } <SliceOptional>"(" { - g_current->type += "("; - g_roundCount++; + yyextra->current->type += "("; + yyextra->roundCount++; } <SliceOptional>[0-9]+ { - g_current->type += yytext; + yyextra->current->type += yytext; } <SliceOptional>")" { - g_current->type += ")"; - if(--g_roundCount<=0) + yyextra->current->type += ")"; + if(--yyextra->roundCount<=0) { - BEGIN (g_lastModifierContext); + BEGIN (yyextra->lastModifierContext); } } <IDLAttribute>"]" { // 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 ); } } <IDLAttribute>"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; } <IDLAttribute>"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; } <IDLAttribute>"property" { // UNO IDL property - g_current->spec |= Entry::Property; + yyextra->current->spec |= Entry::Property; } <IDLAttribute>"attribute" { // UNO IDL attribute - g_current->spec |= Entry::Attribute; + yyextra->current->spec |= Entry::Attribute; } <IDLAttribute>"optional" { // on UNO IDL interface/service/attribute/property - g_current->spec |= Entry::Optional; + yyextra->current->spec |= Entry::Optional; } <IDLAttribute>"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; } } <IDLAttribute>"bound" { // on UNO IDL attribute or property - g_current->spec |= Entry::Bound; + yyextra->current->spec |= Entry::Bound; } <IDLAttribute>"removable" { // on UNO IDL property - g_current->spec |= Entry::Removable; + yyextra->current->spec |= Entry::Removable; } <IDLAttribute>"constrained" { // on UNO IDL property - g_current->spec |= Entry::Constrained; + yyextra->current->spec |= Entry::Constrained; } <IDLAttribute>"transient" { // on UNO IDL property - g_current->spec |= Entry::Transient; + yyextra->current->spec |= Entry::Transient; } <IDLAttribute>"maybevoid" { // on UNO IDL property - g_current->spec |= Entry::MaybeVoid; + yyextra->current->spec |= Entry::MaybeVoid; } <IDLAttribute>"maybedefault" { // on UNO IDL property - g_current->spec |= Entry::MaybeDefault; + yyextra->current->spec |= Entry::MaybeDefault; } <IDLAttribute>"maybeambiguous" { // on UNO IDL property - g_current->spec |= Entry::MaybeAmbiguous; + yyextra->current->spec |= Entry::MaybeAmbiguous; } <IDLAttribute>. { } <IDLPropName>{BN}*{ID}{BN}* { // return type (probably HRESULT) - skip it - if (g_odlProp) + if (yyextra->odlProp) { // property type - g_idlProp = yytext; + yyextra->idlProp = yytext; } } <IDLPropName>{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 ); } <IDLPropName>{BN}*"("{BN}*{ID}{BN}*")"{BN}* { - if (g_odlProp) + if (yyextra->odlProp) { - g_idlProp += yytext; + yyextra->idlProp += yytext; } } <IDLPropName>{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 ); } } <IDLProp>{BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter - g_idlAttr = yytext; - g_idlAttr=g_idlAttr.stripWhiteSpace(); + yyextra->idlAttr = yytext; + yyextra->idlAttr=yyextra->idlAttr.stripWhiteSpace(); } <IDLProp>{ID} { // property type - g_idlProp = yytext; + yyextra->idlProp = yytext; } <IDLProp>{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 ); } <IDLProp>{BN}*{ID}{BN}*")"{BN}* { // the parameter name for the property - just skip. } <IDLProp>";" { - 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 ); } <IDLProp>. { // spaces, *, or other stuff - //g_idlProp+=yytext; + //yyextra->idlProp+=yytext; } -<Array>"]" { g_current->args += *yytext ; - if (--g_squareCount<=0) +<Array>"]" { yyextra->current->args += *yytext ; + if (--yyextra->squareCount<=0) BEGIN( FindMembers ) ; } -<FuncFuncArray>"]" { g_current->args += *yytext ; - if (--g_squareCount<=0) +<FuncFuncArray>"]" { yyextra->current->args += *yytext ; + if (--yyextra->squareCount<=0) BEGIN( Function ) ; } -<Array,FuncFuncArray>"[" { g_current->args += *yytext ; - g_squareCount++; +<Array,FuncFuncArray>"[" { yyextra->current->args += *yytext ; + yyextra->squareCount++; } -<Array,FuncFuncArray>. { g_current->args += *yytext ; } -<SkipSquare>"[" { g_squareCount++; } +<Array,FuncFuncArray>. { yyextra->current->args += *yytext ; } +<SkipSquare>"[" { yyextra->squareCount++; } <SkipSquare>"]" { - if (--g_squareCount<=0) - BEGIN( g_lastSquareContext ); + if (--yyextra->squareCount<=0) + BEGIN( yyextra->lastSquareContext ); } <SkipSquare>\" { - g_lastStringContext=YY_START; + yyextra->lastStringContext=YY_START; BEGIN( SkipString ); } <SkipSquare>[^\n\[\]\"]+ -<FindMembers>"<" { addType(); - g_current->type += yytext ; +<FindMembers>"<" { addType(yyscanner); + yyextra->current->type += yytext ; BEGIN( Sharp ) ; } -<Sharp>">" { g_current->type += *yytext ; - if (--g_sharpCount<=0) +<Sharp>">" { yyextra->current->type += *yytext ; + if (--yyextra->sharpCount<=0) BEGIN( FindMembers ) ; } -<Sharp>"<" { g_current->type += *yytext ; - g_sharpCount++; +<Sharp>"<" { yyextra->current->type += *yytext ; + yyextra->sharpCount++; } <Sharp>{BN}+ { - g_current->type += ' '; - lineCount(); + yyextra->current->type += ' '; + lineCount(yyscanner); } -<Sharp>. { g_current->type += *yytext ; } +<Sharp>. { yyextra->current->type += *yytext ; } <FindFields>{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; } <FindFields>"(" { // 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); } <FindFields>"=" { - g_lastInitializerContext = YY_START; - g_initBracketCount=0; - g_current->initializer = yytext; + yyextra->lastInitializerContext = YY_START; + yyextra->initBracketCount=0; + yyextra->current->initializer = yytext; BEGIN(ReadInitializer); } <FindFields>";" { - 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}) } } <SkipRemainder>\n { - lineCount(); + lineCount(yyscanner); } <SkipRemainder>[^\n]* <FindFields>"," { //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<Entry>(*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<Entry>(*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); } } <FindFields>"[" { // attribute list in IDL - g_squareCount=1; - g_lastSquareContext = YY_START; + yyextra->squareCount=1; + yyextra->lastSquareContext = YY_START; BEGIN(SkipSquare); } /* <FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); } */ -<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]* { g_current->program += yytext ; } -<ReadBody,ReadNSBody,ReadBodyIntf>"//".* { g_current->program += yytext ; } -<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!g_insidePHP) +<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]* { yyextra->current->program += yytext ; } +<ReadBody,ReadNSBody,ReadBodyIntf>"//".* { yyextra->current->program += yytext ; } +<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!yyextra->insidePHP) REJECT; // append PHP comment. - g_current->program += yytext ; + yyextra->current->program += yytext ; } -<ReadBody,ReadNSBody,ReadBodyIntf>@\" { g_current->program += yytext ; - g_pSkipVerbString = &g_current->program; - g_lastSkipVerbStringContext=YY_START; +<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program += yytext ; + yyextra->pSkipVerbString = &yyextra->current->program; + yyextra->lastSkipVerbStringContext=YY_START; BEGIN( SkipVerbString ); } -<ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { if (g_insidePHP) +<ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { 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; } } -<ReadBody,ReadNSBody,ReadBodyIntf>\" { g_current->program += yytext ; - g_pCopyQuotedGString = &g_current->program; - g_lastStringContext=YY_START; +<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program += yytext ; + yyextra->pCopyQuotedGString = &yyextra->current->program; + yyextra->lastStringContext=YY_START; BEGIN( CopyGString ); } -<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}* { g_current->program += yytext ; - g_lastContext = YY_START ; +<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}* { yyextra->current->program += yytext ; + yyextra->lastContext = YY_START ; BEGIN( Comment ) ; } -<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{BL} { g_current->program += yytext ; - ++g_yyLineNr ; - g_lastContext = YY_START ; +<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{BL} { yyextra->current->program += yytext ; + ++yyextra->yyLineNr ; + yyextra->lastContext = YY_START ; BEGIN( Comment ) ; } <ReadBody,ReadNSBody,ReadBodyIntf>"'" { - 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); } } <ReadBody,ReadNSBody,ReadBodyIntf>{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; } } -<ReadBody,ReadNSBody,ReadBodyIntf>"{" { g_current->program += yytext ; - ++g_curlyCount ; +<ReadBody,ReadNSBody,ReadBodyIntf>"{" { yyextra->current->program += yytext ; + ++yyextra->curlyCount ; } <ReadBodyIntf>"}" { - g_current->program += yytext ; - --g_curlyCount ; + yyextra->current->program += yytext ; + --yyextra->curlyCount ; } -<ReadBody,ReadNSBody>"}" { //err("ReadBody count=%d\n",g_curlyCount); - if ( g_curlyCount>0 ) +<ReadBody,ReadNSBody>"}" { //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<Entry> new_g_current = std::make_unique<Entry>(*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<Entry> new_current = std::make_unique<Entry>(*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}) } } } -<ReadBody>"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",g_curlyCount); - lineCount(); - if ( g_curlyCount>0 ) +<ReadBody>"}"{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 ); } } <TypedefName>("const"|"volatile"){BN} { // late "const" or "volatile" keyword - lineCount(); - g_current->type.prepend(yytext); + lineCount(yyscanner); + yyextra->current->type.prepend(yytext); } <TypedefName>{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); } <TypedefName>";" { /* 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 ) ; } <MemberSpec>([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part could be improved. - lineCount(); + lineCount(yyscanner); int i=0,l=(int)yyleng,j; while (i<l && (!isId(yytext[i]))) i++; - g_msName = QCString(yytext).right(l-i).stripWhiteSpace(); - j=g_msName.find("["); + yyextra->msName = 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); } } } <MemberSpec>"(" { // 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); } <MemberSpec>[,;] { - 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<Entry> varEntry=std::make_unique<Entry>(); - 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); } } <MemberSpec>"=" { - 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); */ } /* <MemberSpecSkip>"{" { - g_curlyCount=0; - g_lastCurlyContext = MemberSpecSkip; - g_previous = g_current; + yyextra->curlyCount=0; + yyextra->lastCurlyContext = MemberSpecSkip; + yyextra->previous = yyextra->current; BEGIN(SkipCurly); } */ <MemberSpecSkip>"," { BEGIN(MemberSpec); } <MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); } -<ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { g_current->program += yytext ; - lineCount() ; +<ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { yyextra->current->program += yytext ; + lineCount(yyscanner) ; } <ReadBodyIntf>"@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 ); } -<ReadBody,ReadNSBody,ReadBodyIntf>. { g_current->program += yytext ; } +<ReadBody,ReadNSBody,ReadBodyIntf>. { yyextra->current->program += yytext ; } <FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */ <FindMembers>("("({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 ); } } <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}) } } <FuncPtr>. { - //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); } <FuncPtrOperator>"("{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); } <FuncPtrOperator>\n { - lineCount(); - g_current->name += *yytext; + lineCount(yyscanner); + yyextra->current->name += *yytext; } <FuncPtrOperator>"(" { unput(*yytext); BEGIN( EndFuncPtr ); } <FuncPtrOperator>. { - g_current->name += *yytext; + yyextra->current->name += *yytext; } <EndFuncPtr>")"{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); } <EndFuncPtr>")"{BN}*/"(" { // a function pointer - lineCount(); - g_current->type+=g_funcPtrType+")"; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType+")"; BEGIN(FindMembers); } <EndFuncPtr>")"{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); } <EndFuncPtr>"(" { // 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 ) ; } <EndFuncPtr>"["[^\n\]]*"]" { - g_funcPtrType+=yytext; + yyextra->funcPtrType+=yytext; } <EndFuncPtr>")" { BEGIN(FindMembers); } <FuncFunc>"(" { - g_current->args += *yytext ; - ++g_roundCount; + yyextra->current->args += *yytext ; + ++yyextra->roundCount; } <FuncFunc>")" { - g_current->args += *yytext ; - if ( g_roundCount ) - --g_roundCount; + yyextra->current->args += *yytext ; + if ( yyextra->roundCount ) + --yyextra->roundCount; else { BEGIN(FuncFuncEnd); } } <FuncFuncEnd>")"{BN}*"(" { - lineCount(); - g_current->type+=g_funcPtrType+")("; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType+")("; BEGIN(FuncFuncType); } <FuncFuncEnd>")"{BN}*/[;{] { - lineCount(); - g_current->type+=g_funcPtrType.data()+1; + lineCount(yyscanner); + yyextra->current->type+=yyextra->funcPtrType.data()+1; BEGIN(Function); } <FuncFuncEnd>")"{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); } <FuncFuncEnd>. { - g_current->args += *yytext; + yyextra->current->args += *yytext; } <FuncFuncType>"(" { - g_current->type += *yytext; - g_roundCount++; + yyextra->current->type += *yytext; + yyextra->roundCount++; } <FuncFuncType>")" { - g_current->type += *yytext; - if (g_roundCount) - --g_roundCount; + yyextra->current->type += *yytext; + if (yyextra->roundCount) + --yyextra->roundCount; else BEGIN(Function); } -<FuncFuncType>{BN}*","{BN}* { lineCount() ; g_current->type += ", " ; } -<FuncFuncType>{BN}+ { lineCount() ; g_current->type += ' ' ; } +<FuncFuncType>{BN}*","{BN}* { lineCount(yyscanner) ; yyextra->current->type += ", " ; } +<FuncFuncType>{BN}+ { lineCount(yyscanner) ; yyextra->current->type += ' ' ; } <FuncFuncType>. { - g_current->type += *yytext; + yyextra->current->type += *yytext; } <FindMembers>"("/{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"); } } <GetCallType>{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 ); } <FindMembers>"(" { - 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()); } } /* <FindMembers>"("{BN}*("void"{BN}*)?")" { - lineCount(); - g_current->args = "()"; + lineCount(yyscanner); + yyextra->current->args = "()"; BEGIN( FuncQual ); } */ /*- Function argument reading rules ---------------------------------------*/ -<ReadFuncArgType>[^ \/\r\t\n\)\(\"\'#]+ { *g_copyArgString+=yytext; - g_fullArgString+=yytext; +<ReadFuncArgType>[^ \/\r\t\n\)\(\"\'#]+ { *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } -<CopyArgString,CopyArgPHPString>[^\n\\\"\']+ { *g_copyArgString+=yytext; - g_fullArgString+=yytext; +<CopyArgString,CopyArgPHPString>[^\n\\\"\']+ { *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } <CopyArgRound>[^\/\n\)\(\"\']+ { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } <ReadFuncArgType,ReadTempArgs>{BN}* { - *g_copyArgString+=" "; - g_fullArgString+=" "; - lineCount(); + *yyextra->copyArgString+=" "; + yyextra->fullArgString+=" "; + lineCount(yyscanner); } <ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>{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); } <ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>\" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_lastCopyArgStringContext = YY_START; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->lastCopyArgStringContext = YY_START; BEGIN( CopyArgString ); } <ReadFuncArgType,ReadTempArgs>"(" { - *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 ); } <ReadFuncArgType>")" { - *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 */ <ReadFuncArgType,ReadTempArgs>("/*"[*!]|"//"[/!])("<"?) { - 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 */ <ReadFuncArgType,ReadTempArgs>"/**/" { /* empty comment */ } <ReadFuncArgType,ReadTempArgs>"/*" { - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN( SkipComment ); } <ReadFuncArgType,ReadTempArgs>"//" { - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN( SkipCxxComment ); } /* -<ReadFuncArgType,ReadTempArgs>"'#" { if (g_insidePHP) +<ReadFuncArgType,ReadTempArgs>"'#" { if (yyextra->insidePHP) REJECT; - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } <ReadFuncArgType,ReadTempArgs>"#" { - if (!g_insidePHP) + if (!yyextra->insidePHP) REJECT; - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN( SkipCxxComment ); } */ /* ')' followed by a special comment */ <ReadFuncArgType>")"{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}) } } <CopyArgComment>^{B}*"*"+/{BN}+ -<CopyArgComment>[^\n\\\@\*]+ { g_fullArgString+=yytext; } -<CopyArgComment>"*/" { g_fullArgString+=yytext; - if (g_lastCopyArgChar!=0) - unput(g_lastCopyArgChar); - BEGIN( g_lastCommentInArgContext ); - } -<CopyArgCommentLine>\n { g_fullArgString+=yytext; - lineCount(); - if (g_lastCopyArgChar!=0) - unput(g_lastCopyArgChar); - BEGIN( g_lastCommentInArgContext ); +<CopyArgComment>[^\n\\\@\*]+ { yyextra->fullArgString+=yytext; } +<CopyArgComment>"*/" { yyextra->fullArgString+=yytext; + if (yyextra->lastCopyArgChar!=0) + unput(yyextra->lastCopyArgChar); + BEGIN( yyextra->lastCommentInArgContext ); + } +<CopyArgCommentLine>\n { yyextra->fullArgString+=yytext; + lineCount(yyscanner); + if (yyextra->lastCopyArgChar!=0) + unput(yyextra->lastCopyArgChar); + BEGIN( yyextra->lastCommentInArgContext ); } <CopyArgCommentLine>{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); } <CopyArgCommentLine>{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); } <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); } } -<CopyArgCommentLine>[^\\\@\n]+ { g_fullArgString+=yytext; } -<CopyArgCommentLine>. { g_fullArgString+=*yytext; } -<CopyArgComment,CopyArgVerbatim>\n { g_fullArgString+=*yytext; lineCount(); } -<CopyArgComment,CopyArgVerbatim>. { g_fullArgString+=*yytext; } +<CopyArgCommentLine>[^\\\@\n]+ { yyextra->fullArgString+=yytext; } +<CopyArgCommentLine>. { yyextra->fullArgString+=*yytext; } +<CopyArgComment,CopyArgVerbatim>\n { yyextra->fullArgString+=*yytext; lineCount(yyscanner); } +<CopyArgComment,CopyArgVerbatim>. { yyextra->fullArgString+=*yytext; } <CopyArgComment>{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+=' '; } <ReadTempArgs>"<" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - g_argSharpCount=1; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + yyextra->argSharpCount=1; BEGIN( CopyArgSharp ); } <ReadTempArgs>">" { - *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 ); } <CopyArgRound>"(" { - g_argRoundCount++; - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + yyextra->argRoundCount++; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } <CopyArgRound>")" { - *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 ); } <CopyArgSharp>"(" { - *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 ); } <CopyArgSharp>"<" { - 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; } <CopyArgSharp>">" { - *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"); } } <CopyArgString,CopyArgPHPString>\\. { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } <CopyArgString>\" { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - BEGIN( g_lastCopyArgStringContext ); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + BEGIN( yyextra->lastCopyArgStringContext ); } <CopyArgPHPString>\' { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; - BEGIN( g_lastCopyArgStringContext ); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; + BEGIN( yyextra->lastCopyArgStringContext ); } <ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>{CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - *g_copyArgString+=yytext; - g_fullArgString+=yytext; + *yyextra->copyArgString+=yytext; + yyextra->fullArgString+=yytext; } } <ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>\' { - *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); } } <ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>\n { - lineCount(); - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + lineCount(yyscanner); + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } <ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>. { - *g_copyArgString+=*yytext; - g_fullArgString+=*yytext; + *yyextra->copyArgString+=*yytext; + yyextra->fullArgString+=*yytext; } @@ -4712,29 +4412,29 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /*------------------------------------------------------------------------*/ -<FuncRound>"(" { g_current->args += *yytext ; - ++g_roundCount ; +<FuncRound>"(" { yyextra->current->args += *yytext ; + ++yyextra->roundCount ; } -<FuncRound>")" { g_current->args += *yytext ; - if ( g_roundCount ) - --g_roundCount ; +<FuncRound>")" { yyextra->current->args += *yytext ; + if ( yyextra->roundCount ) + --yyextra->roundCount ; else BEGIN( FuncQual ) ; } /* -<FuncQual>"#" { if (g_insidePHP) +<FuncQual>"#" { if (yyextra->insidePHP) REJECT; - g_lastCPPContext = YY_START; + yyextra->lastCPPContext = YY_START; BEGIN(SkipCPP); } */ <FuncQual>[{:;,] { 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}) } } <FuncQual>{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 "; } <FuncQual,TrailingReturn>{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); } <FuncQual,TrailingReturn>{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); } <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 "; } <FuncQual>{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 "; } <FuncQual>{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; } <FuncQual>{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; } <FuncQual>{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; } <FuncQual>{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); } <FuncQual>{BN}*"&" { - g_current->args += " &"; - g_current->argList.refQualifier=RefQualifierLValue; + yyextra->current->args += " &"; + yyextra->current->argList.refQualifier=RefQualifierLValue; } <FuncQual>{BN}*"&&" { - g_current->args += " &&"; - g_current->argList.refQualifier=RefQualifierRValue; + yyextra->current->args += " &&"; + yyextra->current->argList.refQualifier=RefQualifierRValue; } <FuncQual,TrailingReturn>{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); } <FuncQual,TrailingReturn>{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); } <FuncQual,TrailingReturn>{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); } <FuncQual>{BN}*"->"{BN}* { - lineCount(); - g_current->argList.trailingReturnType = " -> "; - g_current->args += " -> "; + lineCount(yyscanner); + yyextra->current->argList.trailingReturnType = " -> "; + yyextra->current->args += " -> "; BEGIN(TrailingReturn); } <TrailingReturn>[{;] { @@ -4833,30 +4533,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } <TrailingReturn>. { - g_current->argList.trailingReturnType+=yytext; - g_current->args+=yytext; + yyextra->current->argList.trailingReturnType+=yytext; + yyextra->current->args+=yytext; } <TrailingReturn>\n { - lineCount(); - g_current->argList.trailingReturnType+=yytext; - g_current->args+=' '; + lineCount(yyscanner); + yyextra->current->argList.trailingReturnType+=yytext; + yyextra->current->args+=' '; } <FuncRound,FuncFunc>{BN}*","{BN}* { - lineCount() ; - g_current->args += ", " ; + lineCount(yyscanner) ; + yyextra->current->args += ", " ; } <FuncQual,FuncRound,FuncFunc>{BN}+ { - lineCount() ; - g_current->args += ' ' ; + lineCount(yyscanner) ; + yyextra->current->args += ' ' ; } -<Function,FuncQual,FuncRound,FuncFunc>"#" { if (g_insidePHP) +<Function,FuncQual,FuncRound,FuncFunc>"#" { if (yyextra->insidePHP) REJECT; - g_lastCPPContext = YY_START; + yyextra->lastCPPContext = YY_START; BEGIN(SkipCPP); } <FuncQual>"=" { - 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); } <CliOverride>\n { - lineCount(); + lineCount(yyscanner); } <CliOverride>. { } @@ -4886,96 +4586,96 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } <FuncPtrInit>\" { - 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); } <FuncPtrInit>\' { - 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); } } <FuncPtrInit>{CHARLIT} { - if (g_insidePHP) + if (yyextra->insidePHP) { REJECT; } else { - g_current->args += yytext; + yyextra->current->args += yytext; } } <FuncPtrInit>{ID} { - g_current->args += yytext; + yyextra->current->args += yytext; } <FuncPtrInit>. { - g_current->args += *yytext; + yyextra->current->args += *yytext; } <FuncPtrInit>\n { - g_current->args += *yytext; - lineCount(); + yyextra->current->args += *yytext; + lineCount(yyscanner); } <FuncQual>{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; } } <OldStyleArgs>[,;] { 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); } -<OldStyleArgs>{ID} { g_current->args += yytext; } +<OldStyleArgs>{ID} { yyextra->current->args += yytext; } <OldStyleArgs>"{" { - 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); } -<OldStyleArgs>. { g_current->args += *yytext; } -<FuncQual,FuncRound,FuncFunc>. { g_current->args += *yytext; } +<OldStyleArgs>. { yyextra->current->args += *yytext; } +<FuncQual,FuncRound,FuncFunc>. { yyextra->current->args += *yytext; } <FuncQual>{BN}*"try:" | <FuncQual>{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}) } } <FuncQual>{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 ) ; } <FuncQual>{BN}*"raises"{BN}*"(" { - g_current->exception = " raises (" ; - lineCount() ; - g_roundCount=0; + yyextra->current->exception = " raises (" ; + lineCount(yyscanner) ; + yyextra->roundCount=0; BEGIN( ExcpRound ) ; } <FuncQual>{BN}*"throws"{BN}+ { // Java style throw clause - g_current->exception = " throws " ; - lineCount() ; + yyextra->current->exception = " throws " ; + lineCount(yyscanner) ; BEGIN( ExcpList ); } -<ExcpRound>"(" { g_current->exception += *yytext ; - ++g_roundCount ; +<ExcpRound>"(" { yyextra->current->exception += *yytext ; + ++yyextra->roundCount ; } -<ExcpRound>")" { g_current->exception += *yytext ; - if ( g_roundCount ) - --g_roundCount ; +<ExcpRound>")" { yyextra->current->exception += *yytext ; + if ( yyextra->roundCount ) + --yyextra->roundCount ; else BEGIN( FuncQual ) ; } <ExcpRound>. { - g_current->exception += *yytext; + yyextra->current->exception += *yytext; } <ExcpList>"{" { unput('{'); BEGIN( FuncQual ); @@ -5018,101 +4718,101 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); BEGIN( FuncQual ); } <ExcpList>"\n" { - g_current->exception += ' '; - lineCount(); + yyextra->current->exception += ' '; + lineCount(yyscanner); } <ExcpList>. { - g_current->exception += *yytext; + yyextra->current->exception += *yytext; } -<Function>"(" { g_current->type += g_current->name ; - g_current->name = g_current->args ; - g_current->args = yytext ; - g_roundCount=0; +<Function>"(" { yyextra->current->type += yyextra->current->name ; + yyextra->current->name = yyextra->current->args ; + yyextra->current->args = yytext ; + yyextra->roundCount=0; BEGIN( FuncRound ) ; } <Function>":" { - if (!g_insidePHP) BEGIN(SkipInits); + if (!yyextra->insidePHP) BEGIN(SkipInits); } <Function>[;{,] { - 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<int(void *, char *)> get(); is not a function pointer bool isFunction = ti==-1 || // not a (...*...) pattern (ts!=-1 && ts<te && ts<ti && ti<te); // (...*...) is part of a template argument list //printf("type=%s ts=%d te=%d ti=%d isFunction=%d\n", - // g_current->type.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 ) ; } } } <SkipInits>">"{BN}*"{" { // C++11 style initializer (see bug 790788) - lineCount(); - g_curlyCount=1; + lineCount(yyscanner); + yyextra->curlyCount=1; BEGIN(SkipC11Inits); } <SkipInits>{ID}{BN}*"{" { // C++11 style initializer (see bug 688647) - lineCount(); - g_curlyCount=1; + lineCount(yyscanner); + yyextra->curlyCount=1; BEGIN(SkipC11Inits); } <SkipC11Inits>"{" { - ++g_curlyCount; + ++yyextra->curlyCount; } <SkipC11Inits>"}" { - if ( --g_curlyCount<=0 ) + if ( --yyextra->curlyCount<=0 ) { BEGIN(SkipInits); } } <SkipC11Attribute>"]]" { - BEGIN(g_lastC11AttributeContext); + BEGIN(yyextra->lastC11AttributeContext); } <SkipInits>"{" { // C++11 style initializer unput('{'); @@ -5189,197 +4889,197 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <SkipCurly>"{" { //addToBody(yytext); - ++g_curlyCount ; + ++yyextra->curlyCount ; } <SkipCurly>"}"/{BN}*("/*!"|"/**"|"//!"|"///")"<!--" | /* see bug710917 */ <SkipCurly>"}" { //addToBody(yytext); - if( g_curlyCount ) + if( yyextra->curlyCount ) { - --g_curlyCount ; + --yyextra->curlyCount ; } else { - if (!g_current->sli.empty() && g_previous) // copy special list items + if (!yyextra->current->sli.empty() && yyextra->previous) // copy special list items { - g_previous->sli = g_current->sli; - g_current->sli.clear(); + yyextra->previous->sli = yyextra->current->sli; + yyextra->current->sli.clear(); } - if (g_previous) g_previous->endBodyLine=g_yyLineNr; - BEGIN( g_lastCurlyContext ) ; + if (yyextra->previous) yyextra->previous->endBodyLine=yyextra->yyLineNr; + BEGIN( yyextra->lastCurlyContext ) ; } } <SkipCurly>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { - lineCount(); - if ( g_curlyCount ) + lineCount(yyscanner); + if ( yyextra->curlyCount ) { //addToBody(yytext); - --g_curlyCount ; + --yyextra->curlyCount ; } else { - g_current->endBodyLine=g_yyLineNr; - // take g_previous out of g_current_root and move it into g_current - g_current.swap(g_tempEntry); // remember g_current - g_current_root->moveFromSubEntry(g_previous,g_current); - g_previous = 0; + yyextra->current->endBodyLine=yyextra->yyLineNr; + // take yyextra->previous out of yyextra->current_root and move it into yyextra->current + yyextra->current.swap(yyextra->tempEntry); // remember yyextra->current + yyextra->current_root->moveFromSubEntry(yyextra->previous,yyextra->current); + yyextra->previous = 0; - g_docBlockContext = SkipCurlyEndDoc; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = SkipCurlyEndDoc; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); - g_docBlock.resize(0); - g_docBlockTerm = '}'; + yyextra->docBlock.resize(0); + yyextra->docBlockTerm = '}'; if (yytext[yyleng-3]=='/') { - startCommentBlock(TRUE); + startCommentBlock(yyscanner,TRUE); BEGIN( DocLine ); } else { - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } } } <SkipCurlyEndDoc>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { // desc is followed by another one - g_docBlockContext = SkipCurlyEndDoc; - g_docBlockInBody = FALSE; - g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + yyextra->docBlockContext = SkipCurlyEndDoc; + yyextra->docBlockInBody = FALSE; + yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); - g_docBlock.resize(0); - g_docBlockTerm = '}'; + yyextra->docBlock.resize(0); + yyextra->docBlockTerm = '}'; if (yytext[yyleng-3]=='/') { - startCommentBlock(TRUE); + startCommentBlock(yyscanner,TRUE); BEGIN( DocLine ); } else { - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } } <SkipCurlyEndDoc>"}" { //addToBody("}"); - if (g_tempEntry) // we can only switch back to g_current if no new item was created + if (yyextra->tempEntry) // we can only switch back to yyextra->current if no new item was created { - g_tempEntry.swap(g_current); - g_tempEntry.reset(); + yyextra->tempEntry.swap(yyextra->current); + yyextra->tempEntry.reset(); } - BEGIN( g_lastCurlyContext ); + BEGIN( yyextra->lastCurlyContext ); } <SkipCurly>\" { //addToBody(yytext); - g_lastStringContext=SkipCurly; + yyextra->lastStringContext=SkipCurly; BEGIN( SkipString ); } <SkipCurly>^{B}*"#" { - if (g_insidePHP) + if (yyextra->insidePHP) REJECT; //addToBody(yytext); BEGIN( SkipCurlyCpp ); } <SkipCurly,SkipC11Inits,SkipInits,SkipC11Attribute>\n { - lineCount(); + lineCount(yyscanner); //addToBody(yytext); } <SkipCurly,SkipCurlyCpp,ReadInitializer>"<<<" { - if (!g_insidePHP) + if (!yyextra->insidePHP) { REJECT; } else { - g_lastHereDocContext = YY_START; + yyextra->lastHereDocContext = YY_START; BEGIN(HereDoc); } } <SkipCurly,SkipCurlyCpp>{B}*{RAWBEGIN} { QCString raw=QCString(yytext).stripWhiteSpace(); - g_delimiter = raw.data()+2; - g_delimiter=g_delimiter.left(g_delimiter.length()-1); - g_lastRawStringContext = YY_START; - g_dummyRawString.resize(0); - g_pCopyRawString = &g_dummyRawString; - *g_pCopyRawString+=yytext; + yyextra->delimiter = raw.data()+2; + yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); + yyextra->lastRawStringContext = YY_START; + yyextra->dummyRawString.resize(0); + yyextra->pCopyRawString = &yyextra->dummyRawString; + *yyextra->pCopyRawString+=yytext; BEGIN(RawString); } <SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<]+ { - lineCount(); // for g_column updates + lineCount(yyscanner); // for yyextra->column updates //addToBody(yytext); } <SkipCurlyCpp>\n { //addToBody(yytext); - lineCount(); - g_lastCurlyContext = FindMembers; + lineCount(yyscanner); + yyextra->lastCurlyContext = FindMembers; BEGIN( SkipCurly ); } <SkipCurlyCpp>\\[\r]*"\n"[\r]* { //addToBody(yytext); - lineCount(); + lineCount(yyscanner); } <SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"/*" { //addToBody(yytext); - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN(SkipComment); } <SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"//" { //addToBody(yytext); - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN(SkipCxxComment); } <SkipInits,SkipC11Inits,SkipC11Attribute>"(" { - g_roundCount=0; - g_lastSkipRoundContext=YY_START; + yyextra->roundCount=0; + yyextra->lastSkipRoundContext=YY_START; BEGIN(SkipRound); } <SkipInits,SkipC11Inits,SkipC11Attribute>\" { - g_lastStringContext=YY_START; + yyextra->lastStringContext=YY_START; BEGIN( SkipString ); } <SkipInits>; { - warn(g_yyFileName,g_yyLineNr, + warn(yyextra->yyFileName,yyextra->yyLineNr, "Found ';' while parsing initializer list! " "(doxygen could be confused by a macro call without semicolon)" ); BEGIN( FindMembers ); } <SkipInits,SkipCurly,SkipCurlyCpp>"#" { - if (!g_insidePHP) + if (!yyextra->insidePHP) REJECT; //addToBody(yytext); - g_lastCContext = YY_START; + yyextra->lastCContext = YY_START; BEGIN(SkipCxxComment); } <SkipInits,SkipCurly,SkipCurlyCpp>@\" { - if (!g_insideCS) REJECT; + if (!yyextra->insideCS) REJECT; // C# verbatim string - g_lastSkipVerbStringContext=YY_START; - g_pSkipVerbString=&g_current->initializer; + yyextra->lastSkipVerbStringContext=YY_START; + yyextra->pSkipVerbString=&yyextra->current->initializer; BEGIN(SkipVerbString); } <SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT} { - if (g_insidePHP) REJECT; + if (yyextra->insidePHP) REJECT; } <SkipInits,SkipCurly,SkipCurlyCpp>\' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_lastStringContext=YY_START; + yyextra->lastStringContext=YY_START; BEGIN(SkipPHPString); } } <SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>. { } <SkipString,SkipPHPString>\\. { } <SkipString>\" { - BEGIN( g_lastStringContext ); + BEGIN( yyextra->lastStringContext ); } <SkipPHPString>\' { - BEGIN( g_lastStringContext ); + BEGIN( yyextra->lastStringContext ); } <SkipString,SkipPHPString>"/*"|"*/"|"//" { } <SkipString,SkipPHPString>\n { - lineCount(); + lineCount(yyscanner); } <SkipString,SkipPHPString>. { } <CompoundName>":" { // for "class : public base {} var;" construct, see bug 608359 @@ -5387,243 +5087,243 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(ClassVar); } <CompoundName>";" { - g_current->section = Entry::EMPTY_SEC ; - g_current->type.resize(0) ; - g_current->name.resize(0) ; - g_current->args.resize(0) ; - g_current->argList.clear(); + yyextra->current->section = Entry::EMPTY_SEC ; + yyextra->current->type.resize(0) ; + yyextra->current->name.resize(0) ; + yyextra->current->args.resize(0) ; + yyextra->current->argList.clear(); BEGIN( FindMembers ) ; } <Bases>";" { - if (g_insideIDL && (g_current->spec & (Entry::Singleton | + if (yyextra->insideIDL && (yyextra->current->spec & (Entry::Singleton | Entry::Service))) { // in UNO IDL a service or singleton may be defined // completely like this: "service Foo : XFoo;" - if (!g_current->name.isEmpty() && !g_current_root->name.isEmpty()) + if (!yyextra->current->name.isEmpty() && !yyextra->current_root->name.isEmpty()) { - prependScope(); + prependScope(yyscanner); } - g_current->name = g_current->name.stripWhiteSpace(); + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); // there can be only one base class here - if (!g_baseName.isEmpty()) + if (!yyextra->baseName.isEmpty()) { - g_current->extends.push_back( - BaseInfo(g_baseName,Public,Normal)); - g_baseName.resize(0); + yyextra->current->extends.push_back( + BaseInfo(yyextra->baseName,Public,Normal)); + yyextra->baseName.resize(0); } - g_current_root->moveToSubEntryAndRefresh( g_current ) ; - initEntry(); + yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ; + initEntry(yyscanner); } else { - g_current->section = Entry::EMPTY_SEC ; - g_current->type.resize(0) ; - g_current->name.resize(0) ; - g_current->args.resize(0) ; - g_current->argList.clear(); + yyextra->current->section = Entry::EMPTY_SEC ; + yyextra->current->type.resize(0) ; + yyextra->current->name.resize(0) ; + yyextra->current->args.resize(0) ; + yyextra->current->argList.clear(); } BEGIN( FindMembers ) ; } <CompoundName>{SCOPENAME}/{BN}*"<" { - g_sharpCount = 0; - g_current->name = yytext ; - if (g_current->spec & Entry::Protocol) + yyextra->sharpCount = 0; + yyextra->current->name = yytext ; + if (yyextra->current->spec & Entry::Protocol) { - g_current->name+="-p"; + yyextra->current->name+="-p"; } - lineCount(); - g_lastClassTemplSpecContext = ClassVar; - if (g_insideObjC) // protocol list + lineCount(yyscanner); + yyextra->lastClassTemplSpecContext = ClassVar; + if (yyextra->insideObjC) // protocol list { BEGIN( ObjCProtocolList ); } - else if (g_insideCS) // C# generic class + else if (yyextra->insideCS) // C# generic class { - //g_current->name+="-g"; + //yyextra->current->name+="-g"; BEGIN( CSGeneric ); } else // C++ template specialization { - g_roundCount=0; + yyextra->roundCount=0; BEGIN( ClassTemplSpec ); } } <CSGeneric>"<" { ArgumentList al; // check bug 612858 before enabling the next line - //g_current->spec |= Entry::Template; - g_current->tArgLists.push_back(al); - g_currentArgumentList = &g_current->tArgLists.back(); - g_templateStr="<"; - g_current->name += "<"; - g_fullArgString = g_templateStr; - g_copyArgString = &g_current->name; - //g_copyArgString = &g_templateStr; - g_currentArgumentContext = ClassVar; + //yyextra->current->spec |= Entry::Template; + yyextra->current->tArgLists.push_back(al); + yyextra->currentArgumentList = &yyextra->current->tArgLists.back(); + yyextra->templateStr="<"; + yyextra->current->name += "<"; + yyextra->fullArgString = yyextra->templateStr; + yyextra->copyArgString = &yyextra->current->name; + //yyextra->copyArgString = &yyextra->templateStr; + yyextra->currentArgumentContext = ClassVar; BEGIN( ReadTempArgs ); } <ObjCProtocolList>"<" { - g_insideProtocolList=TRUE; + yyextra->insideProtocolList=TRUE; BEGIN( Bases ); } <ClassTemplSpec>">"({BN}*"::"{BN}*{SCOPENAME})? { - g_current->name += yytext; - lineCount(); - if (g_roundCount==0 && --g_sharpCount<=0) + yyextra->current->name += yytext; + lineCount(yyscanner); + if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) { - g_current->name = removeRedundantWhiteSpace(g_current->name); - if (g_current->spec & Entry::Protocol) + yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name); + if (yyextra->current->spec & Entry::Protocol) { // Objective-C protocol unput('{'); // fake start of body BEGIN( ClassVar ); } else { - BEGIN( g_lastClassTemplSpecContext ); + BEGIN( yyextra->lastClassTemplSpecContext ); } } } <ClassTemplSpec>"<" { - g_current->name += yytext; - if (g_roundCount==0) g_sharpCount++; + yyextra->current->name += yytext; + if (yyextra->roundCount==0) yyextra->sharpCount++; } <ClassTemplSpec>. { - g_current->name += yytext; + yyextra->current->name += yytext; } <CompoundName>{SCOPENAME}{BN}*";" { // forward declaration - if (!g_current->tArgLists.empty()) + if (!yyextra->current->tArgLists.empty()) { // found a forward template declaration, this has // a purpose of its own - g_current->name = yytext; - g_current->name=g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); - //printf("template class declaration for %s!\n",g_current->name.data()); - QCString rn = g_current_root->name.copy(); - //printf("cn='%s' rn='%s' g_isTypedef=%d\n",cn.data(),rn.data(),g_isTypedef); - if (!g_current->name.isEmpty() && !rn.isEmpty()) + yyextra->current->name = yytext; + yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); + //printf("template class declaration for %s!\n",yyextra->current->name.data()); + QCString rn = yyextra->current_root->name.copy(); + //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef); + if (!yyextra->current->name.isEmpty() && !rn.isEmpty()) { - prependScope(); + prependScope(yyscanner); } - g_current->spec|=Entry::ForwardDecl; - g_current_root->moveToSubEntryAndRefresh(g_current); + yyextra->current->spec|=Entry::ForwardDecl; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); } - else if (g_insideIDL && - (((g_current_root->spec & (Entry::Interface | + else if (yyextra->insideIDL && + (((yyextra->current_root->spec & (Entry::Interface | Entry::Service)) && - (g_current->spec & Entry::Interface)) || - ((g_current_root->spec & (Entry::Service | + (yyextra->current->spec & Entry::Interface)) || + ((yyextra->current_root->spec & (Entry::Service | Entry::Singleton)) && - (g_current->spec & Entry::Service)))) + (yyextra->current->spec & Entry::Service)))) { - // interface g_inside of UNO IDL service or interface - // service g_inside of UNO IDL service or singleton + // interface yyextra->inside of UNO IDL service or interface + // service yyextra->inside of UNO IDL service or singleton // there may be documentation on the member, // so do not throw it away... - g_current->name = yytext; - g_current->name=g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); - g_current->section = (g_current->spec & Entry::Interface) + yyextra->current->name = yytext; + yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); + yyextra->current->section = (yyextra->current->spec & Entry::Interface) ? Entry::EXPORTED_INTERFACE_SEC : Entry::INCLUDED_SERVICE_SEC; -// g_current->section = Entry::MEMBERDOC_SEC; - g_current->spec &= ~(Entry::Interface|Entry::Service); // FIXME: horrible: Interface == Gettable, so need to clear it - actually we're mixing values from different enums in this case... granted only Optional and Interface are actually valid in this context but urgh... - g_current_root->moveToSubEntryAndRefresh(g_current); +// yyextra->current->section = Entry::MEMBERDOC_SEC; + yyextra->current->spec &= ~(Entry::Interface|Entry::Service); // FIXME: horrible: Interface == Gettable, so need to clear it - actually we're mixing values from different enums in this case... granted only Optional and Interface are actually valid in this context but urgh... + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); } unput(';'); - g_current->reset(); - initEntry(); - if (g_insideObjC) // see bug746361 + yyextra->current->reset(); + initEntry(yyscanner); + if (yyextra->insideObjC) // see bug746361 { - g_language = g_current->lang = SrcLangExt_Cpp; - g_insideObjC = FALSE; + yyextra->language = yyextra->current->lang = SrcLangExt_Cpp; + yyextra->insideObjC = FALSE; } - if (g_isTypedef) // typedef of a class, put typedef keyword back + if (yyextra->isTypedef) // typedef of a class, put typedef keyword back { - g_current->type.prepend("typedef"); + yyextra->current->type.prepend("typedef"); } BEGIN( FindMembers ); } <CompoundName>{SCOPENAME}/{BN}*"(" { - g_current->name = yytext ; - lineCount(); - if (g_insideCpp && g_current->name=="alignas") // C++11 + yyextra->current->name = yytext ; + lineCount(yyscanner); + if (yyextra->insideCpp && yyextra->current->name=="alignas") // C++11 { - g_lastAlignAsContext = YY_START; + yyextra->lastAlignAsContext = YY_START; BEGIN( AlignAs ); } else { - if (g_current->spec & Entry::Protocol) + if (yyextra->current->spec & Entry::Protocol) { - g_current->name += "-p"; + yyextra->current->name += "-p"; } BEGIN( ClassVar ); } } -<AlignAs>"(" { g_roundCount=0; +<AlignAs>"(" { yyextra->roundCount=0; BEGIN( AlignAsEnd ); } -<AlignAs>\n { lineCount(); } +<AlignAs>\n { lineCount(yyscanner); } <AlignAs>. -<AlignAsEnd>"(" { g_roundCount++; } -<AlignAsEnd>")" { if (--g_roundCount<0) +<AlignAsEnd>"(" { yyextra->roundCount++; } +<AlignAsEnd>")" { if (--yyextra->roundCount<0) { - BEGIN( g_lastAlignAsContext ); + BEGIN( yyextra->lastAlignAsContext ); } } -<AlignAsEnd>\n { lineCount(); } +<AlignAsEnd>\n { lineCount(yyscanner); } <AlignAsEnd>. <CompoundName>{SCOPENAME}/{BN}*"," { // multiple forward declarations on one line // e.g. @protocol A,B; - g_current->reset(); - initEntry(); + yyextra->current->reset(); + initEntry(yyscanner); } <CompoundName>{SCOPENAME} { - 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); } - lineCount(); - if (g_current->spec & Entry::Protocol) + lineCount(yyscanner); + if (yyextra->current->spec & Entry::Protocol) { - g_current->name += "-p"; + yyextra->current->name += "-p"; } - if ((g_current->spec & Entry::Protocol) || - g_current->section == Entry::OBJCIMPL_SEC) + if ((yyextra->current->spec & Entry::Protocol) || + yyextra->current->section == Entry::OBJCIMPL_SEC) { unput('{'); // fake start of body } BEGIN( ClassVar ); } <CompoundName>{CSSCOPENAME} { // C# style scope - g_current->name = substitute(yytext,".","::"); - lineCount(); + yyextra->current->name = substitute(yytext,".","::"); + lineCount(yyscanner); BEGIN( ClassVar ); } <ClassVar>{SCOPENAME}{BN}*/"(" { - if (g_insideIDL && qstrncmp(yytext,"switch",6)==0 && !isId(yytext[6])) + if (yyextra->insideIDL && qstrncmp(yytext,"switch",6)==0 && !isId(yytext[6])) { // Corba IDL style union - g_roundCount=0; + yyextra->roundCount=0; BEGIN(SkipUnionSwitch); } 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); BEGIN( FindMembers ); } } <ClassVar>"," { - if (g_isTypedef) + if (yyextra->isTypedef) { // multiple types in one typedef unput(','); - g_current->type.prepend("typedef "); + yyextra->current->type.prepend("typedef "); BEGIN(FindMembers); } else @@ -5632,12 +5332,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") { - if (g_insideCli) + if (yyextra->insideCli) { if (yytext[0]=='s') // sealed - g_current->spec |= Entry::SealedClass; + yyextra->current->spec |= Entry::SealedClass; else // abstract - g_current->spec |= Entry::AbstractClass; + yyextra->current->spec |= Entry::AbstractClass; BEGIN( ClassVar ); } else @@ -5646,66 +5346,66 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <ClassVar>{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); } - if (g_insideIDL && qstrcmp(yytext,"switch")==0) + if (yyextra->insideIDL && qstrcmp(yytext,"switch")==0) { // Corba IDL style union - g_roundCount=0; + yyextra->roundCount=0; BEGIN(SkipUnionSwitch); } - else if ((g_insideJava || g_insidePHP || g_insideJS || g_insideSlice) && (qstrcmp(yytext,"implements")==0 || qstrcmp(yytext,"extends")==0)) + else if ((yyextra->insideJava || yyextra->insidePHP || yyextra->insideJS || yyextra->insideSlice) && (qstrcmp(yytext,"implements")==0 || qstrcmp(yytext,"extends")==0)) { - g_current->type.resize(0); - g_baseProt=Public; - g_baseVirt=Normal; - g_baseName.resize(0); + yyextra->current->type.resize(0); + yyextra->baseProt=Public; + yyextra->baseVirt=Normal; + yyextra->baseName.resize(0); BEGIN( BasesProt ) ; } - else if (g_insideCS && qstrcmp(yytext,"where")==0) // C# type constraint + else if (yyextra->insideCS && qstrcmp(yytext,"where")==0) // C# type constraint { - 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 (g_insideCli && qstrcmp(yytext,"abstract")==0) + else if (yyextra->insideCli && qstrcmp(yytext,"abstract")==0) { - g_current->spec|=Entry::Abstract; + yyextra->current->spec|=Entry::Abstract; } - else if (g_insideCli && qstrcmp(yytext,"sealed")==0) + else if (yyextra->insideCli && qstrcmp(yytext,"sealed")==0) { - g_current->spec|=Entry::Sealed; + yyextra->current->spec|=Entry::Sealed; } else if (qstrcmp(yytext,"final")==0) { - g_current->spec|=Entry::Final; + yyextra->current->spec|=Entry::Final; } else { - if (g_current->section == Entry::ENUM_SEC) + if (yyextra->current->section == Entry::ENUM_SEC) { // found "enum a b" -> variable - g_current->section = Entry::VARIABLE_SEC ; + yyextra->current->section = Entry::VARIABLE_SEC ; } - g_current->type += ' ' ; - g_current->type += g_current->name ; - g_current->name = yytext ; + yyextra->current->type += ' ' ; + yyextra->current->type += yyextra->current->name ; + yyextra->current->name = yytext ; - if (nameIsOperator(g_current->name)) + if (nameIsOperator(yyextra->current->name)) { BEGIN( Operator ); } } } <ClassVar>[(\[] { - if (g_insideObjC && *yytext=='(') // class category + if (yyextra->insideObjC && *yytext=='(') // class category { - g_current->name+='('; - //if (g_current->section!=Entry::OBJCIMPL_SEC) + yyextra->current->name+='('; + //if (yyextra->current->section!=Entry::OBJCIMPL_SEC) //{ - g_current->spec|=Entry::Category; + yyextra->current->spec|=Entry::Category; //} BEGIN( ClassCategory ); } @@ -5718,73 +5418,73 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <CSConstraintType,CSConstraintName>"/**/" { /* empty comment */ } <CSConstraintType,CSConstraintName>("/*"[*!]|"//"[/!])("<"?) { // special comment - g_fullArgString.resize(0); - g_lastCopyArgChar='#'; // end marker - g_lastCommentInArgContext=YY_START; + yyextra->fullArgString.resize(0); + yyextra->lastCopyArgChar='#'; // end marker + yyextra->lastCommentInArgContext=YY_START; if (yytext[1]=='/') BEGIN( CopyArgCommentLine ); else BEGIN( CopyArgComment ); } <CSConstraintType,CSConstraintName>"#" { // artificially inserted token to signal end of comment block - g_current->typeConstr.back().docs = g_fullArgString; + yyextra->current->typeConstr.back().docs = yyextra->fullArgString; } <CSConstraintType>"{" { // end of type constraint reached // parse documentation of the constraints - handleParametersCommentBlocks(g_current->typeConstr); + handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr); unput('{'); - BEGIN( g_lastCSConstraint ); + BEGIN( yyextra->lastCSConstraint ); } <CSConstraintType,CSConstraintName>";" { - handleParametersCommentBlocks(g_current->typeConstr); + handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr); unput(';'); - BEGIN( g_lastCSConstraint ); + BEGIN( yyextra->lastCSConstraint ); } <CSConstraintName>":" { BEGIN( CSConstraintType ); } <CSConstraintName>{ID} { // parameter name - g_current->typeConstr.back().name=yytext; + yyextra->current->typeConstr.back().name=yytext; } <CSConstraintType>"where" { // another constraint for a different param - g_current->typeConstr.push_back(Argument()); + yyextra->current->typeConstr.push_back(Argument()); BEGIN( CSConstraintName ); } <CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")? { - if (g_current->typeConstr.back().type.isEmpty()) + if (yyextra->current->typeConstr.back().type.isEmpty()) // first type constraint for this parameter { - g_current->typeConstr.back().type=yytext; + yyextra->current->typeConstr.back().type=yytext; } else // new type constraint for same parameter { - QCString name = g_current->typeConstr.back().name; - g_current->typeConstr.push_back(Argument()); - g_current->typeConstr.back().name=name; - g_current->typeConstr.back().type=yytext; + QCString name = yyextra->current->typeConstr.back().name; + yyextra->current->typeConstr.push_back(Argument()); + yyextra->current->typeConstr.back().name=name; + yyextra->current->typeConstr.back().type=yytext; } } <CSConstraintName,CSConstraintType>\n { - lineCount(); + lineCount(yyscanner); } <CSConstraintName,CSConstraintType>. { } <ClassCategory>{ID} { - g_current->name+=yytext; + yyextra->current->name+=yytext; } <ClassCategory>")"/{BN}*"{" { - g_current->name+=')'; + yyextra->current->name+=')'; BEGIN( ClassVar ); } <ClassCategory>")"/{BN}*"<" { - g_current->name+=')'; + yyextra->current->name+=')'; BEGIN( ObjCProtocolList ); } <ClassCategory>")" { - g_current->name+=')'; - if ((g_current->section & Entry::Protocol) || - g_current->section == Entry::OBJCIMPL_SEC) + yyextra->current->name+=')'; + if ((yyextra->current->section & Entry::Protocol) || + yyextra->current->section == Entry::OBJCIMPL_SEC) { unput('{'); // fake start of body } @@ -5796,61 +5496,61 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( ClassVar ); } <ClassVar>":" { - if (g_current->section==Entry::VARIABLE_SEC) // enum A B:2, see bug 748208 + if (yyextra->current->section==Entry::VARIABLE_SEC) // enum A B:2, see bug 748208 { - g_current->bitfields+=":"; - g_current->args.resize(0); + yyextra->current->bitfields+=":"; + yyextra->current->args.resize(0); BEGIN(BitFields); } - else if (g_current->section==Entry::ENUM_SEC) // enum E:2, see bug 313527, + else if (yyextra->current->section==Entry::ENUM_SEC) // enum E:2, see bug 313527, // or C++11 style enum: 'E : unsigned int {...}' { - g_current->args.resize(0); + yyextra->current->args.resize(0); BEGIN(EnumBaseType); } else { - g_current->type.resize(0); - if ((g_current->spec & Entry::Interface) || - (g_current->spec & Entry::Struct) || - (g_current->spec & Entry::Ref) || - (g_current->spec & Entry::Value) || - g_insidePHP || g_insideCS || g_insideD || g_insideObjC || g_insideIDL + yyextra->current->type.resize(0); + if ((yyextra->current->spec & Entry::Interface) || + (yyextra->current->spec & Entry::Struct) || + (yyextra->current->spec & Entry::Ref) || + (yyextra->current->spec & Entry::Value) || + yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL ) - g_baseProt=Public; + yyextra->baseProt=Public; else - g_baseProt=Private; - g_baseVirt=Normal; - g_baseName.resize(0); + yyextra->baseProt=Private; + yyextra->baseVirt=Normal; + yyextra->baseName.resize(0); BEGIN( BasesProt ) ; } } <ClassVar>[;=*&] { unput(*yytext); - if (g_isTypedef) // typedef of a class, put typedef keyword back + if (yyextra->isTypedef) // typedef of a class, put typedef keyword back { - g_current->type.prepend("typedef"); + yyextra->current->type.prepend("typedef"); } if ((yytext[0]=='*' || yytext[0]=='&') && - g_current->section == Entry::ENUM_SEC) + yyextra->current->section == Entry::ENUM_SEC) { // found "enum a *b" -> variable - g_current->section = Entry::VARIABLE_SEC ; + yyextra->current->section = Entry::VARIABLE_SEC ; } BEGIN( FindMembers ); } <Bases,ClassVar>"///"/[^/] { - if (!g_insideObjC) + if (!yyextra->insideObjC) { REJECT; } else { - lineCount(); - g_current->program+=yytext; - g_current->fileName = g_yyFileName ; - g_current->startLine = g_yyLineNr ; - g_current->startColumn = g_yyColNr; - g_curlyCount=0; + lineCount(yyscanner); + yyextra->current->program+=yytext; + yyextra->current->fileName = yyextra->yyFileName ; + yyextra->current->startLine = yyextra->yyLineNr ; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->curlyCount=0; BEGIN( ReadBodyIntf ); } } @@ -5858,56 +5558,56 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) <Bases,ClassVar>("//"{B}*)?"/*!" | <Bases,ClassVar>"//!" | <Bases,ClassVar>[\-+]{BN}* { - if (!g_insideObjC) + if (!yyextra->insideObjC) { REJECT; } else { - lineCount(); - g_current->program+=yytext; - g_current->fileName = g_yyFileName ; - g_current->startLine = g_yyLineNr ; - g_current->startColumn = g_yyColNr; - g_curlyCount=0; + lineCount(yyscanner); + yyextra->current->program+=yytext; + yyextra->current->fileName = yyextra->yyFileName ; + yyextra->current->startLine = yyextra->yyLineNr ; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->curlyCount=0; BEGIN( ReadBodyIntf ); } } <CompoundName,ClassVar>{B}*"{"{B}* { - g_current->fileName = g_yyFileName ; - g_current->startLine = g_yyLineNr ; - g_current->startColumn = g_yyColNr; - g_current->name = removeRedundantWhiteSpace(g_current->name); - if (g_current->name.isEmpty() && !g_isTypedef) // anonymous compound + yyextra->current->fileName = yyextra->yyFileName ; + yyextra->current->startLine = yyextra->yyLineNr ; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name); + if (yyextra->current->name.isEmpty() && !yyextra->isTypedef) // anonymous compound { - if (g_current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces + if (yyextra->current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces { if (Config_getBool(EXTRACT_ANON_NSPACES)) // use visible name { - g_current->name="anonymous_namespace{"+stripPath(g_current->fileName)+"}"; + yyextra->current->name="anonymous_namespace{"+stripPath(yyextra->current->fileName)+"}"; } else // use invisible name { - g_current->name.sprintf("@%d",g_anonNSCount); + yyextra->current->name.sprintf("@%d",yyextra->anonNSCount); } } else { - g_current->name.sprintf("@%d",g_anonCount++); + yyextra->current->name.sprintf("@%d",yyextra->anonCount++); } } - g_curlyCount=0; - if (g_current_root && // not a nested struct g_inside an @interface section - !(g_current_root->spec & Entry::Interface) && - ((g_current->spec & (Entry::Interface | Entry::Protocol | Entry::Category) || - g_current->section==Entry::OBJCIMPL_SEC) + yyextra->curlyCount=0; + if (yyextra->current_root && // not a nested struct yyextra->inside an @interface section + !(yyextra->current_root->spec & Entry::Interface) && + ((yyextra->current->spec & (Entry::Interface | Entry::Protocol | Entry::Category) || + yyextra->current->section==Entry::OBJCIMPL_SEC) ) && - g_insideObjC + yyextra->insideObjC ) { // ObjC body that ends with @end BEGIN( ReadBodyIntf ); } - else if (g_current->section==Entry::NAMESPACE_SEC) + else if (yyextra->current->section==Entry::NAMESPACE_SEC) { // namespace body BEGIN( ReadNSBody ); } @@ -5916,60 +5616,60 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( ReadBody ) ; } } -<BasesProt>"virtual"{BN}+ { lineCount(); g_baseVirt = Virtual; } -<BasesProt>"public"{BN}+ { lineCount(); g_baseProt = Public; } -<BasesProt>"protected"{BN}+ { lineCount(); g_baseProt = Protected; } -<BasesProt>"internal"{BN}+ { if (!g_insideCli) REJECT ; lineCount(); g_baseProt = Package; } -<BasesProt>"private"{BN}+ { lineCount(); g_baseProt = Private; } -<BasesProt>{BN} { lineCount(); } +<BasesProt>"virtual"{BN}+ { lineCount(yyscanner); yyextra->baseVirt = Virtual; } +<BasesProt>"public"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Public; } +<BasesProt>"protected"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Protected; } +<BasesProt>"internal"{BN}+ { if (!yyextra->insideCli) REJECT ; lineCount(yyscanner); yyextra->baseProt = Package; } +<BasesProt>"private"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Private; } +<BasesProt>{BN} { lineCount(yyscanner); } <BasesProt>. { unput(*yytext); BEGIN(Bases); } <Bases>("\\")?({ID}"\\")*{ID} { // PHP namespace token, not sure if interspacing is allowed but it gives problems (see bug 640847) - if (!g_insidePHP) + if (!yyextra->insidePHP) { REJECT; } else // PHP base class of the form \Ns\Cl or Ns\Cl { - lineCount(); + lineCount(yyscanner); QCString bn=yytext; bn = substitute(bn,"\\","::"); - g_baseName += bn; - g_current->args += ' '; - g_current->args += yytext; + yyextra->baseName += bn; + yyextra->current->args += ' '; + yyextra->current->args += yytext; } } <Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID} { - lineCount(); + lineCount(yyscanner); QCString baseScope = yytext; - if (g_insideCS && baseScope.stripWhiteSpace()=="where") + if (yyextra->insideCS && baseScope.stripWhiteSpace()=="where") { // type constraint for a class - 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 { - g_baseName+=yytext; - g_current->args += ' '; - g_current->args += yytext; + yyextra->baseName+=yytext; + yyextra->current->args += ' '; + yyextra->current->args += yytext; } } <Bases>{BN}*{ID}("."{ID})* { // Java style class QCString name = substitute(yytext,".","::"); - g_baseName += name; - g_current->args += ' '; - g_current->args += name; + yyextra->baseName += name; + yyextra->current->args += ' '; + yyextra->current->args += name; } <ClassVar,Bases>\n/{BN}*[^{, \t\n] { - if (!g_insideObjC) + if (!yyextra->insideObjC) { REJECT; } else { - lineCount(); + lineCount(yyscanner); unput('{'); } } @@ -5981,53 +5681,53 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput('}'); unput('{'); } -<ClassVar>"<" { g_current->name += *yytext; - g_sharpCount=1; - g_roundCount=0; - g_lastSkipSharpContext = YY_START; - g_specName = &g_current->name; +<ClassVar>"<" { yyextra->current->name += *yytext; + yyextra->sharpCount=1; + yyextra->roundCount=0; + yyextra->lastSkipSharpContext = YY_START; + yyextra->specName = &yyextra->current->name; BEGIN ( Specialization ); } <Bases>{BN}*"<" { - lineCount(); - g_sharpCount=1; - g_roundCount=0; - g_lastSkipSharpContext = YY_START; - if (g_insideObjC) // start of protocol list + lineCount(yyscanner); + yyextra->sharpCount=1; + yyextra->roundCount=0; + yyextra->lastSkipSharpContext = YY_START; + if (yyextra->insideObjC) // start of protocol list { unput(','); } else // template specialization { - //if (g_insideCS) // generic + //if (yyextra->insideCS) // generic //{ - // g_baseName+="-g"; + // yyextra->baseName+="-g"; //} - g_templateStr = yytext; - g_specName = &g_templateStr; + yyextra->templateStr = yytext; + yyextra->specName = &yyextra->templateStr; BEGIN ( Specialization ); } } -<Specialization>"<" { *g_specName += *yytext; - if (g_roundCount==0) g_sharpCount++; +<Specialization>"<" { *yyextra->specName += *yytext; + if (yyextra->roundCount==0) yyextra->sharpCount++; } <Specialization>">" { - *g_specName += *yytext; - if (g_roundCount==0 && --g_sharpCount<=0) + *yyextra->specName += *yytext; + if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) { - g_baseName+=removeRedundantWhiteSpace(*g_specName); - BEGIN(g_lastSkipSharpContext); + yyextra->baseName+=removeRedundantWhiteSpace(*yyextra->specName); + BEGIN(yyextra->lastSkipSharpContext); } } -<Specialization>{BN}+ { lineCount(); *g_specName +=' '; } -<Specialization>"<<" { *g_specName += yytext; } +<Specialization>{BN}+ { lineCount(yyscanner); *yyextra->specName +=' '; } +<Specialization>"<<" { *yyextra->specName += yytext; } <Specialization>">>"/{B}*"::" { // M$ C++ extension to allow >> to close a template... unput('>'); unput(' '); unput('>'); } <Specialization>">>" { - if (g_insideCS) // for C# >> ends a nested template + if (yyextra->insideCS) // for C# >> ends a nested template { REJECT; } @@ -6037,9 +5737,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) // We require the bitshift to be enclosed in braces. // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html { - if (g_roundCount>0) + if (yyextra->roundCount>0) { - *g_specName += yytext; + *yyextra->specName += yytext; } else { @@ -6049,64 +5749,64 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } } -<Specialization>"typename"{BN}+ { lineCount(); } -<Specialization>"(" { *g_specName += *yytext; g_roundCount++; } -<Specialization>")" { *g_specName += *yytext; g_roundCount--; } - -<Specialization>"\\\\" { *g_specName += *yytext;} -<Specialization>"\\'" { *g_specName += *yytext;} -<Specialization>"\\\"" { *g_specName += *yytext;} -<Specialization>"'" { *g_specName += *yytext;BEGIN(SpecializationSingleQuote);} -<Specialization>"\"" { *g_specName += *yytext;BEGIN(SpecializationDoubleQuote);} -<SpecializationSingleQuote,SpecializationDoubleQuote>"\\\\" { *g_specName += *yytext;} -<SpecializationSingleQuote>"\\'" { *g_specName += *yytext;} -<SpecializationSingleQuote>"'" { *g_specName += *yytext; BEGIN(Specialization);} -<SpecializationDoubleQuote>"\\\"" { *g_specName += *yytext;} -<SpecializationDoubleQuote>"\"" { *g_specName += *yytext; BEGIN(Specialization);} -<SpecializationSingleQuote,SpecializationDoubleQuote>. { *g_specName += *yytext;} +<Specialization>"typename"{BN}+ { lineCount(yyscanner); } +<Specialization>"(" { *yyextra->specName += *yytext; yyextra->roundCount++; } +<Specialization>")" { *yyextra->specName += *yytext; yyextra->roundCount--; } + +<Specialization>"\\\\" { *yyextra->specName += *yytext;} +<Specialization>"\\'" { *yyextra->specName += *yytext;} +<Specialization>"\\\"" { *yyextra->specName += *yytext;} +<Specialization>"'" { *yyextra->specName += *yytext;BEGIN(SpecializationSingleQuote);} +<Specialization>"\"" { *yyextra->specName += *yytext;BEGIN(SpecializationDoubleQuote);} +<SpecializationSingleQuote,SpecializationDoubleQuote>"\\\\" { *yyextra->specName += *yytext;} +<SpecializationSingleQuote>"\\'" { *yyextra->specName += *yytext;} +<SpecializationSingleQuote>"'" { *yyextra->specName += *yytext; BEGIN(Specialization);} +<SpecializationDoubleQuote>"\\\"" { *yyextra->specName += *yytext;} +<SpecializationDoubleQuote>"\"" { *yyextra->specName += *yytext; BEGIN(Specialization);} +<SpecializationSingleQuote,SpecializationDoubleQuote>. { *yyextra->specName += *yytext;} <Specialization>. { - *g_specName += *yytext; + *yyextra->specName += *yytext; } -<SkipRound>"(" { ++g_roundCount; } -<SkipRound>")" { if (--g_roundCount<0) - BEGIN ( g_lastSkipRoundContext ); +<SkipRound>"(" { ++yyextra->roundCount; } +<SkipRound>")" { if (--yyextra->roundCount<0) + BEGIN ( yyextra->lastSkipRoundContext ); } <SkipRound>\" { - g_lastStringContext=SkipRound; + yyextra->lastStringContext=SkipRound; BEGIN(SkipString); } -<Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*) { lineCount(); - if (g_insideProtocolList) +<Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*) { lineCount(yyscanner); + if (yyextra->insideProtocolList) { - g_baseName+="-p"; + yyextra->baseName+="-p"; } else { - g_current->args += ',' ; + yyextra->current->args += ',' ; } - g_current->name = removeRedundantWhiteSpace(g_current->name); - if (!g_baseName.isEmpty()) + yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name); + if (!yyextra->baseName.isEmpty()) { - g_current->extends.push_back( - BaseInfo(g_baseName,g_baseProt,g_baseVirt) + yyextra->current->extends.push_back( + BaseInfo(yyextra->baseName,yyextra->baseProt,yyextra->baseVirt) ); } - if ((g_current->spec & (Entry::Interface|Entry::Struct)) || - g_insideJava || g_insidePHP || g_insideCS || - g_insideD || g_insideObjC || g_insideIDL || g_insideSlice) + if ((yyextra->current->spec & (Entry::Interface|Entry::Struct)) || + yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS || + yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL || yyextra->insideSlice) { - g_baseProt=Public; + yyextra->baseProt=Public; } else { - g_baseProt=Private; + yyextra->baseProt=Private; } - g_baseVirt=Normal; - g_baseName.resize(0); + yyextra->baseVirt=Normal; + yyextra->baseName.resize(0); if (*yytext=='>') { // end of a ObjC protocol list - g_insideProtocolList=FALSE; + yyextra->insideProtocolList=FALSE; if (yyleng==1) { unput('{'); // dummy start body @@ -6118,23 +5818,23 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - if (*yytext==',' && g_insideObjC) // Begin of protocol list + if (*yytext==',' && yyextra->insideObjC) // Begin of protocol list { - g_insideProtocolList=TRUE; + yyextra->insideProtocolList=TRUE; } BEGIN(BasesProt); } } -<Bases>{B}*"{"{B}* { g_current->fileName = g_yyFileName ; - g_current->startLine = g_yyLineNr ; - g_current->startColumn = g_yyColNr; - g_current->name = removeRedundantWhiteSpace(g_current->name); - if (!g_baseName.isEmpty()) - g_current->extends.push_back( - BaseInfo(g_baseName,g_baseProt,g_baseVirt) +<Bases>{B}*"{"{B}* { yyextra->current->fileName = yyextra->yyFileName ; + yyextra->current->startLine = yyextra->yyLineNr ; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name); + if (!yyextra->baseName.isEmpty()) + yyextra->current->extends.push_back( + BaseInfo(yyextra->baseName,yyextra->baseProt,yyextra->baseVirt) ); - g_curlyCount=0; - if (g_insideObjC) + yyextra->curlyCount=0; + if (yyextra->insideObjC) { BEGIN( ReadBodyIntf ); } @@ -6144,214 +5844,214 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <SkipUnionSwitch>{B}*"(" { - g_roundCount++; + yyextra->roundCount++; } <SkipUnionSwitch>")" { - if (--g_roundCount==0) + if (--yyextra->roundCount==0) { BEGIN(ClassVar); } } -<SkipUnionSwitch>\n { lineCount(); } +<SkipUnionSwitch>\n { lineCount(yyscanner); } <SkipUnionSwitch>. -<Comment>{BN}+ { g_current->program += yytext ; - lineCount() ; +<Comment>{BN}+ { yyextra->current->program += yytext ; + lineCount(yyscanner) ; } -<Comment>"/*" { g_current->program += yytext ; } -<Comment>"//" { g_current->program += yytext ; } +<Comment>"/*" { yyextra->current->program += yytext ; } +<Comment>"//" { yyextra->current->program += yytext ; } <Comment>{CMD}("code"|"verbatim") { - g_insideCode=TRUE; - g_current->program += yytext ; + yyextra->insideCode=TRUE; + yyextra->current->program += yytext ; } <Comment>{CMD}("endcode"|"endverbatim") { - g_insideCode=FALSE; - g_current->program += yytext ; + yyextra->insideCode=FALSE; + yyextra->current->program += yytext ; } -<Comment>[^ \.\t\r\n\/\*]+ { g_current->program += yytext ; } -<Comment>"*/" { g_current->program += yytext ; - if (!g_insideCode) BEGIN( g_lastContext ) ; +<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program += yytext ; } +<Comment>"*/" { yyextra->current->program += yytext ; + if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ; } -<Comment>. { g_current->program += *yytext ; } +<Comment>. { yyextra->current->program += *yytext ; } <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,Bases,OldStyleArgs>("//"{B}*)?"/*!" { - //printf("Start doc block at %d\n",g_yyLineNr); - if (!g_current->doc.isEmpty()) + //printf("Start doc block at %d\n",yyextra->yyLineNr); + if (!yyextra->current->doc.isEmpty()) { - g_current->doc+="\n\n"; + yyextra->current->doc+="\n\n"; } else { - g_current->docLine = g_yyLineNr; - g_current->docFile = g_yyFileName; + yyextra->current->docLine = yyextra->yyLineNr; + yyextra->current->docFile = yyextra->yyFileName; } - g_lastDocContext = YY_START; - if (g_current_root->section & Entry::SCOPE_MASK) + yyextra->lastDocContext = YY_START; + if (yyextra->current_root->section & Entry::SCOPE_MASK) { - g_current->inside = g_current_root->name+"::"; + yyextra->current->inside = yyextra->current_root->name+"::"; } - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; - g_docBlockAutoBrief = Config_getBool(QT_AUTOBRIEF); + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = YY_START==SkipCurly; + yyextra->docBlockAutoBrief = Config_getBool(QT_AUTOBRIEF); QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; - if (g_docBlockAutoBrief) + if (yyextra->docBlockAutoBrief) { - g_current->briefLine = g_yyLineNr; - g_current->briefFile = g_yyFileName; + yyextra->current->briefLine = yyextra->yyLineNr; + yyextra->current->briefFile = yyextra->yyFileName; } - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>"/**"[*]+{BL} { bool javadocBanner = Config_getBool(JAVADOC_BANNER); - lineCount(); + lineCount(yyscanner); if( javadocBanner ) { - g_lastDocContext = YY_START; + yyextra->lastDocContext = YY_START; - //printf("Found comment banner at %s:%d\n",g_yyFileName,g_yyLineNr); - if (g_current_root->section & Entry::SCOPE_MASK) + //printf("Found comment banner at %s:%d\n",yyextra->yyFileName,yyextra->yyLineNr); + if (yyextra->current_root->section & Entry::SCOPE_MASK) { - g_current->inside = g_current_root->name+"::"; + yyextra->current->inside = yyextra->current_root->name+"::"; } - g_current->docLine = g_yyLineNr; - g_current->docFile = g_yyFileName; - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; + yyextra->current->docLine = yyextra->yyLineNr; + yyextra->current->docFile = yyextra->yyFileName; + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = YY_START==SkipCurly; bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); - g_docBlockAutoBrief = javadocAutoBrief; + yyextra->docBlockAutoBrief = javadocAutoBrief; QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; - if (g_docBlockAutoBrief) + if (yyextra->docBlockAutoBrief) { - g_current->briefLine = g_yyLineNr; - g_current->briefFile = g_yyFileName; + yyextra->current->briefLine = yyextra->yyLineNr; + yyextra->current->briefFile = yyextra->yyFileName; } - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } else { - g_current->program += yytext ; - g_lastContext = YY_START ; + yyextra->current->program += yytext ; + yyextra->lastContext = YY_START ; BEGIN( Comment ) ; } } <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/**"/[^/*] { - g_lastDocContext = YY_START; + yyextra->lastDocContext = YY_START; - //printf("Found comment block at %s:%d\n",g_yyFileName,g_yyLineNr); - if (g_current_root->section & Entry::SCOPE_MASK) + //printf("Found comment block at %s:%d\n",yyextra->yyFileName,yyextra->yyLineNr); + if (yyextra->current_root->section & Entry::SCOPE_MASK) { - g_current->inside = g_current_root->name+"::"; + yyextra->current->inside = yyextra->current_root->name+"::"; } - g_current->docLine = g_yyLineNr; - g_current->docFile = g_yyFileName; - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; + yyextra->current->docLine = yyextra->yyLineNr; + yyextra->current->docFile = yyextra->yyFileName; + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = YY_START==SkipCurly; bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); - g_docBlockAutoBrief = javadocAutoBrief; + yyextra->docBlockAutoBrief = javadocAutoBrief; QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; - if (g_docBlockAutoBrief) + if (yyextra->docBlockAutoBrief) { - g_current->briefLine = g_yyLineNr; - g_current->briefFile = g_yyFileName; + yyextra->current->briefLine = yyextra->yyLineNr; + yyextra->current->briefFile = yyextra->yyFileName; } - startCommentBlock(FALSE); + startCommentBlock(yyscanner,FALSE); BEGIN( DocBlock ); } <FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"//!" { - g_lastDocContext = YY_START; - if (g_current_root->section & Entry::SCOPE_MASK) + yyextra->lastDocContext = YY_START; + if (yyextra->current_root->section & Entry::SCOPE_MASK) { - g_current->inside = g_current_root->name+"::"; + yyextra->current->inside = yyextra->current_root->name+"::"; } - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; - g_docBlockAutoBrief = FALSE; + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = YY_START==SkipCurly; + yyextra->docBlockAutoBrief = FALSE; QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; - startCommentBlock(g_current->brief.isEmpty()); + startCommentBlock(yyscanner,yyextra->current->brief.isEmpty()); BEGIN( DocLine ); } <FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"///"/[^/] { - g_lastDocContext = YY_START; - if (g_current_root->section & Entry::SCOPE_MASK) + yyextra->lastDocContext = YY_START; + if (yyextra->current_root->section & Entry::SCOPE_MASK) { - g_current->inside = g_current_root->name+"::"; + yyextra->current->inside = yyextra->current_root->name+"::"; } - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; - g_docBlockAutoBrief = FALSE; + yyextra->docBlockContext = YY_START; + yyextra->docBlockInBody = YY_START==SkipCurly; + yyextra->docBlockAutoBrief = FALSE; QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; - startCommentBlock(g_current->brief.isEmpty()); + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock=indent; + startCommentBlock(yyscanner,yyextra->current->brief.isEmpty()); BEGIN( DocLine ); } <FindMembers>"extern"{BN}*"\"C"("++")?"\""{BN}*("{")? { - lineCount(); - g_externC=TRUE; + lineCount(yyscanner); + yyextra->externC=TRUE; } <FindMembers>"{" { - if (g_externC) + if (yyextra->externC) { - g_externC=FALSE; + yyextra->externC=FALSE; } - else if (g_insideCS && - !g_current->name.isEmpty() && - !g_current->type.isEmpty()) + else if (yyextra->insideCS && + !yyextra->current->name.isEmpty() && + !yyextra->current->type.isEmpty()) { - if (containsWord(g_current->type,"event")) // event + if (containsWord(yyextra->current->type,"event")) // event { - g_current->mtype = g_mtype = Event; + yyextra->current->mtype = yyextra->mtype = Event; } else // property { - g_current->mtype = g_mtype = Property; + yyextra->current->mtype = yyextra->mtype = Property; } - g_current->bodyLine = g_yyLineNr; - g_curlyCount=0; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->curlyCount=0; BEGIN( CSAccessorDecl ); } - else if (g_insideIDL && (g_current->spec & Entry::Attribute)) + else if (yyextra->insideIDL && (yyextra->current->spec & Entry::Attribute)) { // UNO IDL: attributes may have setter and getter // exception specifications - g_current->exception = " {"; + yyextra->current->exception = " {"; BEGIN(UNOIDLAttributeBlock); } else { - if ((g_insideJava || g_insideCS || g_insideD) && - g_current->name.isEmpty() + if ((yyextra->insideJava || yyextra->insideCS || yyextra->insideD) && + yyextra->current->name.isEmpty() ) { // static Java initializer - g_needsSemi = FALSE; - if (g_current->stat) + yyextra->needsSemi = FALSE; + if (yyextra->current->stat) { - g_current->name="[static initializer]"; - g_current->type.resize(0); + yyextra->current->name="[static initializer]"; + yyextra->current->type.resize(0); } else { - g_current->name="[instance initializer]"; + yyextra->current->name="[instance initializer]"; } unput(*yytext); BEGIN( Function ); @@ -6359,122 +6059,122 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { // pre C++11 code -> ignore the initializer - //g_needsSemi = TRUE; - //g_current->type.resize(0); - //g_current->name.resize(0); - //g_current->args.resize(0); - //g_current->argList.clear(); - //g_curlyCount=0; + //yyextra->needsSemi = TRUE; + //yyextra->current->type.resize(0); + //yyextra->current->name.resize(0); + //yyextra->current->args.resize(0); + //yyextra->current->argList.clear(); + //yyextra->curlyCount=0; //BEGIN( SkipCurlyBlock ); // C++11 style initializer list - g_current->bodyLine = g_yyLineNr; - g_current->initializer = yytext; - g_lastInitializerContext = YY_START; - g_initBracketCount=1; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->initializer = yytext; + yyextra->lastInitializerContext = YY_START; + yyextra->initBracketCount=1; BEGIN(ReadInitializer); } } } -<CSAccessorDecl>"{" { g_curlyCount++; } +<CSAccessorDecl>"{" { yyextra->curlyCount++; } <CSAccessorDecl>"}"{B}*"=" { // fall back to next rule if it's not the right bracket - if (g_curlyCount != 0) REJECT; - g_current->initializer = "="; - g_current->endBodyLine=g_yyLineNr; - g_lastInitializerContext = FindMembers; + if (yyextra->curlyCount != 0) REJECT; + yyextra->current->initializer = "="; + yyextra->current->endBodyLine=yyextra->yyLineNr; + yyextra->lastInitializerContext = FindMembers; BEGIN(ReadInitializer); } <CSAccessorDecl>"}" { - if (g_curlyCount) + if (yyextra->curlyCount) { - g_curlyCount--; + yyextra->curlyCount--; } else { - g_mtype = Method; - g_virt = Normal; + yyextra->mtype = Method; + yyextra->virt = Normal; // not really important, but while we are at it - g_current->endBodyLine=g_yyLineNr; + yyextra->current->endBodyLine=yyextra->yyLineNr; unput(';'); BEGIN(FindMembers); } } -<CSAccessorDecl>"private "{BN}*"set" { if (g_curlyCount==0) g_current->spec |= Entry::PrivateSettable; } -<CSAccessorDecl>"protected "{BN}*"set" { if (g_curlyCount==0) g_current->spec |= Entry::ProtectedSettable; } -<CSAccessorDecl>"private "{BN}*"get" { if (g_curlyCount==0) g_current->spec |= Entry::PrivateGettable; } -<CSAccessorDecl>"protected "{BN}*"get" { if (g_curlyCount==0) g_current->spec |= Entry::ProtectedGettable; } -<CSAccessorDecl>"set" { if (g_curlyCount==0) g_current->spec |= Entry::Settable; } -<CSAccessorDecl>"get" { if (g_curlyCount==0) g_current->spec |= Entry::Gettable; } -<CSAccessorDecl>"add" { if (g_curlyCount==0) g_current->spec |= Entry::Addable; } -<CSAccessorDecl>"remove" { if (g_curlyCount==0) g_current->spec |= Entry::Removable; } -<CSAccessorDecl>"raise" { if (g_curlyCount==0) g_current->spec |= Entry::Raisable; } +<CSAccessorDecl>"private "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::PrivateSettable; } +<CSAccessorDecl>"protected "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::ProtectedSettable; } +<CSAccessorDecl>"private "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::PrivateGettable; } +<CSAccessorDecl>"protected "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::ProtectedGettable; } +<CSAccessorDecl>"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Settable; } +<CSAccessorDecl>"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Gettable; } +<CSAccessorDecl>"add" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Addable; } +<CSAccessorDecl>"remove" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Removable; } +<CSAccessorDecl>"raise" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Raisable; } <CSAccessorDecl>"\"" { BEGIN(CSString);} <CSAccessorDecl>"." {} -<CSAccessorDecl>\n { lineCount(); } +<CSAccessorDecl>\n { lineCount(yyscanner); } <CSString>"\"" { BEGIN(CSAccessorDecl);} <CSString>"//" {} // Otherwise the rule <*>"//" will kick in <CSString>"/*" {} // Otherwise the rule <*>"/*" will kick in -<CSString>\n { lineCount(); } +<CSString>\n { lineCount(yyscanner); } <CSString>"." {} /* ---- Slice-specific rules ------ */ <SliceSequence>{SCOPENAME} { - if (g_current->spec&Entry::Local) + if (yyextra->current->spec&Entry::Local) { - g_current->type = "local "; + yyextra->current->type = "local "; } - g_current->type += "sequence<"; - g_current->type += yytext; - g_current->type += ">"; + yyextra->current->type += "sequence<"; + yyextra->current->type += yytext; + yyextra->current->type += ">"; } <SliceSequence>{BN}*">"{BN}* { - lineCount(); + lineCount(yyscanner); BEGIN(SliceSequenceName); } <SliceSequenceName>{ID}{BN}* { - lineCount(); - g_current->name = yytext ; - g_current->name = g_current->name.stripWhiteSpace(); + lineCount(yyscanner); + yyextra->current->name = yytext ; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); } <SliceSequenceName>";" { - g_current->section = Entry::VARIABLE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->section = Entry::VARIABLE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(FindMembers); } <SliceDictionary>{SCOPENAME}{BN}*","{BN}*{SCOPENAME} { - lineCount(); - if (g_current->spec&Entry::Local) + lineCount(yyscanner); + if (yyextra->current->spec&Entry::Local) { - g_current->type = "local "; + yyextra->current->type = "local "; } - g_current->type += "dictionary<"; - g_current->type += yytext; - g_current->type += ">"; - g_current->type = g_current->type.simplifyWhiteSpace(); + yyextra->current->type += "dictionary<"; + yyextra->current->type += yytext; + yyextra->current->type += ">"; + yyextra->current->type = yyextra->current->type.simplifyWhiteSpace(); } <SliceDictionary>{BN}*">"{BN}* { - lineCount(); + lineCount(yyscanner); BEGIN(SliceDictionaryName); } <SliceDictionaryName>{ID}{BN}* { - lineCount(); - g_current->name = yytext ; - g_current->name = g_current->name.stripWhiteSpace(); + lineCount(yyscanner); + yyextra->current->name = yytext ; + yyextra->current->name = yyextra->current->name.stripWhiteSpace(); } <SliceDictionaryName>";" { - g_current->section = Entry::VARIABLE_SEC; - g_current_root->moveToSubEntryAndRefresh(g_current); - initEntry(); + yyextra->current->section = Entry::VARIABLE_SEC; + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); + initEntry(yyscanner); BEGIN(FindMembers); } @@ -6484,100 +6184,100 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /* ---- Single line comments ------ */ <DocLine>[^\n]*"\n"[ \t]*"//"[/!][<]? { // continuation of multiline C++-style comment - g_docBlock+=yytext; + yyextra->docBlock+=yytext; int markerLen = yytext[yyleng-1]=='<' ? 4 : 3; - g_docBlock.resize(g_docBlock.length() - markerLen); - lineCount(); + yyextra->docBlock.resize(yyextra->docBlock.length() - markerLen); + lineCount(yyscanner); } <DocLine>{B}*"///"[/]+{B}*/"\n" { // ignore marker line (see bug700345) - handleCommentBlock(g_docBlock.data(),g_current->brief.isEmpty()); - BEGIN( g_docBlockContext ); + handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty()); + BEGIN( yyextra->docBlockContext ); } <DocLine>[^\n]*/"\n"{B}*"//"[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712 - g_docBlock+=yytext; - handleCommentBlock(g_docBlock.data(),g_current->brief.isEmpty()); - BEGIN( g_docBlockContext ); + yyextra->docBlock+=yytext; + handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty()); + BEGIN( yyextra->docBlockContext ); } <DocLine>[^\n]*/"\n" { // whole line - g_docBlock+=yytext; - handleCommentBlock(g_docBlock.data(),g_current->brief.isEmpty()); - BEGIN( g_docBlockContext ); + yyextra->docBlock+=yytext; + handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty()); + BEGIN( yyextra->docBlockContext ); } /* ---- Comments blocks ------ */ <DocBlock>"*"*"*/" { // end of comment block - handleCommentBlock(g_docBlock.data(),FALSE); - BEGIN(g_docBlockContext); + handleCommentBlock(yyscanner,yyextra->docBlock.data(),FALSE); + BEGIN(yyextra->docBlockContext); } <DocBlock>^{B}*"*"+/[^/] { QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock+=indent; + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock+=indent; } <DocBlock>^{B}*("//")?{B}*"*"+/[^//a-z_A-Z0-9*] { // start of a comment line QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock+=indent; + indent.fill(' ',computeIndent(yytext,yyextra->column)); + yyextra->docBlock+=indent; } <DocBlock>^{B}*("//"){B}* { // strip embedded C++ comments if at the start of a line } <DocBlock>"//" { // slashes in the middle of a comment block - g_docBlock+=yytext; + yyextra->docBlock+=yytext; } <DocBlock>"/*" { // start of a new comment in the // middle of a comment block - g_docBlock+=yytext; + yyextra->docBlock+=yytext; } <DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command - g_docBlock+=yytext; + yyextra->docBlock+=yytext; } <DocBlock>{CMD}("f$"|"f["|"f{") { - g_docBlock+=yytext; - g_docBlockName=&yytext[1]; - if (g_docBlockName.at(1)=='{') + yyextra->docBlock+=yytext; + yyextra->docBlockName=&yytext[1]; + if (yyextra->docBlockName.at(1)=='{') { - g_docBlockName.at(1)='}'; + yyextra->docBlockName.at(1)='}'; } - g_fencedSize=0; - g_nestedComment=FALSE; + yyextra->fencedSize=0; + yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>{B}*"<"{PRE}">" { - g_docBlock+=yytext; - g_docBlockName="<pre>"; - g_fencedSize=0; - g_nestedComment=FALSE; + yyextra->docBlock+=yytext; + yyextra->docBlockName="<pre>"; + yyextra->fencedSize=0; + yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) - g_docBlock+=yytext; - g_docBlockName=&yytext[1]; - g_fencedSize=0; - g_nestedComment=FALSE; + yyextra->docBlock+=yytext; + yyextra->docBlockName=&yytext[1]; + yyextra->fencedSize=0; + yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - g_docBlock+=substitute(yytext,"*"," "); - g_docBlockName="~~~"; - g_fencedSize=yyleng; - g_nestedComment=FALSE; + yyextra->docBlock+=substitute(yytext,"*"," "); + yyextra->docBlockName="~~~"; + yyextra->fencedSize=yyleng; + yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* { - g_docBlock+=substitute(yytext,"*"," "); - g_docBlockName="```"; - g_fencedSize=yyleng; - g_nestedComment=FALSE; + yyextra->docBlock+=substitute(yytext,"*"," "); + yyextra->docBlockName="```"; + yyextra->fencedSize=yyleng; + yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>{B}*"<code>" { - if (g_insideCS) + if (yyextra->insideCS) { - g_docBlock+=yytext; - g_docBlockName="<code>"; - g_nestedComment=FALSE; + yyextra->docBlock+=yytext; + yyextra->docBlockName="<code>"; + yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } else @@ -6586,49 +6286,49 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <DocBlock>[^@*~\/\\\n]+ { // any character that isn't special - g_docBlock+=yytext; + yyextra->docBlock+=yytext; } <DocBlock>\n { // newline - lineCount(); - g_docBlock+=*yytext; + lineCount(yyscanner); + yyextra->docBlock+=*yytext; } <DocBlock>. { // command block - g_docBlock+=*yytext; + yyextra->docBlock+=*yytext; } /* ---- Copy verbatim sections ------ */ <DocCopyBlock>"</"{PRE}">" { // end of a <pre> block - g_docBlock+=yytext; - if (g_docBlockName=="<pre>") + yyextra->docBlock+=yytext; + if (yyextra->docBlockName=="<pre>") { BEGIN(DocBlock); } } <DocCopyBlock>"</"{CODE}">" { // end of a <code> block - g_docBlock+=yytext; - if (g_docBlockName=="<code>") + yyextra->docBlock+=yytext; + if (yyextra->docBlockName=="<code>") { BEGIN(DocBlock); } } <DocCopyBlock>[\\@]("f$"|"f]"|"f}") { - g_docBlock+=yytext; + yyextra->docBlock+=yytext; BEGIN(DocBlock); } <DocCopyBlock>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block - g_docBlock+=yytext; - if (&yytext[4]==g_docBlockName) + yyextra->docBlock+=yytext; + if (&yytext[4]==yyextra->docBlockName) { BEGIN(DocBlock); } } <DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line - if (g_docBlockName=="verbatim") + if (yyextra->docBlockName=="verbatim") { REJECT; } - else if (g_docBlockName=="code") + else if (yyextra->docBlockName=="code") { REJECT; } @@ -6636,15 +6336,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { QCString indent; indent.fill(' ',computeIndent(yytext,0)); - g_docBlock+=indent; + yyextra->docBlock+=indent; } } <DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s - if (g_docBlockName=="code") + if (yyextra->docBlockName=="code") { QCString indent; indent.fill(' ',computeIndent(yytext,0)); - g_docBlock+=indent; + yyextra->docBlock+=indent; } else { @@ -6652,11 +6352,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516) - if (g_docBlockName=="code") + if (yyextra->docBlockName=="code") { QCString indent; indent.fill(' ',computeIndent(yytext,-1)); - g_docBlock+=indent+"*"; + yyextra->docBlock+=indent+"*"; } else { @@ -6664,18 +6364,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <DocCopyBlock>^{B}*"*"+/{BN}* { // start of a comment line with one * - if (g_docBlockName=="code") + if (yyextra->docBlockName=="code") { QCString indent; - if (g_nestedComment) // keep * it is part of the code + if (yyextra->nestedComment) // keep * it is part of the code { indent.fill(' ',computeIndent(yytext,-1)); - g_docBlock+=indent+"*"; + yyextra->docBlock+=indent+"*"; } else // remove * it is part of the comment block { indent.fill(' ',computeIndent(yytext,0)); - g_docBlock+=indent; + yyextra->docBlock+=indent; } } else @@ -6684,45 +6384,45 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - g_docBlock+=substitute(yytext,"*"," "); - if (g_fencedSize==yyleng) + yyextra->docBlock+=substitute(yytext,"*"," "); + if (yyextra->fencedSize==yyleng) { BEGIN(DocBlock); } } <DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* { - g_docBlock+=substitute(yytext,"*"," "); - if (g_fencedSize==yyleng) + yyextra->docBlock+=substitute(yytext,"*"," "); + if (yyextra->fencedSize==yyleng) { BEGIN(DocBlock); } } <DocCopyBlock>[^\<@/*\]~\$\\\n]+ { // any character that is not special - g_docBlock+=yytext; + yyextra->docBlock+=yytext; } <DocCopyBlock>"/*"|"*/"|"//" { if (yytext[1]=='*') { - g_nestedComment=TRUE; + yyextra->nestedComment=TRUE; } else if (yytext[0]=='*') { - g_nestedComment=FALSE; + yyextra->nestedComment=FALSE; } - g_docBlock+=yytext; + yyextra->docBlock+=yytext; } <DocCopyBlock>\n { // newline - g_docBlock+=*yytext; - lineCount(); + yyextra->docBlock+=*yytext; + lineCount(yyscanner); } <DocCopyBlock>. { // any other character - g_docBlock+=*yytext; + yyextra->docBlock+=*yytext; } <DocCopyBlock><<EOF>> { - warn(g_yyFileName,g_yyLineNr, - "reached end of file while g_inside a '%s' block!\n" + warn(yyextra->yyFileName,yyextra->yyLineNr, + "reached end of file while yyextra->inside a '%s' block!\n" "The command that should end the block seems to be missing!\n", - g_docBlockName.data()); + yyextra->docBlockName.data()); yyterminate(); } @@ -6730,69 +6430,69 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /* ------------- Prototype parser -------------- */ <Prototype>"operator"{B}*"("{B}*")" { - g_current->name+=yytext; + yyextra->current->name+=yytext; } <Prototype>"(" { - g_current->args+=*yytext; - g_currentArgumentContext = PrototypeQual; - g_fullArgString = g_current->args.copy(); - g_copyArgString = &g_current->args; + yyextra->current->args+=*yytext; + yyextra->currentArgumentContext = PrototypeQual; + yyextra->fullArgString = yyextra->current->args.copy(); + yyextra->copyArgString = &yyextra->current->args; BEGIN( ReadFuncArgType ) ; } <Prototype>"("({ID}"::")*({B}*[&*])+ { - g_current->type+=g_current->name+yytext; - g_current->name.resize(0); + yyextra->current->type+=yyextra->current->name+yytext; + yyextra->current->name.resize(0); BEGIN( PrototypePtr ); } <PrototypePtr>{SCOPENAME} { - g_current->name+=yytext; + yyextra->current->name+=yytext; } <PrototypePtr>"(" { - g_current->args+=*yytext; - g_currentArgumentContext = PrototypeQual; - g_fullArgString = g_current->args.copy(); - g_copyArgString = &g_current->args; + yyextra->current->args+=*yytext; + yyextra->currentArgumentContext = PrototypeQual; + yyextra->fullArgString = yyextra->current->args.copy(); + yyextra->copyArgString = &yyextra->current->args; BEGIN( ReadFuncArgType ) ; } <PrototypePtr>")" { - g_current->type+=')'; + yyextra->current->type+=')'; BEGIN( Prototype ); } <PrototypePtr>. { - g_current->name+=yytext; + yyextra->current->name+=yytext; } <PrototypeQual>"{" { BEGIN( PrototypeSkipLine); } <PrototypeQual>{B}*"const"{B}* { - g_current->args += " const "; - g_current->argList.constSpecifier=TRUE; + yyextra->current->args += " const "; + yyextra->current->argList.constSpecifier=TRUE; } <PrototypeQual>{B}*"volatile"{B}* { - g_current->args += " volatile "; - g_current->argList.volatileSpecifier=TRUE; + yyextra->current->args += " volatile "; + yyextra->current->argList.volatileSpecifier=TRUE; } <PrototypeQual>{B}*"="{B}*"0"{B}* { - g_current->args += " = 0"; - g_current->virt = Pure; - g_current->argList.pureSpecifier=TRUE; + yyextra->current->args += " = 0"; + yyextra->current->virt = Pure; + yyextra->current->argList.pureSpecifier=TRUE; } <PrototypeQual>"throw"{B}*"(" { - g_current->exception = "throw("; + yyextra->current->exception = "throw("; BEGIN(PrototypeExc); } <PrototypeExc>")" { - g_current->exception += ')'; + yyextra->current->exception += ')'; BEGIN(PrototypeQual); } <PrototypeExc>. { - g_current->exception += *yytext; + yyextra->current->exception += *yytext; } <PrototypeQual>. { - g_current->args += *yytext; + yyextra->current->args += *yytext; } <Prototype>. { - g_current->name += *yytext; + yyextra->current->name += *yytext; } <PrototypeSkipLine>. { } @@ -6801,149 +6501,475 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) <SkipCxxComment>.*"\\\n" { // line continuation - if (g_insideCS) + if (yyextra->insideCS) { REJECT; } else { - lineCount(); + lineCount(yyscanner); } } <SkipCxxComment>.*/\n { - BEGIN( g_lastCContext ) ; + BEGIN( yyextra->lastCContext ) ; } <SkipComment>[^\*\n]+ /* ------------ Generic rules -------------- */ <*>"[[" { // C++11 attribute - if (!g_insideCpp) REJECT; + if (!yyextra->insideCpp) REJECT; if (YY_START == CopyGString || YY_START == CopyGString) REJECT; - g_lastC11AttributeContext = YY_START; + yyextra->lastC11AttributeContext = YY_START; BEGIN( SkipC11Attribute ); } -<*>\n { lineCount(); } +<*>\n { lineCount(yyscanner); } <*>\" { - if (g_insideIDL && g_insideCppQuote) + if (yyextra->insideIDL && yyextra->insideCppQuote) { BEGIN(EndCppQuote); } } <*>"#" { - if (!g_insidePHP) + if (!yyextra->insidePHP) REJECT; - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; BEGIN( SkipCxxComment ) ; } <*>\' { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_lastStringContext=YY_START; + yyextra->lastStringContext=YY_START; BEGIN(SkipPHPString); } } <*>\" { - if (g_insidePHP) + if (yyextra->insidePHP) { - g_lastStringContext=YY_START; + yyextra->lastStringContext=YY_START; BEGIN(SkipString); } } <*>\? { - if (g_insideCS && (YY_START != SkipRound)) + if (yyextra->insideCS && (YY_START != SkipRound)) { - if (g_current->type.isEmpty()) + if (yyextra->current->type.isEmpty()) { - if (g_current->name.isEmpty()) - g_current->name="?"; + if (yyextra->current->name.isEmpty()) + yyextra->current->name="?"; else - g_current->name+="?"; + yyextra->current->name+="?"; } else { - g_current->type+="?"; + yyextra->current->type+="?"; } } } <*>. <SkipComment>"//"|"/*" -<*>"/*" { g_lastCContext = YY_START ; +<*>"/*" { yyextra->lastCContext = YY_START ; BEGIN( SkipComment ) ; } -<SkipComment>{B}*"*/" { BEGIN( g_lastCContext ) ; } +<SkipComment>{B}*"*/" { BEGIN( yyextra->lastCContext ) ; } <*>"//" { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; BEGIN( SkipCxxComment ) ; } %% //---------------------------------------------------------------------------- +static int yyread(yyscan_t yyscanner,char *buf,int max_size) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int c=0; + while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) + { + *buf = yyextra->inputString[yyextra->inputPosition++] ; + //printf("%d (%c)\n",*buf,*buf); + c++; buf++; + } + return c; +} -static void startCommentBlock(bool brief) + +static void initParser(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + yyextra->outerScopeEntries.clear(); + yyextra->baseName.resize(0); + yyextra->protection = Public; + yyextra->baseProt = Public; + yyextra->sharpCount = 0; + yyextra->roundCount = 0; + yyextra->curlyCount = 0; + yyextra->mtype = Method; + yyextra->stat = FALSE; + yyextra->virt = Normal; + yyextra->baseVirt = Normal; + yyextra->isTypedef = FALSE; + yyextra->autoGroupStack.clear(); + yyextra->insideTryBlock = FALSE; + yyextra->autoGroupStack.setAutoDelete(TRUE); + yyextra->insideFormula = FALSE; + yyextra->insideCode=FALSE; + yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT); + yyextra->previous = 0; + yyextra->firstTypedefEntry = 0; + yyextra->memspecEntry =0; +} + +static void initEntry(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->insideJava) + { + yyextra->protection = (yyextra->current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; + } + yyextra->current->protection = yyextra->protection ; + yyextra->current->mtype = yyextra->mtype; + yyextra->current->virt = yyextra->virt; + yyextra->current->stat = yyextra->stat; + yyextra->current->lang = yyextra->language; + //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language); + Doxygen::docGroup.initGroupInfo(yyextra->current.get()); + yyextra->isTypedef=FALSE; +} + + +//----------------------------------------------------------------------------- + +static void lineCount(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int tabSize = Config_getInt(TAB_SIZE); + const char *p; + for (p = yytext ; *p ; ++p ) + { + if (*p=='\n') + { + yyextra->yyLineNr++,yyextra->column=0,yyextra->yyColNr=1; + } + else if (*p=='\t') + { + yyextra->column+=tabSize - (yyextra->column%tabSize); + } + else + { + yyextra->column++,yyextra->yyColNr++; + } + } + //printf("lineCount()=%d\n",yyextra->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(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + uint tl=yyextra->current->type.length(); + if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.') + { + yyextra->current->type += ' ' ; + } + yyextra->current->type += yyextra->current->name ; + yyextra->current->name.resize(0) ; + tl=yyextra->current->type.length(); + if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.') + { + yyextra->current->type += ' ' ; + } + yyextra->current->type += yyextra->current->args ; + yyextra->current->args.resize(0) ; + yyextra->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 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(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + yyextra->language = getLanguageFromFileName(yyextra->yyFileName); + yyextra->insideIDL = yyextra->language==SrcLangExt_IDL; + yyextra->insideJava = yyextra->language==SrcLangExt_Java; + yyextra->insideCS = yyextra->language==SrcLangExt_CSharp; + yyextra->insideD = yyextra->language==SrcLangExt_D; + yyextra->insidePHP = yyextra->language==SrcLangExt_PHP; + yyextra->insideObjC = yyextra->language==SrcLangExt_ObjC; + yyextra->insideJS = yyextra->language==SrcLangExt_JS; + yyextra->insideSlice = yyextra->language==SrcLangExt_Slice; + yyextra->insideCpp = yyextra->language==SrcLangExt_Cpp; + //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d " + // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n", + // yyextra->yyFileName.data(),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC + // ); +} + +//----------------------------------------------------------------------------- + +static void prependScope(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->current_root->section & Entry::SCOPE_MASK) + { + //printf("--- prependScope %s to %s\n",yyextra->current_root->name.data(),yyextra->current->name.data()); + yyextra->current->name.prepend(yyextra->current_root->name+"::"); + //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count()); + for (const ArgumentList &srcAl : yyextra->current_root->tArgLists) + { + yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl); + } + } +} + +//----------------------------------------------------------------------------- + +/*! Returns TRUE iff the yyextra->current entry could be a K&R style C function */ +static bool checkForKnRstyleC(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (((QCString)yyextra->yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file + if (yyextra->current->argList.empty()) return FALSE; // must have arguments + for (const Argument &a : yyextra->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(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &oldStyleArgName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int si = yyextra->current->args.length(); + if (yyextra->oldStyleArgType.isEmpty()) // new argument + { + static QRegExp re("([^)]*)"); + int bi1 = yyextra->current->args.findRev(re); + int bi2 = bi1!=-1 ? yyextra->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; + yyextra->oldStyleArgType = yyextra->current->args.left(s); + int i=s; + while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uchar)c))) i++; + yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s); + s=i; + while (i<si && isId(yyextra->current->args.at(i))) i++; + oldStyleArgName = yyextra->current->args.mid(s,i-s); + yyextra->oldStyleArgType+=yyextra->current->args.mid(i); + } + else if (bi1!=-1) // redundant braces like in "int (*var)" + { + int s=bi1; + yyextra->oldStyleArgType = yyextra->current->args.left(s); + s++; + int i=s+1; + while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uchar)c))) i++; + yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s); + s=i; + while (i<si && isId(yyextra->current->args.at(i))) i++; + oldStyleArgName = yyextra->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(yyextra->current->args.at(i))) i--; + j=i+1; + // look for start of *'s + while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uchar)c))) i--; + i++; + if (i!=l) + { + yyextra->oldStyleArgType=yyextra->current->args.left(i); + oldStyleArgPtr=yyextra->current->args.mid(i,j-i); + oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace(); + } + else + { + oldStyleArgName=yyextra->current->args.copy().stripWhiteSpace(); + } + } + } + else // continuation like *arg2 in "int *args,*arg2" + { + int l=si,j=0; + char c; + while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uchar)c))) j++; + if (j>0) + { + oldStyleArgPtr=yyextra->current->args.left(j); + oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace(); + } + else + { + oldStyleArgName=yyextra->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(yyscan_t yyscanner,const QCString &type,const QCString &name, + const QCString &brief,const QCString &docs) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + for (Argument &a : yyextra->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; + } + } + } +} + +//----------------------------------------------------------------------------- + + +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); + } + } +} + + +static void startCommentBlock(yyscan_t yyscanner,bool brief) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (brief) { - g_current->briefFile = g_yyFileName; - g_current->briefLine = g_yyLineNr; + yyextra->current->briefFile = yyextra->yyFileName; + yyextra->current->briefLine = yyextra->yyLineNr; } else { - g_current->docFile = g_yyFileName; - g_current->docLine = g_yyLineNr; + yyextra->current->docFile = yyextra->yyFileName; + yyextra->current->docLine = yyextra->yyLineNr; } } //---------------------------------------------------------------------------- -static void newEntry() +static void newEntry(yyscan_t yyscanner) { - if (g_tempEntry==0) // if temp entry is not 0, it holds g_current, - // and g_current is actually replaced by g_previous which was - // already added to g_current_root, so we should not add it again + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current, + // and yyextra->current is actually replaced by yyextra->previous which was + // already added to yyextra->current_root, so we should not add it again // (see bug723314) { - g_previous = g_current.get(); - g_current_root->moveToSubEntryAndRefresh(g_current); + yyextra->previous = yyextra->current.get(); + yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); } else { - g_previous = g_current.get(); - g_tempEntry.swap(g_current); - g_tempEntry.reset(); + yyextra->previous = yyextra->current.get(); + yyextra->tempEntry.swap(yyextra->current); + yyextra->tempEntry.reset(); } - initEntry(); + initEntry(yyscanner); } -static void handleCommentBlock(const QCString &doc,bool brief) +static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief) { + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS); - if (g_docBlockInBody && hideInBodyDocs) return; + if (yyextra->docBlockInBody && hideInBodyDocs) return; //printf("parseCommentBlock [%s] brief=%d\n",doc.data(),brief); - int lineNr = brief ? g_current->briefLine : g_current->docLine; // line of block start + int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start // fill in inbodyFile && inbodyLine the first time, see bug 633891 - Entry *docEntry = g_docBlockInBody && g_previous ? g_previous : g_current.get(); - if (g_docBlockInBody && docEntry && docEntry->inbodyLine==-1) + Entry *docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current.get(); + if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1) { - docEntry->inbodyFile = g_yyFileName; + docEntry->inbodyFile = yyextra->yyFileName; docEntry->inbodyLine = lineNr; } int position=0; bool needsEntry=FALSE; - QCString processedDoc = preprocessCommentBlock(stripIndentation(doc),g_yyFileName,lineNr); + QCString processedDoc = preprocessCommentBlock(stripIndentation(doc),yyextra->yyFileName,lineNr); while (parseCommentBlock( - g_thisParser, - g_docBlockInBody && g_previous ? g_previous : g_current.get(), + yyextra->thisParser, + yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current.get(), processedDoc, // text - g_yyFileName, // file + yyextra->yyFileName, // file lineNr, // line of block start - g_docBlockInBody ? FALSE : brief, // isBrief - g_docBlockInBody ? FALSE : g_docBlockAutoBrief, // isJavaDocStyle - g_docBlockInBody, // isInBody - g_protection, + yyextra->docBlockInBody ? FALSE : brief, // isBrief + yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle + yyextra->docBlockInBody, // isInBody + yyextra->protection, position, needsEntry ) @@ -6952,26 +6978,27 @@ static void handleCommentBlock(const QCString &doc,bool brief) //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position); if (needsEntry) { - QCString docFile = g_current->docFile; - newEntry(); - g_current->docFile = docFile; - g_current->docLine = lineNr; + QCString docFile = yyextra->current->docFile; + newEntry(yyscanner); + yyextra->current->docFile = docFile; + yyextra->current->docLine = lineNr; } } if (needsEntry) { - newEntry(); + newEntry(yyscanner); } - if (g_docBlockTerm) + if (yyextra->docBlockTerm) { - unput(g_docBlockTerm); - g_docBlockTerm=0; + unput(yyextra->docBlockTerm); + yyextra->docBlockTerm=0; } } -static void handleParametersCommentBlocks(ArgumentList &al) +static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al) { + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf(">>>>>>> handleParametersCommentBlocks()\n"); for (Argument &a : al) { @@ -6983,44 +7010,44 @@ static void handleParametersCommentBlocks(ArgumentList &al) bool needsEntry; // save context - QCString orgDoc = g_current->doc; - QCString orgBrief = g_current->brief; - int orgDocLine = g_current->docLine; - int orgBriefLine = g_current->briefLine; + QCString orgDoc = yyextra->current->doc; + QCString orgBrief = yyextra->current->brief; + int orgDocLine = yyextra->current->docLine; + int orgBriefLine = yyextra->current->briefLine; - g_current->doc.resize(0); - g_current->brief.resize(0); + yyextra->current->doc.resize(0); + yyextra->current->brief.resize(0); //printf("handleParametersCommentBlock [%s]\n",doc.data()); while (parseCommentBlock( - g_thisParser, - g_current.get(), + yyextra->thisParser, + yyextra->current.get(), a.docs, // text - g_yyFileName, // file - g_current->docLine, // line of block start + yyextra->yyFileName, // file + yyextra->current->docLine, // line of block start FALSE, FALSE, FALSE, - g_protection, + yyextra->protection, position, needsEntry ) ) { //printf("handleParametersCommentBlock position=%d [%s]\n",position,doc.data()+position); - if (needsEntry) newEntry(); + if (needsEntry) newEntry(yyscanner); } if (needsEntry) { - newEntry(); + newEntry(yyscanner); } - a.docs = g_current->doc; + a.docs = yyextra->current->doc; // restore context - g_current->doc = orgDoc; - g_current->brief = orgBrief; - g_current->docLine = orgDocLine; - g_current->briefLine = orgBriefLine; + yyextra->current->doc = orgDoc; + yyextra->current->brief = orgBrief; + yyextra->current->docLine = orgDocLine; + yyextra->current->briefLine = orgBriefLine; } } } @@ -7028,8 +7055,9 @@ static void handleParametersCommentBlocks(ArgumentList &al) //---------------------------------------------------------------------------- -static void parseCompounds(const std::unique_ptr<Entry> &rt) +static void parseCompounds(yyscan_t yyscanner,const std::unique_ptr<Entry> &rt) { + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("parseCompounds(%s)\n",rt->name.data()); for (const auto &ce : rt->children()) { @@ -7038,26 +7066,25 @@ static void parseCompounds(const std::unique_ptr<Entry> &rt) //printf("-- %s ---------\n%s\n---------------\n", // ce->name.data(),ce->program.data()); // init scanner state - g_padCount=0; + yyextra->padCount=0; //depthIf = 0; - g_column=0; - g_inputString = ce->program; - g_inputPosition = 0; - scannerYYrestart( scannerYYin ) ; + yyextra->column=0; + yyextra->inputString = ce->program; + yyextra->inputPosition = 0; if (ce->section==Entry::ENUM_SEC || (ce->spec&Entry::Enum)) BEGIN( FindFields ) ; else BEGIN( FindMembers ) ; - g_current_root = ce.get() ; - g_yyFileName = ce->fileName; + yyextra->current_root = ce.get() ; + yyextra->yyFileName = ce->fileName; //setContext(); - g_yyLineNr = ce->startLine ; - g_yyColNr = ce->startColumn ; - g_insideObjC = ce->lang==SrcLangExt_ObjC; - //printf("---> Inner block starts at line %d objC=%d\n",g_yyLineNr,g_insideObjC); - g_current = std::make_unique<Entry>(); - 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<Entry>(); + 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<Entry> &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<Entry> &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<Entry>(); - //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<Entry>(); + //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); } //---------------------------------------------------------------------------- |