Fix for UBSan build
[platform/upstream/doxygen.git] / src / scanner.l
1 /*****************************************************************************
2  *
3  * $Id: scanner.l,v 1.80 2001/03/19 19:27:41 root Exp $
4  *
5  * Copyright (C) 1997-2012 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby 
9  * granted. No representations are made about the suitability of this software 
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17   
18 %{
19
20 /*
21  *      includes
22  */
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <assert.h>
26 #include <ctype.h>
27
28 #include "qtbc.h"
29 #include <qarray.h>
30 #include <qstack.h>
31 #include <qregexp.h>
32 #include <unistd.h>
33 #include <qfile.h>
34   
35 #include "scanner.h"
36 #include "entry.h"
37 #include "message.h"
38 #include "config.h"
39 #include "doxygen.h"
40 #include "util.h"
41 #include "defargs.h"
42 #include "language.h"
43 #include "commentscan.h"
44 #include "code.h"
45 #include "arguments.h"
46
47 #define YY_NEVER_INTERACTIVE 1
48 #define YY_NO_INPUT 1
49
50 /* -----------------------------------------------------------------
51  *
52  *      statics
53  */
54 static ParserInterface *g_thisParser;
55 static const char *     inputString;
56 static int              inputPosition;
57 static QFile            inputFile;
58 static int              lastContext;
59 static int              lastCContext;
60 static int              lastDocContext;
61 static int              lastCPPContext;
62 static int              lastSkipSharpContext;
63 static int              lastSkipRoundContext;
64 static int              lastStringContext;
65 static int              lastCurlyContext;
66 static int              lastRoundContext;
67 static int              lastSquareContext;
68 static int              lastInitializerContext;
69 static int              lastClassTemplSpecContext;
70 static int              lastPreLineCtrlContext;
71 static int              lastSkipVerbStringContext;
72 static int              lastCommentInArgContext;
73 static int              lastRawStringContext;
74 static int              lastCSConstraint;
75 static int              lastHereDocContext;
76 static int              lastDefineContext;
77 static Protection       protection;
78 static Protection       baseProt;
79 static int              sharpCount   = 0 ;
80 static int              roundCount   = 0 ;
81 static int              curlyCount   = 0 ;
82 static int              squareCount  = 0 ;
83 static int              padCount     = 0 ;
84 static QCString         slString;
85 static Entry*           current_root = 0 ;
86 static Entry*           global_root  = 0 ;
87 static Entry*           current      = 0 ;
88 static Entry*           previous     = 0 ;
89 static Entry*           tempEntry    = 0 ;
90 static Entry*           firstTypedefEntry = 0 ;
91 static Entry*           memspecEntry = 0 ;
92 static int              yyLineNr     = 1 ;
93 static int              anonCount    = 0 ;        
94 static int              anonNSCount  = 0 ;        
95 static QCString         yyFileName;
96 static MethodTypes      mtype;
97 static bool             gstat;
98 static bool             removeSlashes;
99 static Specifier        virt;
100 static Specifier        baseVirt;
101 static QCString         msType,msName,msArgs;
102 static bool             isTypedef;
103 static int              tmpDocType;
104 static QCString         sectionLabel;
105 static QCString         sectionTitle;
106 static QCString         funcPtrType;
107 static QCString         templateStr;
108 static QCString         aliasName;
109 static QCString         baseName;
110 static QCString*        specName;
111 static QCString         formulaText;
112 static QCString         formulaEnd;
113 static bool             useOverrideCommands = FALSE;
114
115 static SrcLangExt       language;
116 static bool             insideIDL   = FALSE;            //!< processing IDL code?
117 static bool             insideJava  = FALSE;            //!< processing Java code?
118 static bool             insideCS    = FALSE;            //!< processing C# code?
119 static bool             insideD     = FALSE;            //!< processing D code?
120 static bool             insidePHP   = FALSE;            //!< processing PHP code?
121 static bool             insideObjC  = FALSE;            //!< processing Objective C code?
122 static bool             insideCli   = FALSE;            //!< processing C++/CLI code?
123 static bool             insideJS    = FALSE;            //!< processing JavaScript code?
124 static bool             insideCpp   = TRUE;             //!< processing C/C++ code
125
126 static bool             insideCppQuote = FALSE;
127 static bool             insideProtocolList = FALSE;
128
129 static int              argRoundCount;
130 static int              argSharpCount;
131 static int              currentArgumentContext;
132 static int              lastCopyArgStringContext;
133 static int              lastCopyArgContext;
134 static QCString         *copyArgString;
135 static QCString         fullArgString;
136
137 static ArgumentList     *currentArgumentList;
138 static char             lastCopyArgChar;
139
140 static QCString         *pCopyQuotedString;
141 static QCString         *pCopyRoundString;
142 static QCString         *pCopyCurlyString;
143 static QCString         *pCopyRawString;
144
145 static QGString         *pCopyCurlyGString;
146 static QGString         *pCopyRoundGString;
147 static QGString         *pCopyQuotedGString;
148 static QGString         *pCopyHereDocGString;
149 static QGString         *pCopyRawGString;
150 static QGString         *pSkipVerbString;
151 static QStack<Grouping> autoGroupStack;
152
153 static bool             insideFormula;
154 static bool             insideTryBlock=FALSE;
155 static bool             insideCode;
156 static bool             needsSemi;
157
158 //static int              depthIf;
159 static int              initBracketCount;
160 static QCString         memberGroupRelates;
161 static QCString         memberGroupInside;
162 static QCString         xrefItemKey;
163 static QCString         xrefItemTitle;
164 static QCString         xrefListTitle;
165
166 static QCString         g_skipBlockName;
167 static QCString         oldStyleArgType;
168 static QCString         docBackup;
169 static QCString         briefBackup;
170 static bool             g_inputFromFile;
171
172 static int              docBlockContext;
173 static QGString         docBlock;
174 static QCString         docBlockName;
175 static bool             docBlockInBody;
176 static bool             docBlockAutoBrief;
177 static char             docBlockTerm;
178
179 static QCString         idlAttr;
180 static QCString         idlProp;
181
182 static bool             g_lexInit = FALSE;
183 static bool             externC;
184
185 static QCString         g_delimiter;
186
187 static int              g_column;
188
189 //-----------------------------------------------------------------------------
190
191 // forward declarations
192 //static void handleGroupStartCommand(const char *header);
193 //static void handleGroupEndCommand();
194
195 //-----------------------------------------------------------------------------
196
197 static void initParser()
198 {
199   sectionLabel.resize(0);
200   sectionTitle.resize(0);
201   baseName.resize(0);
202   formulaText.resize(0);
203   protection = Public;
204   baseProt = Public;
205   sharpCount = 0;
206   roundCount = 0;
207   curlyCount = 0;
208   mtype = Method;
209   gstat = FALSE;
210   virt = Normal;
211   baseVirt = Normal;
212   isTypedef = FALSE;
213   autoGroupStack.clear();
214   insideTryBlock = FALSE;
215   autoGroupStack.setAutoDelete(TRUE);
216   insideFormula = FALSE;
217   insideCode=FALSE;
218   insideCli=Config_getBool("CPP_CLI_SUPPORT");
219   previous = 0;
220 }
221
222 static void initEntry()
223 {
224   if (insideJava) 
225   {
226     protection = (current_root->spec & (Entry::Interface|Entry::Enum)) ?  Public : Package;
227   }
228   current->protection = protection ;
229   current->mtype      = mtype;
230   current->virt       = virt;
231   current->stat       = gstat;
232   current->lang       = language;
233   //printf("*** initEntry() language=%d\n",language);
234   //if (!autoGroupStack.isEmpty())
235   //{
236   //  //printf("Appending group %s\n",autoGroupStack.top()->groupname.data());
237   //  current->groups->append(new Grouping(*autoGroupStack.top()));
238   //}
239   initGroupInfo(current);
240   isTypedef=FALSE;
241 }
242
243
244 //-----------------------------------------------------------------------------
245
246 ///// remove any automatic grouping and add new one (if given)
247 //static void setCurrentGroup( QCString *newgroup, Grouping::GroupPri_t pri )
248 //{
249 //   /* remove auto group name from current entry and discard it */
250 //   Grouping *g = current->groups->first();
251 //   int i=0; 
252 //   while (g)
253 //   {
254 //     if (g->pri <= Grouping::GROUPING_AUTO_DEF)
255 //     {
256 //       current->groups->remove(i);
257 //       i--;
258 //     }
259 //     g=current->groups->next();
260 //     i++;
261 //   }
262 //
263 //   /* use new group name instead? */
264 //   if ( newgroup )
265 //   {
266 //      current->groups->append(new Grouping(*newgroup, pri));
267 //   } 
268 //}
269 //
270 //static int newMemberGroupId()
271 //{
272 //  static int curGroupId=0;
273 //  return curGroupId++;
274 //}
275 //
276 // forward declarations
277 //static void startGroupInDoc();
278 //static void endGroup();
279
280 //-----------------------------------------------------------------------------
281
282 static void lineCount()
283 {
284   static int tabSize = Config_getInt("TAB_SIZE");
285   const char *p;
286   for (p = yytext ; *p ; ++p )
287   {
288     if (*p=='\n') 
289       yyLineNr++,g_column=0;
290     else if (*p=='\t') 
291       g_column+=tabSize - (g_column%tabSize);
292     else 
293       g_column++;
294   }
295 }
296
297 static inline int computeIndent(const char *s,int startIndent)
298 {
299   int col=startIndent;
300   static int tabSize=Config_getInt("TAB_SIZE");
301   const char *p=s;
302   char c;
303   while ((c=*p++))
304   {
305     if (c=='\t') col+=tabSize-(col%tabSize);
306     else col++;
307   }
308   return col;
309 }
310
311 static void addType( Entry* current )
312 {
313     uint tl=current->type.length();
314     if( tl>0 && !current->name.isEmpty() && current->type.at(tl-1)!='.') 
315     {
316       current->type += ' ' ;
317     }
318     current->type += current->name ;
319     current->name.resize(0) ;
320     tl=current->type.length();
321     if( tl>0 && !current->args.isEmpty() && current->type.at(tl-1)!='.') 
322     {
323       current->type += ' ' ;
324     }
325     current->type += current->args ;
326     current->args.resize(0) ;
327     current->argList->clear();
328 }
329
330
331 static QCString stripQuotes(const char *s)
332 {
333   QCString name;
334   if (s==0 || *s==0) return name;
335   name=s;
336   if (name.at(0)=='"' && name.at(name.length()-1)=='"')
337   {
338     name=name.mid(1,name.length()-2);
339   }
340   return name;
341 }
342
343 //-----------------------------------------------------------------
344
345 static void startCommentBlock(bool);
346 static void handleCommentBlock(const QCString &doc,bool brief);
347 static void handleParametersCommentBlocks(ArgumentList *al);
348
349 //-----------------------------------------------------------------
350
351 static bool nameIsOperator(QCString &name)
352 {
353   int i=name.find("operator");
354   if (i==-1) return FALSE;
355   if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
356   if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
357   return FALSE; // case TEXToperatorTEXT
358 }
359
360 //-----------------------------------------------------------------------------
361
362 static void setContext()
363 {
364   QCString fileName = yyFileName;
365   language   = getLanguageFromFileName(fileName);
366   insideIDL  = language==SrcLangExt_IDL;
367   insideJava = language==SrcLangExt_Java;
368   insideCS   = language==SrcLangExt_CSharp; 
369   insideD    = language==SrcLangExt_D;
370   insidePHP  = language==SrcLangExt_PHP;
371   insideObjC = language==SrcLangExt_ObjC;
372   insideJS   = language==SrcLangExt_JS;
373   insideCpp  = language==SrcLangExt_Cpp;
374   if ( insidePHP )
375   {
376     useOverrideCommands = TRUE;
377   }
378   //printf("setContext(%s) insideIDL=%d insideJava=%d insideCS=%d "
379   //       "insideD=%d insidePHP=%d insideObjC=%d\n",
380   //       yyFileName.data(),insideIDL,insideJava,insideCS,insideD,insidePHP,insideObjC
381   //    );
382 }
383
384 //-----------------------------------------------------------------------------
385
386 static void prependScope()
387 {
388   if (current_root->section & Entry::SCOPE_MASK)
389   {
390     //printf("--- prependScope %s to %s\n",current_root->name.data(),current->name.data());
391     current->name.prepend(current_root->name+"::");
392     if (current_root->tArgLists)
393     {
394       if (current->tArgLists==0)
395       {
396         current->tArgLists = new QList<ArgumentList>;
397         current->tArgLists->setAutoDelete(TRUE);
398       }
399       //printf("prependScope #=%d #current=%d\n",current_root->tArgLists->count(),current->tArgLists->count());
400       QListIterator<ArgumentList> talsi(*current_root->tArgLists);
401       ArgumentList *srcAl=0;
402       for (talsi.toLast();(srcAl=talsi.current());--talsi)
403       {
404         ArgumentList *dstAl = new ArgumentList;
405         QListIterator<Argument> tali(*srcAl);
406         Argument *a;
407         for (;(a=tali.current());++tali)
408         {
409           dstAl->append(new Argument(*a));
410         //printf("appending argument %s %s\n",a->type.data(),a->name.data());
411         }         
412         current->tArgLists->insert(0,dstAl);    
413       }
414     }
415   }
416 }
417
418 //-----------------------------------------------------------------------------
419
420 /*! Returns TRUE iff the current entry could be a K&R style C function */
421 static bool checkForKnRstyleC()
422 {
423   if (((QCString)yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file
424   if (!current->argList) return FALSE; // must have arguments
425   ArgumentListIterator ali(*current->argList);
426   Argument *a;
427   for (ali.toFirst();(a=ali.current());++ali)
428   {
429     // in K&R style argument do not have a type, but doxygen expects a type
430     // so it will think the argument has no name
431     if (a->type.isEmpty() || !a->name.isEmpty()) return FALSE;
432   }
433   return TRUE;
434 }
435
436 //-----------------------------------------------------------------------------
437
438 static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName)
439 {
440   int si = current->args.length();
441   if (oldStyleArgType.isEmpty()) // new argument
442   {
443     static QRegExp re("([^)]*)");
444     int bi1 = current->args.findRev(re);
445     int bi2 = bi1!=-1 ? current->args.findRev(re,bi1-1) : -1; 
446     char c;
447     if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
448     {
449       int s=bi2+1;
450       oldStyleArgType = current->args.left(s);
451       int i=s;
452       while (i<si && ((c=current->args.at(i))=='*' || isspace((uchar)c))) i++;
453       oldStyleArgType += current->args.mid(s,i-s);
454       s=i;
455       while (i<si && isId(current->args.at(i))) i++;
456       oldStyleArgName = current->args.mid(s,i-s);
457       oldStyleArgType+=current->args.mid(i);
458     }
459     else if (bi1!=-1) // redundant braces like in "int (*var)"
460     {
461       int s=bi1;
462       oldStyleArgType = current->args.left(s);
463       s++;
464       int i=s+1;
465       while (i<si && ((c=current->args.at(i))=='*' || isspace((uchar)c))) i++;
466       oldStyleArgType += current->args.mid(s,i-s);
467       s=i;
468       while (i<si && isId(current->args.at(i))) i++;
469       oldStyleArgName = current->args.mid(s,i-s);
470     }
471     else // normal "int *var"
472     {
473       int l=si,i=l-1,j;
474       char c;
475       // look for start of name in "type *name"
476       while (i>=0 && isId(current->args.at(i))) i--;
477       j=i+1;
478       // look for start of *'s
479       while (i>=0 && ((c=current->args.at(i))=='*' || isspace((uchar)c))) i--;
480       i++;
481       if (i!=l)
482       {
483         oldStyleArgType=current->args.left(i);
484         oldStyleArgPtr=current->args.mid(i,j-i);
485         oldStyleArgName=current->args.mid(j).stripWhiteSpace();
486       }
487       else
488       {
489         oldStyleArgName=current->args.copy().stripWhiteSpace();
490       }
491     }
492   }
493   else // continuation like *arg2 in "int *args,*arg2"
494   {
495     int l=si,j=0;
496     char c;
497     while (j<l && ((c=current->args.at(j))=='*' || isspace((uchar)c))) j++;
498     if (j>0)
499     {
500       oldStyleArgPtr=current->args.left(j);
501       oldStyleArgName=current->args.mid(j).stripWhiteSpace();
502     }
503     else
504     {
505       oldStyleArgName=current->args.copy().stripWhiteSpace();
506     }
507   }
508   //fprintf(stderr,"type=%s ptr=%s name=%s\n",oldStyleArgType.data(),oldStyleArgPtr.data(),oldStyleArgName.data());
509 }
510
511 //-----------------------------------------------------------------------------
512
513 /*! Update the argument \a name with additional \a type info. For K&R style
514  *  function the type is found \e after the argument list, so this routine
515  *  in needed to fix up.
516  */
517 static void addKnRArgInfo(const QCString &type,const QCString &name,
518                           const QCString &brief,const QCString &docs)
519 {
520   if (current->argList==0) return;
521   ArgumentListIterator ali(*current->argList);
522   Argument *a;
523   for (ali.toFirst();(a=ali.current());++ali)
524   {
525     if (a->type==name)
526     {
527       a->type=type.stripWhiteSpace();
528       if (a->type.left(9)=="register ") // strip keyword
529       {
530         a->type=a->type.mid(9);
531       }
532       a->name=name.stripWhiteSpace();
533       if (!brief.isEmpty() && !docs.isEmpty())
534       {
535         a->docs=brief+"\n\n"+docs;
536       }
537       else if (!brief.isEmpty())
538       {
539         a->docs=brief;
540       }
541       else
542       {
543         a->docs=docs;
544       }
545     }
546   }
547 }
548
549 //-----------------------------------------------------------------------------
550
551
552 void fixArgumentListForJavaScript(ArgumentList *al)
553 {
554   if (al==0) return;
555   ArgumentListIterator ali(*al);
556   Argument *a;
557   for (ali.toFirst();(a=ali.current());++ali)
558   {
559     if (!a->type.isEmpty() && a->name.isEmpty())
560     { // a->type is actually the (typeless) parameter name, so move it
561       a->name=a->type;
562       a->type.resize(0);
563     }
564   }
565 }
566
567 /* ----------------------------------------------------------------- */
568 #undef  YY_INPUT
569 #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
570
571 static int yyread(char *buf,int max_size)
572 {
573     int c=0;
574     if (g_inputFromFile)
575     {
576        c = inputFile.readBlock(buf,max_size);
577        if (c==-1) yy_fatal_error("input in flex scanner failed");
578     }
579     else
580     {
581       while( c < max_size && inputString[inputPosition] )
582       {
583         *buf = inputString[inputPosition++] ;
584         //printf("%d (%c)\n",*buf,*buf);
585         c++; buf++;
586       }
587     }
588     return c;
589 }
590
591 %}
592
593        /* start command character */
594 CMD       ("\\"|"@")
595 SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"xrefitem"|"ingroup"|"callgraph"|"callergraph"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"{"|"verbatim"|"dotfile"|"dot"|"defgroup"|"addtogroup"|"weakgroup"|"class"|"namespace"|"union"|"struct"|"fn"|"var"|"details"|"typedef"|"def"|"overload")|("<"{PRE}">")
596 BN        [ \t\n\r]
597 BL        [ \t\r]*"\n" 
598 B         [ \t]
599 BS        ^(({B}*"//")?)(({B}*"*"+)?){B}*
600 FILESCHAR [a-z_A-Z0-9\x80-\xFF\\:\\\/\-\+]
601 FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+]
602 FILE      ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]+"\"")
603 ID        "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*
604 SCOPEID   {ID}({ID}*{BN}*"::"{BN}*)*({ID}?)
605 SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)(((~|!){BN}*)?{ID})
606 PHPSCOPENAME ({ID}"\\")+{ID}
607 TSCOPE    {ID}("<"[a-z_A-Z0-9 \t\*\&,:]*">")?
608 CSSCOPENAME (({ID}?{BN}*"."{BN}*)*)((~{BN}*)?{ID})
609 PRE       [pP][rR][eE]
610 CODE      [cC][oO][dD][eE]
611 CHARLIT   (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
612 PHPKW     ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;]
613 IDLATTR   ("["[^\]]*"]"){BN}*
614 TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
615 RAWBEGIN  (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
616 RAWEND    ")"[^ \t\(\)\\]{0,16}\"
617
618 %option noyywrap
619
620   /* language parsing states */
621
622 %x      Define
623 %x      DefineEnd
624 %x      CompoundName
625 %x      ClassVar
626 %x      CSConstraintName
627 %x      CSConstraintType
628 %x      CSIndexer
629 %x      ClassCategory
630 %x      ClassTemplSpec
631 %x      CliPropertyType
632 %x      CliPropertyIndex
633 %x      CliOverride
634 %x      Bases
635 %x      BasesProt
636 %x      NextSemi
637 %x      BitFields
638 %x      EnumBaseType
639 %x      FindMembers
640 %x      FindMembersPHP
641 %x      FindMemberName
642 %x      FindFields
643 %x      FindFieldArg
644 %x      Function
645 %x      FuncRound
646 %x      ExcpRound
647 %x      ExcpList
648 %x      FuncQual
649 %x      TrailingReturn
650 %x      Operator
651 %x      Array
652 %x      ReadBody
653 %x      ReadNSBody
654 %x      ReadBodyIntf
655 %x      Using
656 %x      UsingAlias
657 %x      UsingDirective
658 %x      SkipCurly
659 %x      SkipCurlyCpp
660 %x      SkipCurlyEndDoc
661 %x      SkipString
662 %x      SkipPHPString
663 %x      SkipInits
664 %x      SkipCPP
665 %x      SkipCPPBlock
666 %x      SkipComment
667 %x      SkipCxxComment
668 %x      SkipCurlyBlock
669 %x      SkipRoundBlock
670 %x      Sharp
671 %x      SkipSharp
672 %x      SkipRound
673 %x      SkipSquare
674 %x      SkipRemainder
675 %x      StaticAssert
676 %x      DeclType
677 %x      TypedefName
678 %x      TryFunctionBlock
679 %x      TryFunctionBlockEnd
680 %x      Comment
681 %x      PackageName
682 %x      JavaImport
683 %x      PHPUse
684 %x      PHPUseAs
685 %x      CSAccessorDecl
686 %x      CSGeneric
687 %x      PreLineCtrl
688 %x      DefinePHP
689 %x      DefinePHPEnd
690 %x      OldStyleArgs
691 %x      SkipVerbString
692 %x      ObjCMethod
693 %x      ObjCReturnType
694 %x      ObjCParams
695 %x      ObjCParamType
696 %x      ObjCProtocolList
697 %x      ObjCPropAttr
698 %x      ObjCSkipStatement
699 %x      QtPropType
700 %x      QtPropName
701 %x      QtPropAttr
702 %x      QtPropRead
703 %x      QtPropWrite
704 %x      ReadInitializer
705 %x      GetCallType
706 %x      CppQuote
707 %x      EndCppQuote
708 %x      MemberSpec
709 %x      MemberSpecSkip
710 %x      EndTemplate
711 %x      FuncPtr
712 %x      FuncPtrOperator
713 %x      EndFuncPtr
714 %x      ReadFuncArgType
715 %x      ReadTempArgs
716 %x      IDLUnionCase
717 %x      NSAliasName
718 %x      NSAliasArg
719 %x      CopyString
720 %x      CopyPHPString
721 %x      CopyGString
722 %x      CopyPHPGString
723 %x      CopyRound
724 %x      CopyCurly
725 %x      GCopyRound
726 %x      GCopyCurly
727 %x      SkipUnionSwitch
728 %x      Specialization
729 %x      FuncPtrInit
730 %x      FuncFunc
731 %x      FuncFuncEnd
732 %x      FuncFuncType
733 %x      FuncFuncArray
734 %x      CopyArgString
735 %x      CopyArgPHPString
736 %x      CopyArgRound
737 %x      CopyArgSharp
738 %x      CopyArgComment
739 %x      CopyArgCommentLine
740 %x      CopyArgVerbatim
741 %x      HereDoc
742 %x      HereDocEnd
743 %x      CopyHereDoc
744 %x      CopyHereDocEnd
745 %x      RawString
746 %x      RawGString
747
748 %x      IDLAttribute
749 %x      IDLProp
750 %x      IDLPropName
751
752  /** Prototype scanner states */
753
754 %x      Prototype
755 %x      PrototypePtr
756 %x      PrototypeQual
757 %x      PrototypeExc
758 %x      PrototypeSkipLine
759
760  /** comment parsing states */
761
762 %x      DocLine
763 %x      DocBlock
764 %x      DocCopyBlock
765
766 %%
767
768 <NextSemi>"{"                           {
769                                           curlyCount=0;
770                                           needsSemi = TRUE;
771                                           BEGIN(SkipCurlyBlock); 
772                                         }
773 <NextSemi>"("                           {
774                                           roundCount=0;
775                                           BEGIN(SkipRoundBlock);
776                                         }
777 <SkipRoundBlock>"("                     {
778                                           ++roundCount;
779                                         }
780 <SkipRoundBlock>")"                     {
781                                           if (roundCount )
782                                             --roundCount ;
783                                           else
784                                             BEGIN( NextSemi ) ;
785                                         }
786 <SkipCurlyBlock>"{"                     {
787                                           ++curlyCount ; 
788                                         }
789 <SkipCurlyBlock>"}"                     { 
790                                           if( curlyCount )
791                                           {
792                                             --curlyCount ;
793                                           }
794                                           else if (needsSemi)
795                                           {
796                                             BEGIN( NextSemi );
797                                           }
798                                           else
799                                           {
800                                             BEGIN( FindMembers );
801                                           }
802                                         }
803 <NextSemi>\'                            {
804                                           if (insidePHP)
805                                           {
806                                             lastStringContext=NextSemi;
807                                             BEGIN(SkipPHPString);
808                                           }
809                                         }
810 <NextSemi>{CHARLIT}                     { if (insidePHP) REJECT; }
811 <NextSemi>\"                            {
812                                           lastStringContext=NextSemi;
813                                           BEGIN(SkipString);
814                                         }
815 <NextSemi>[;,]                          { 
816                                           unput(*yytext);
817                                           BEGIN( FindMembers ); 
818                                         }
819 <BitFields>[;,]                         {
820                                           unput(*yytext);
821                                           BEGIN( FindMembers );
822                                         }
823 <EnumBaseType>[{;,]                     {
824                                           current->args = current->args.simplifyWhiteSpace();
825                                           unput(*yytext);
826                                           BEGIN( ClassVar );
827                                         }
828 <FindMembers>"<?php"                    { // PHP code with unsupported extension?
829                                           insidePHP = TRUE;
830                                         }
831 <FindMembersPHP>"<?"("php"?)            { // PHP code start
832                                            BEGIN( FindMembers );
833                                         }
834 <FindMembersPHP>"<script"{BN}+"language"{BN}*"="{BN}*['"]?"php"['"]?{BN}*">" { // PHP code start
835                                           lineCount() ;
836                                           BEGIN( FindMembers );
837                                         }
838 <FindMembersPHP>[^\n<]+                 { // Non-PHP code text, ignore
839                                         }
840 <FindMembersPHP>\n                      { // Non-PHP code text, ignore
841                                           lineCount();
842                                         }
843 <FindMembersPHP>.                       { // Non-PHP code text, ignore
844                                         }
845 <FindMembers>"?>"|"</script>"           { // PHP code end
846                                           if (insidePHP)
847                                             BEGIN( FindMembersPHP );
848                                           else
849                                             REJECT;
850                                         }
851 <FindMembers>{PHPKW}                    { if (insidePHP)
852                                             BEGIN( NextSemi );
853                                           else
854                                             REJECT;
855                                         }
856 <FindMembers>"%{"[^\n]*                 { // Mozilla XPIDL lang-specific block
857                                           if (!insideIDL)
858                                             REJECT;
859                                         }
860 <FindMembers>"%}"                       { // Mozilla XPIDL lang-specific block end
861                                           if (!insideIDL)
862                                             REJECT;
863                                         }
864 <FindMembers>{B}*("properties"){BN}*":"{BN}*  { // IDL or Borland C++ builder property 
865                                           current->mtype = mtype = Property;
866                                           current->protection = protection = Public ;
867                                           current->type.resize(0); 
868                                           current->name.resize(0); 
869                                           current->args.resize(0);
870                                           current->argList->clear();
871                                           lineCount() ;
872                                         }
873
874 <FindMembers>{B}*"k_dcop"{BN}*":"{BN}*  { current->mtype = mtype = DCOP;
875                                           current->protection = protection = Public ;
876                                           current->type.resize(0); 
877                                           current->name.resize(0); 
878                                           current->args.resize(0);
879                                           current->argList->clear();
880                                           lineCount() ;
881                                         }
882
883 <FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { current->mtype = mtype = Signal;
884   
885                                           current->protection = protection = Public ;
886                                           current->type.resize(0); 
887                                           current->name.resize(0); 
888                                           current->args.resize(0);
889                                           current->argList->clear();
890                                           lineCount() ;
891                                         }
892
893 <FindMembers>{B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
894                                           current->protection = protection = Public ;
895                                           current->mtype = mtype = Slot;
896                                           current->type.resize(0); 
897                                           current->name.resize(0); 
898                                           current->args.resize(0);
899                                           current->argList->clear();
900                                           lineCount();
901                                         }
902
903 <FindMembers>{B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
904                                           current->protection = protection = Protected ;
905                                           current->mtype = mtype = Slot;
906                                           current->type.resize(0); 
907                                           current->name.resize(0); 
908                                           current->args.resize(0);
909                                           current->argList->clear();
910                                           lineCount();
911                                         }
912
913 <FindMembers>{B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
914                                           current->protection = protection = Private ;
915                                           current->mtype = mtype = Slot;
916                                           current->type.resize(0); 
917                                           current->name.resize(0); 
918                                           current->args.resize(0);
919                                           current->argList->clear();
920                                           lineCount();
921                                         }
922 <FindMembers>{B}*("public"|"methods"|"__published"){BN}*":"{BN}* { 
923                                           current->protection = protection = Public ;
924                                           current->mtype = mtype = Method;
925                                           current->type.resize(0); 
926                                           current->name.resize(0); 
927                                           current->args.resize(0);
928                                           current->argList->clear();
929                                           lineCount() ;
930                                         }
931 <FindMembers>{B}*"internal"{BN}*":"{BN}* {  // for now treat C++/CLI's internal as package...
932                                           if (insideCli)
933                                           {
934                                             current->protection = protection = Package ;
935                                             current->mtype = mtype = Method;
936                                             current->type.resize(0); 
937                                             current->name.resize(0); 
938                                             current->args.resize(0);
939                                             current->argList->clear();
940                                             lineCount() ;
941                                           }
942                                           else
943                                           {
944                                             REJECT;
945                                           }
946                                         }
947 <FindMembers>{B}*"protected"{BN}*":"{BN}* {  
948                                           current->protection = protection = Protected ;
949                                           current->mtype = mtype = Method;
950                                           current->type.resize(0); 
951                                           current->name.resize(0); 
952                                           current->args.resize(0);
953                                           current->argList->clear();
954                                           lineCount() ;
955                                         }
956 <FindMembers>{B}*"private"{BN}*":"{BN}* { 
957                                           current->protection = protection = Private ;
958                                           current->mtype = mtype = Method;
959                                           current->type.resize(0); 
960                                           current->name.resize(0); 
961                                           current->args.resize(0);
962                                           current->argList->clear();
963                                           lineCount() ;
964                                         }
965 <FindMembers>{B}*"event"{BN}+           { 
966                                           if (insideCli)
967                                           {
968                                             // C++/CLI event
969                                             lineCount() ;
970                                             current->mtype = mtype = Event;
971                                             current->bodyLine = yyLineNr;
972                                             curlyCount=0;
973                                             BEGIN( CliPropertyType );
974                                           }
975                                           else if (insideCS)
976                                           {
977                                             lineCount() ;
978                                             current->mtype = Event;
979                                             current->bodyLine = yyLineNr;
980                                           }
981                                           else
982                                           {
983                                             REJECT;
984                                           }
985                                         }
986 <FindMembers>{B}*"property"{BN}+        {
987                                            if (insideCli)
988                                            {
989                                              // C++/CLI property
990                                              lineCount() ;
991                                              current->mtype = mtype = Property;
992                                              current->bodyLine = yyLineNr;
993                                              curlyCount=0;
994                                              BEGIN( CliPropertyType );
995                                            }
996                                            else
997                                            {
998                                              REJECT;
999                                            }
1000                                         }
1001 <CliPropertyType>{ID}                   {
1002                                           addType( current );
1003                                           current->name = yytext;
1004                                         }
1005 <CliPropertyType>"["                    { // C++/CLI indexed property
1006                                           current->name += yytext;
1007                                           BEGIN( CliPropertyIndex );
1008                                         }
1009 <CliPropertyType>"{"                    {
1010                                           curlyCount=0;
1011                                           //printf("event: '%s' '%s'\n",current->type.data(),current->name.data());
1012                                           BEGIN( CSAccessorDecl );
1013                                         }
1014 <CliPropertyType>";"                    {
1015                                           unput(*yytext);
1016                                           BEGIN( FindMembers );
1017                                         }
1018 <CliPropertyType>\n                     {
1019                                           lineCount();
1020                                         }
1021 <CliPropertyType>{B}*                   {
1022                                         }
1023 <CliPropertyType>.                      {
1024                                           addType( current );
1025                                           current->type += yytext;
1026                                         }
1027 <CliPropertyIndex>"]"                   {
1028                                           BEGIN( CliPropertyType );
1029                                           current->name+=yytext;
1030                                         }
1031 <CliPropertyIndex>.                     {
1032                                           current->name+=yytext;
1033                                         }
1034   /*
1035 <FindMembers>{B}*"property"{BN}+        { 
1036                                           if (!current->type.isEmpty())
1037                                           {
1038                                             REJECT;
1039                                           }
1040                                           else
1041                                           { 
1042                                             current->mtype = mtype = Property;
1043                                             lineCount();
1044                                           }
1045                                         }
1046   */
1047 <FindMembers>{B}*"@private"{BN}+        {
1048                                           current->protection = protection = Private ;
1049                                           current->mtype = mtype = Method;
1050                                           current->type.resize(0); 
1051                                           current->name.resize(0); 
1052                                           current->args.resize(0);
1053                                           current->argList->clear();
1054                                           lineCount() ;
1055                                         }
1056 <FindMembers>{B}*"@protected"{BN}+      {
1057                                           current->protection = protection = Protected ;
1058                                           current->mtype = mtype = Method;
1059                                           current->type.resize(0); 
1060                                           current->name.resize(0); 
1061                                           current->args.resize(0);
1062                                           current->argList->clear();
1063                                           lineCount() ;
1064                                         }
1065 <FindMembers>{B}*"@public"{BN}+ {
1066                                           current->protection = protection = Public ;
1067                                           current->mtype = mtype = Method;
1068                                           current->type.resize(0); 
1069                                           current->name.resize(0); 
1070                                           current->args.resize(0);
1071                                           current->argList->clear();
1072                                           lineCount() ;
1073                                         }
1074 <FindMembers>[\-+]{BN}*                 {
1075                                           if (!insideObjC) 
1076                                           {
1077                                             REJECT;
1078                                           }
1079                                           else
1080                                           {
1081                                             lineCount();
1082                                             current->fileName  = yyFileName;
1083                                             current->startLine = yyLineNr;
1084                                             current->bodyLine  = yyLineNr;
1085                                             current->section = Entry::FUNCTION_SEC;
1086                                             current->protection = protection = Public ;
1087                                             language = current->lang = SrcLangExt_ObjC;
1088                                             insideObjC = TRUE;
1089                                             current->virt = Virtual;
1090                                             current->stat=yytext[0]=='+';
1091                                             current->mtype = mtype = Method;
1092                                             current->type.resize(0); 
1093                                             current->name.resize(0); 
1094                                             current->args.resize(0);
1095                                             current->argList->clear();
1096                                             BEGIN( ObjCMethod );
1097                                           }
1098                                         }
1099 <ObjCMethod>"("                         { // start of method's return type
1100                                           BEGIN( ObjCReturnType );
1101                                         }
1102 <ObjCMethod>{ID}                        { // found method name
1103                                           if (current->type.isEmpty())
1104                                           {
1105                                             current->type = "id";
1106                                           }
1107                                           current->name = yytext;
1108                                         }
1109 <ObjCMethod>":"{B}*                     { // start of parameter list
1110                                           current->name += ':';
1111                                           Argument *a = new Argument;
1112                                           current->argList->append(a);
1113                                           BEGIN( ObjCParams );
1114                                         }
1115 <ObjCReturnType>[^)]*                   { // TODO: check if nested braches are possible.
1116                                           current->type = yytext;
1117                                         }
1118 <ObjCReturnType>")"                     {
1119                                           BEGIN( ObjCMethod );
1120                                         }
1121 <ObjCParams>({ID})?":"                  { // Keyword of parameter
1122                                           QCString keyw = yytext;
1123                                           keyw=keyw.left(keyw.length()-1); // strip :
1124                                           if (keyw.isEmpty())
1125                                           {
1126                                             current->name += " :";
1127                                           }
1128                                           else
1129                                           {
1130                                             current->name += keyw+":";
1131                                           }
1132                                           if (current->argList->getLast()->type.isEmpty())
1133                                           {
1134                                             current->argList->getLast()->type="id";
1135                                           }
1136                                           Argument *a = new Argument;
1137                                           a->attrib=(QCString)"["+keyw+"]";
1138                                           current->argList->append(a);
1139                                         }
1140 <ObjCParams>{ID}{BN}*                   { // name of parameter
1141                                           lineCount();
1142                                           current->argList->getLast()->name=QCString(yytext).stripWhiteSpace();
1143                                         }
1144 <ObjCParams>","{BN}*"..."               { // name of parameter
1145                                           lineCount();
1146                                           // do we want the comma as part of the name?
1147                                           //current->name += ",";
1148                                           Argument *a = new Argument;
1149                                           a->attrib="[,]";
1150                                           a->type="...";
1151                                           current->argList->append(a);
1152                                         }
1153    /*
1154 <ObjCParams>":"                         { 
1155                                           current->name += ':';
1156                                         }
1157    */
1158 <ObjCParams>"("                         {
1159                                           BEGIN( ObjCParamType );
1160                                         }
1161 <ObjCParamType>[^)]*                    {
1162                                           current->argList->getLast()->type=QCString(yytext).stripWhiteSpace();
1163                                         }
1164 <ObjCParamType>")"/{B}*                 {
1165                                           BEGIN( ObjCParams );
1166                                         }
1167 <ObjCMethod,ObjCParams>";"              { // end of method declaration
1168                                           if (current->argList->getLast() && current->argList->getLast()->type.isEmpty())
1169                                           {
1170                                             current->argList->getLast()->type="id";
1171                                           }
1172                                           current->args = argListToString(current->argList);
1173                                           //printf("argList=%s\n",current->args.data());
1174                                           unput(';');
1175                                           BEGIN( Function );
1176                                         }
1177 <ObjCMethod,ObjCParams>(";"{BN}+)?"{"   { // start of a method body
1178                                           lineCount();
1179                                           //printf("Type=%s Name=%s args=%s\n",
1180                                           //    current->type.data(),current->name.data(),argListToString(current->argList).data()
1181                                           //    );
1182                                           if (current->argList->getLast() && current->argList->getLast()->type.isEmpty())
1183                                           {
1184                                             current->argList->getLast()->type="id";
1185                                           }
1186                                           current->args = argListToString(current->argList);
1187                                           unput('{');
1188                                           BEGIN( Function );
1189                                         }
1190 <FindMembers>{BN}{1,80}                 {
1191                                           lineCount();
1192                                         }
1193 <FindMembers>"@"({ID}".")*{ID}{BN}*"("  {
1194                                           if (insideJava) // Java annotation
1195                                           {
1196                                             lineCount();
1197                                             lastSkipRoundContext = YY_START;
1198                                             roundCount=1;
1199                                             BEGIN( SkipRound );
1200                                           }
1201                                           else if (strncmp(yytext,"@property",9)==0) // ObjC 2.0 property
1202                                           {
1203                                             current->mtype = mtype = Property;
1204                                             current->spec|=Entry::Readable | Entry::Writable | Entry::Assign;
1205                                             current->protection = Public ;
1206                                             unput('(');
1207                                             BEGIN( ObjCPropAttr );
1208                                           }
1209                                           else
1210                                           {
1211                                             REJECT;
1212                                           }
1213                                         }
1214 <ObjCPropAttr>"getter="{ID}             { 
1215                                           current->read = yytext+7;
1216                                         }
1217 <ObjCPropAttr>"setter="{ID}             { 
1218                                           current->write = yytext+7;
1219                                         }
1220 <ObjCPropAttr>"readonly"                {
1221                                           current->spec&=~Entry::Writable;
1222                                         }
1223 <ObjCPropAttr>"readwrite"               { // default
1224                                         }
1225 <ObjCPropAttr>"assign"                  { // default
1226                                         }
1227 <ObjCPropAttr>"unsafe_unretained"       {
1228                                           current->spec&=~Entry::Assign;
1229                                           current->spec|=Entry::Unretained;
1230                                         }
1231 <ObjCPropAttr>"retain"                  {
1232                                           current->spec&=~Entry::Assign;
1233                                           current->spec|=Entry::Retain;
1234                                         }
1235 <ObjCPropAttr>"copy"                    {
1236                                           current->spec&=~Entry::Assign;
1237                                           current->spec|=Entry::Copy;
1238                                         }
1239 <ObjCPropAttr>"weak"                    {
1240                                           current->spec&=~Entry::Assign;
1241                                           current->spec|=Entry::Weak;
1242                                         }
1243 <ObjCPropAttr>"strong"                  {
1244                                           current->spec&=~Entry::Assign;
1245                                           current->spec|=Entry::Strong;
1246                                         }
1247 <ObjCPropAttr>"nonatomic"               {
1248                                           current->spec|=Entry::NonAtomic;
1249                                         }
1250 <ObjCPropAttr>")"                       {
1251                                           BEGIN(FindMembers);
1252                                         }
1253 <FindMembers>"@"{ID}                    {
1254                                           if (insideJava) // Java annotation
1255                                           {
1256                                             // skip annotation
1257                                           }
1258                                           else if (strcmp(yytext,"@property")==0) // ObjC 2.0 property
1259                                           {
1260                                             current->mtype = mtype = Property;
1261                                             current->spec|=Entry::Writable | Entry::Readable;
1262                                             current->protection = Public ;
1263                                           }
1264                                           else if (strcmp(yytext,"@synthesize")==0)
1265                                           {
1266                                             BEGIN( ObjCSkipStatement );
1267                                           }
1268                                           else if (strcmp(yytext,"@dynamic")==0)
1269                                           {
1270                                             BEGIN( ObjCSkipStatement );
1271                                           }
1272                                           else
1273                                           {
1274                                             REJECT;
1275                                           }
1276                                         }
1277 <ObjCSkipStatement>";"                  {
1278                                           BEGIN(FindMembers);
1279                                         }
1280 <PackageName>{ID}(("."|"\\"){ID})*      {
1281                                           isTypedef=FALSE;
1282                                           //printf("Found namespace %s lang=%d\n",yytext,current->lang);
1283                                           current->name = yytext;
1284                                           current->name = substitute(current->name,".","::");
1285                                           current->name = substitute(current->name,"\\","::");
1286                                           current->section = Entry::NAMESPACE_SEC;
1287                                           current->type = "namespace" ;
1288                                           current->fileName  = yyFileName;
1289                                           current->startLine = yyLineNr;
1290                                           current->bodyLine  = yyLineNr;
1291                                           lineCount();
1292                                         }
1293 <PackageName>";"                        {
1294                                           current_root->addSubEntry(current);
1295                                           current_root = current ;
1296                                           current = new Entry ;
1297                                           initEntry();
1298                                           BEGIN(FindMembers);
1299                                         }
1300 <PackageName>"{"                        {
1301                                           curlyCount=0;
1302                                           BEGIN( ReadNSBody );
1303                                         }
1304 <FindMembers>{B}*"initonly"{BN}+        {
1305                                           current->type += " initonly ";
1306                                           if (insideCli) current->spec |= Entry::Initonly;
1307                                           lineCount();
1308                                         }
1309 <FindMembers>{B}*"static"{BN}+          { current->type += " static ";
1310                                           current->stat = TRUE;
1311                                           lineCount();
1312                                         }
1313 <FindMembers>{B}*"extern"{BN}+          {
1314                                           current->stat = FALSE;
1315                                           current->explicitExternal = TRUE;
1316                                           lineCount();
1317                                         }
1318 <FindMembers>{B}*"virtual"{BN}+         { current->type += " virtual ";
1319                                           current->virt = Virtual;
1320                                           lineCount();
1321                                         }
1322 <FindMembers>{B}*"abstract"{BN}+        { 
1323                                           if (!insidePHP) 
1324                                           {
1325                                             current->type += " abstract ";
1326                                             current->virt = Pure;
1327                                           }
1328                                           else
1329                                           {
1330                                             current->spec|=Entry::Abstract;
1331                                           }
1332                                           lineCount();
1333                                         }
1334 <FindMembers>{B}*"inline"{BN}+          { current->spec|=Entry::Inline;
1335                                           lineCount(); 
1336                                         }
1337 <FindMembers>{B}*"mutable"{BN}+         { current->spec|=Entry::Mutable;
1338                                           lineCount(); 
1339                                         }
1340 <FindMembers>{B}*"explicit"{BN}+        { current->spec|=Entry::Explicit;
1341                                           lineCount(); 
1342                                         }
1343 <FindMembers>{B}*"@required"{BN}+       { // Objective C 2.0 protocol required section
1344                                           current->spec=(current->spec & ~Entry::Optional) | Entry::Required;
1345                                           lineCount(); 
1346                                         }
1347 <FindMembers>{B}*"@optional"{BN}+       {  // Objective C 2.0 protocol optional section
1348                                           current->spec=(current->spec & ~Entry::Required) | Entry::Optional;
1349                                           lineCount(); 
1350                                         }
1351   /*
1352 <FindMembers>{B}*"import"{BN}+          { // IDL import keyword
1353                                           BEGIN( NextSemi );
1354                                         }
1355   */
1356 <FindMembers>{B}*"typename"{BN}+        { lineCount(); }
1357 <FindMembers>{B}*"namespace"{BN}*/[^a-z_A-Z0-9] { 
1358                                           isTypedef=FALSE;
1359                                           current->section = Entry::NAMESPACE_SEC;
1360                                           current->type = "namespace" ;
1361                                           current->fileName  = yyFileName;
1362                                           current->startLine = yyLineNr;
1363                                           current->bodyLine  = yyLineNr;
1364                                           lineCount();
1365                                           if (insidePHP)
1366                                           {
1367                                             BEGIN( PackageName );
1368                                           }
1369                                           else
1370                                           {
1371                                             BEGIN( CompoundName ); 
1372                                           }
1373                                         }
1374 <FindMembers>{B}*"module"{BN}+          { 
1375                                           lineCount();
1376                                           if (insideIDL)
1377                                           {
1378                                             isTypedef=FALSE;
1379                                             current->section = Entry::NAMESPACE_SEC;
1380                                             current->type = "module" ;
1381                                             current->fileName  = yyFileName;
1382                                             current->startLine = yyLineNr;
1383                                             current->bodyLine  = yyLineNr;
1384                                             BEGIN( CompoundName ); 
1385                                           }
1386                                           else if (insideD)
1387                                           {
1388                                             lineCount();
1389                                             BEGIN(PackageName);
1390                                           }
1391                                           else
1392                                           {
1393                                             addType( current ) ;
1394                                             current->name = QCString(yytext).stripWhiteSpace();
1395                                           }
1396                                         }
1397 <FindMembers>{B}*"library"{BN}+         { 
1398                                           lineCount();
1399                                           if (insideIDL)
1400                                           {
1401                                             isTypedef=FALSE;
1402                                             current->section = Entry::NAMESPACE_SEC;
1403                                             current->type = "library" ;
1404                                             current->fileName  = yyFileName;
1405                                             current->startLine = yyLineNr;
1406                                             current->bodyLine  = yyLineNr;
1407                                             BEGIN( CompoundName ); 
1408                                           }
1409                                           else
1410                                           {
1411                                             addType( current ) ;
1412                                             current->name = QCString(yytext).stripWhiteSpace();
1413                                           }
1414                                         }
1415 <FindMembers>{B}*((("disp")?"interface")|"valuetype"){BN}+      { // M$/Corba IDL/Java interface
1416                                           lineCount();
1417                                           if (insideIDL || insideJava || insideCS || insideD || insidePHP)
1418                                           {
1419                                             isTypedef=FALSE;
1420                                             current->section = Entry::CLASS_SEC;
1421                                             current->spec = Entry::Interface;
1422                                             addType( current ) ;
1423                                             current->type += " interface" ;
1424                                             current->fileName  = yyFileName;
1425                                             current->startLine = yyLineNr;
1426                                             current->bodyLine  = yyLineNr;
1427                                             BEGIN( CompoundName );
1428                                           }
1429                                           else
1430                                           {
1431                                             addType( current ) ;
1432                                             current->name = QCString(yytext).stripWhiteSpace();
1433                                           }
1434                                         }
1435 <FindMembers>{B}*"@implementation"{BN}+ { // Objective-C class implementation
1436                                           lineCount();
1437                                           isTypedef=FALSE;
1438                                           current->section = Entry::OBJCIMPL_SEC;
1439                                           language = current->lang = SrcLangExt_ObjC;
1440                                           insideObjC = TRUE;
1441                                           current->protection = protection = Public ;
1442                                           addType( current ) ;
1443                                           current->type += " implementation" ;
1444                                           current->fileName  = yyFileName;
1445                                           current->startLine = yyLineNr;
1446                                           current->bodyLine  = yyLineNr;
1447                                           BEGIN( CompoundName );
1448                                         }
1449 <FindMembers>{B}*"@interface"{BN}+      { // Objective-C class interface, or Java attribute
1450                                           lineCount();
1451                                           isTypedef=FALSE;
1452                                           current->section = Entry::CLASS_SEC;
1453                                           current->spec = Entry::Interface;
1454                                           if (!insideJava)
1455                                           {
1456                                             language = current->lang = SrcLangExt_ObjC;
1457                                             insideObjC = TRUE;
1458                                           }
1459                                           current->protection = protection = Public ;
1460                                           addType( current ) ;
1461                                           current->type += " interface" ;
1462                                           current->fileName  = yyFileName;
1463                                           current->startLine = yyLineNr;
1464                                           current->bodyLine  = yyLineNr;
1465                                           BEGIN( CompoundName );
1466                                         }
1467 <FindMembers>{B}*"@protocol"{BN}+       { // Objective-C protocol definition
1468                                           lineCount();
1469                                           isTypedef=FALSE;
1470                                           current->section = Entry::CLASS_SEC;
1471                                           current->spec = Entry::Protocol;
1472                                           language = current->lang = SrcLangExt_ObjC;
1473                                           insideObjC = TRUE;
1474                                           current->protection = protection = Public ;
1475                                           addType( current ) ;
1476                                           current->type += " protocol" ;
1477                                           current->fileName  = yyFileName;
1478                                           current->startLine = yyLineNr;
1479                                           current->bodyLine  = yyLineNr;
1480                                           BEGIN( CompoundName );
1481                                         }
1482 <FindMembers>{B}*"exception"{BN}+       { // Corba IDL exception
1483                                           isTypedef=FALSE;
1484                                           current->section = Entry::CLASS_SEC;
1485                                           current->spec = Entry::Exception;
1486                                           addType( current ) ;
1487                                           current->type += " exception" ;
1488                                           current->fileName  = yyFileName;
1489                                           current->startLine = yyLineNr;
1490                                           current->bodyLine  = yyLineNr;
1491                                           lineCount();
1492                                           BEGIN( CompoundName );
1493                                         }
1494 <FindMembers>"@class" | // for Objective C class declarations
1495 <FindMembers>{B}*{TYPEDEFPREFIX}"class{" |
1496 <FindMembers>{B}*{TYPEDEFPREFIX}"class"{BN}+ { 
1497                                           isTypedef=((QCString)yytext).find("typedef")!=-1;
1498                                           current->section = Entry::CLASS_SEC;
1499                                           addType( current ) ;
1500                                           current->type += " class" ;
1501                                           current->fileName  = yyFileName;
1502                                           current->startLine = yyLineNr;
1503                                           current->bodyLine  = yyLineNr;
1504                                           if (yytext[0]=='@')
1505                                           {
1506                                             language = current->lang = SrcLangExt_ObjC;
1507                                             insideObjC = TRUE;
1508                                           }
1509                                           lineCount() ;
1510                                           if (yytext[yyleng-1]=='{') unput('{');
1511                                           if (insidePHP && current->spec&Entry::Abstract)
1512                                           {
1513                                             // convert Abstract to AbstractClass
1514                                             current->spec=(current->spec&~Entry::Abstract)|Entry::AbstractClass;
1515                                           }
1516                                           BEGIN( CompoundName ) ;
1517                                         }
1518 <FindMembers>{B}*"value class{" |         // C++/CLI extension
1519 <FindMembers>{B}*"value class"{BN}+     {
1520                                           isTypedef=FALSE;
1521                                           current->section = Entry::CLASS_SEC;
1522                                           current->spec = Entry::Value;
1523                                           addType( current ) ;
1524                                           current->type += " value class" ;
1525                                           current->fileName  = yyFileName;
1526                                           current->startLine = yyLineNr;
1527                                           current->bodyLine  = yyLineNr;
1528                                           lineCount() ;
1529                                           if (yytext[yyleng-1]=='{') unput('{');
1530                                           BEGIN( CompoundName ) ;
1531                                         }
1532 <FindMembers>{B}*"ref class{" |          // C++/CLI extension
1533 <FindMembers>{B}*"ref class"{BN}+       {
1534                                           isTypedef=FALSE;
1535                                           current->section = Entry::CLASS_SEC;
1536                                           current->spec = Entry::Ref;
1537                                           addType( current ) ;
1538                                           current->type += " ref class" ;
1539                                           current->fileName  = yyFileName;
1540                                           current->startLine = yyLineNr;
1541                                           current->bodyLine  = yyLineNr;
1542                                           lineCount() ;
1543                                           if (yytext[yyleng-1]=='{') unput('{');
1544                                           BEGIN( CompoundName ) ;
1545                                         }
1546 <FindMembers>{B}*"interface class{" |     // C++/CLI extension
1547 <FindMembers>{B}*"interface class"{BN}+ {
1548                                           isTypedef=FALSE;
1549                                           current->section = Entry::CLASS_SEC;
1550                                           current->spec = Entry::Interface;
1551                                           addType( current ) ;
1552                                           current->type += " interface class" ;
1553                                           current->fileName  = yyFileName;
1554                                           current->startLine = yyLineNr;
1555                                           current->bodyLine  = yyLineNr;
1556                                           lineCount() ;
1557                                           if (yytext[yyleng-1]=='{') unput('{');
1558                                           BEGIN( CompoundName ) ;
1559                                         }
1560 <FindMembers>{B}*"coclass"{BN}+         {
1561                                           if (insideIDL)
1562                                           {
1563                                             isTypedef=FALSE;
1564                                             current->section = Entry::CLASS_SEC;
1565                                             addType( current ) ;
1566                                             current->type += " coclass" ;
1567                                             current->fileName  = yyFileName;
1568                                             current->startLine = yyLineNr;
1569                                             current->bodyLine  = yyLineNr;
1570                                             lineCount() ;
1571                                             BEGIN( CompoundName ) ;
1572                                           }
1573                                           else
1574                                           {
1575                                             addType(current);
1576                                             current->name = yytext;
1577                                             current->name = current->name.stripWhiteSpace();
1578                                             lineCount();
1579                                           }
1580                                         }
1581 <FindMembers>{B}*{TYPEDEFPREFIX}"struct{" | 
1582 <FindMembers>{B}*{TYPEDEFPREFIX}"struct"/{BN}+ { 
1583                                           isTypedef=((QCString)yytext).find("typedef")!=-1;
1584                                           current->section = Entry::CLASS_SEC ;
1585                                           current->spec    = Entry::Struct;
1586                                           // bug 582676: can be a struct nested in an interface so keep insideObjC state
1587                                           //current->objc    = insideObjC = FALSE;
1588                                           addType( current ) ;
1589                                           current->type += " struct" ;
1590                                           current->fileName  = yyFileName;
1591                                           current->startLine = yyLineNr;
1592                                           current->bodyLine  = yyLineNr;
1593                                           lineCount() ;
1594                                           if (yytext[yyleng-1]=='{') unput('{');
1595                                           BEGIN( CompoundName ) ;
1596                                         }
1597 <FindMembers>{B}*"value struct{" |      // C++/CLI extension
1598 <FindMembers>{B}*"value struct"{BN}+     {
1599                                           isTypedef=FALSE;
1600                                           current->section = Entry::CLASS_SEC;
1601                                           current->spec    = Entry::Struct | Entry::Value;
1602                                           addType( current ) ;
1603                                           current->type += " value struct" ;
1604                                           current->fileName  = yyFileName;
1605                                           current->startLine = yyLineNr;
1606                                           current->bodyLine  = yyLineNr;
1607                                           lineCount() ;
1608                                           if (yytext[yyleng-1]=='{') unput('{');
1609                                           BEGIN( CompoundName ) ;
1610                                         }
1611 <FindMembers>{B}*"ref struct{" |       // C++/CLI extension
1612 <FindMembers>{B}*"ref struct"{BN}+     {
1613                                           isTypedef=FALSE;
1614                                           current->section = Entry::CLASS_SEC;
1615                                           current->spec    = Entry::Struct | Entry::Ref;
1616                                           addType( current ) ;
1617                                           current->type += " ref struct" ;
1618                                           current->fileName  = yyFileName;
1619                                           current->startLine = yyLineNr;
1620                                           current->bodyLine  = yyLineNr;
1621                                           lineCount() ;
1622                                           if (yytext[yyleng-1]=='{') unput('{');
1623                                           BEGIN( CompoundName ) ;
1624                                         }
1625 <FindMembers>{B}*"interface struct{" |     // C++/CLI extension
1626 <FindMembers>{B}*"interface struct"{BN}+ {
1627                                           isTypedef=FALSE;
1628                                           current->section = Entry::CLASS_SEC;
1629                                           current->spec    = Entry::Struct | Entry::Interface;
1630                                           addType( current ) ;
1631                                           current->type += " interface struct";
1632                                           current->fileName  = yyFileName;
1633                                           current->startLine = yyLineNr;
1634                                           current->bodyLine  = yyLineNr;
1635                                           lineCount() ;
1636                                           if (yytext[yyleng-1]=='{') unput('{');
1637                                           BEGIN( CompoundName ) ;
1638                                         }
1639 <FindMembers>{B}*{TYPEDEFPREFIX}"union{" |
1640 <FindMembers>{B}*{TYPEDEFPREFIX}"union"{BN}+ { 
1641                                           isTypedef=((QCString)yytext).find("typedef")!=-1;
1642                                           current->section = Entry::CLASS_SEC;
1643                                           current->spec    = Entry::Union;
1644                                           // bug 582676: can be a struct nested in an interface so keep insideObjC state
1645                                           //current->objc    = insideObjC = FALSE;
1646                                           addType( current ) ;
1647                                           current->type += " union" ;
1648                                           current->fileName  = yyFileName;
1649                                           current->startLine = yyLineNr;
1650                                           current->bodyLine  = yyLineNr;
1651                                           lineCount() ;
1652                                           if (yytext[yyleng-1]=='{') unput('{');
1653                                           BEGIN( CompoundName ) ;
1654                                         }
1655 <FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" |
1656 <FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum
1657                                           QCString text=yytext;
1658                                           isTypedef    = text.find("typedef")!=-1;
1659                                           bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1;
1660                                           if (insideJava)
1661                                           {
1662                                             current->section = Entry::CLASS_SEC;
1663                                             current->spec    = Entry::Enum;
1664                                           }
1665                                           else
1666                                           {
1667                                             current->section = Entry::ENUM_SEC ;
1668                                           }
1669                                           addType( current ) ;
1670                                           current->type += " enum";
1671                                           if (isStrongEnum)
1672                                           {
1673                                             current->spec |= Entry::Strong;
1674                                           }
1675                                           current->fileName  = yyFileName;
1676                                           current->startLine = yyLineNr;
1677                                           current->bodyLine  = yyLineNr;
1678                                           lineCount() ;
1679                                           if (yytext[yyleng-1]=='{') unput('{');
1680                                           BEGIN( CompoundName ) ;
1681                                         }
1682 <Operator>"("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"("  {  // A::operator()<int>(int arg)
1683                                           lineCount();
1684                                           current->name += "()";
1685                                           BEGIN( FindMembers );
1686                                         }
1687 <Operator>"("{BN}*")"{BN}*/"("          {
1688                                           lineCount();
1689                                           current->name += yytext ;
1690                                           current->name = current->name.simplifyWhiteSpace();
1691                                           BEGIN( FindMembers ) ;
1692                                         }
1693 <Operator>";"                           { // can occur when importing members
1694                                           unput(';');
1695                                           BEGIN( FindMembers ) ;
1696                                         }
1697 <Operator>[^(]                          { 
1698                                           lineCount();
1699                                           current->name += *yytext ;
1700                                         }
1701 <Operator>"<>"                          { /* skip guided templ specifiers */ }
1702 <Operator>"("                           {
1703                                           current->name = current->name.simplifyWhiteSpace();
1704                                           unput(*yytext);
1705                                           BEGIN( FindMembers ) ;
1706                                         }
1707 <FindMembers>("template"|"generic")({BN}*)"<"/[>]?      {  // generic is a C++/CLI extension
1708                                           lineCount();
1709                                           if (current->tArgLists==0)
1710                                           {
1711                                             current->tArgLists = new QList<ArgumentList>;
1712                                             current->tArgLists->setAutoDelete(TRUE);
1713                                           }
1714                                           ArgumentList *al = new ArgumentList;
1715                                           //current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template;
1716                                           current->tArgLists->append(al);
1717                                           currentArgumentList = al;
1718                                           templateStr="<";
1719                                           fullArgString = templateStr;
1720                                           copyArgString = &templateStr;
1721                                           currentArgumentContext = FindMembers;
1722                                           BEGIN( ReadTempArgs );
1723                                         }
1724 <FindMembers>"namespace"{BN}+/{ID}{BN}*"=" { // namespace alias
1725                                           lineCount(); 
1726                                           BEGIN( NSAliasName );
1727                                         }
1728 <NSAliasName>{ID}                       {
1729                                           aliasName = yytext;
1730                                           BEGIN( NSAliasArg );
1731                                         }
1732 <NSAliasArg>({ID}"::")*{ID}             {
1733                                           //printf("Inserting namespace alias %s::%s->%s\n",current_root->name.data(),aliasName.data(),yytext);
1734                                           //if (current_root->name.isEmpty())
1735                                           //{
1736                                           // TODO: namespace aliases are now treated as global entities
1737                                           // while they should be aware of the scope they are in
1738                                             Doxygen::namespaceAliasDict.insert(aliasName,new QCString(yytext));
1739                                           //}
1740                                           //else
1741                                           //{
1742                                           //  Doxygen::namespaceAliasDict.insert(current_root->name+"::"+aliasName,
1743                                           //    new QCString(current_root->name+"::"+yytext));
1744                                           //}
1745                                         }
1746 <NSAliasArg>";"                         {
1747                                           BEGIN( FindMembers );
1748                                         }
1749 <PHPUse>({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as"  {
1750                                           lineCount();
1751                                           aliasName=yytext;
1752                                           BEGIN(PHPUseAs);
1753                                         }
1754 <PHPUse>({ID}{BN}*"\\"{BN}*)*{ID}       {
1755                                           lineCount();
1756                                           current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::"));
1757                                           //printf("PHP: adding use relation: %s\n",current->name.data());
1758                                           current->fileName = yyFileName; 
1759                                           // add a using declaraton
1760                                           current->section=Entry::USINGDECL_SEC;
1761                                           current_root->addSubEntry(current);
1762                                           current = new Entry(*current);
1763                                           // also add it as a using directive
1764                                           current->section=Entry::USINGDIR_SEC;
1765                                           current_root->addSubEntry(current);
1766                                           current = new Entry ;
1767                                           initEntry();
1768                                           aliasName.resize(0);
1769                                         }
1770 <PHPUseAs>{BN}+"as"{BN}+                {
1771                                           lineCount();
1772                                         }
1773 <PHPUseAs>{ID}                          {
1774                                           //printf("PHP: adding use as relation: %s->%s\n",yytext,aliasName.data());
1775                                           Doxygen::namespaceAliasDict.insert(yytext,
1776                                                new QCString(removeRedundantWhiteSpace(
1777                                                    substitute(aliasName,"\\","::"))));
1778                                           aliasName.resize(0);
1779                                         }
1780 <PHPUse,PHPUseAs>[,;]                   {
1781                                           if (*yytext==',')
1782                                           {
1783                                             BEGIN(PHPUse);
1784                                           }
1785                                           else
1786                                           {
1787                                             BEGIN(FindMembers);
1788                                           }
1789                                         }
1790 <JavaImport>({ID}{BN}*"."{BN}*)+"*"     { // package import => add as a using directive
1791                                           lineCount();
1792                                           QCString scope=yytext;
1793                                           current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::"));
1794                                           current->fileName = yyFileName; 
1795                                           current->section=Entry::USINGDIR_SEC;
1796                                           current_root->addSubEntry(current);
1797                                           current = new Entry;
1798                                           initEntry();
1799                                           BEGIN(Using);
1800                                         }
1801 <JavaImport>({ID}{BN}*"."{BN}*)+{ID}    { // class import => add as a using declaration
1802                                           lineCount();
1803                                           QCString scope=yytext;
1804                                           current->name=removeRedundantWhiteSpace(substitute(scope,".","::"));
1805                                           current->fileName = yyFileName; 
1806                                           if (insideD) 
1807                                           {
1808                                             current->section=Entry::USINGDIR_SEC;
1809                                           }
1810                                           else
1811                                           {
1812                                             //printf("import name = %s -> %s\n",yytext,current->name.data());
1813                                             current->section=Entry::USINGDECL_SEC;
1814                                           }
1815                                           current_root->addSubEntry(current);
1816                                           current = new Entry ;
1817                                           initEntry();
1818                                           BEGIN(Using);
1819                                         }
1820 <FindMembers>"using"{BN}+               { 
1821                                           current->startLine=yyLineNr; 
1822                                           lineCount(); 
1823                                           BEGIN(Using); 
1824                                         }
1825 <Using>"namespace"{BN}+                 { lineCount(); BEGIN(UsingDirective); }
1826 <Using>{ID}{BN}*({BN}*("::"|"."){BN}*{ID})*     {
1827                                           lineCount();
1828                                           current->name=yytext;
1829                                           current->fileName = yyFileName; 
1830                                           current->section=Entry::USINGDECL_SEC;
1831                                           current->startLine = yyLineNr;
1832                                           current_root->addSubEntry(current);
1833                                           previous = current;
1834                                           current             = new Entry ;
1835                                           if (insideCS) /* Hack: in C# a using declaration and 
1836                                                            directive have the same syntax, so we
1837                                                            also add it as a using directive here
1838                                                          */
1839                                           {
1840                                             current->name=yytext;
1841                                             current->fileName = yyFileName; 
1842                                             current->startLine = yyLineNr;
1843                                             current->section=Entry::USINGDIR_SEC;
1844                                             current_root->addSubEntry(current);
1845                                             current             = new Entry ;
1846                                           }
1847                                           initEntry();
1848                                           BEGIN(Using);
1849                                         }
1850 <Using>"="                              { // C++11 style template alias?
1851                                           BEGIN(UsingAlias);
1852                                         }
1853 <UsingAlias>";"                         { 
1854                                           previous->section=Entry::VARIABLE_SEC;
1855                                           previous->type = "typedef "+previous->args;
1856                                           previous->type=previous->type.simplifyWhiteSpace();
1857                                           previous->args.resize(0);
1858                                           previous->name=previous->name.stripWhiteSpace();
1859                                           previous->bodyLine = yyLineNr;
1860                                           previous->spec |= Entry::Alias;
1861                                           BEGIN(FindMembers); 
1862                                         }
1863 <UsingAlias>.                           {
1864                                           previous->args+=yytext;
1865                                         }
1866 <UsingAlias>\n                          {
1867                                           previous->args+=yytext;
1868                                           lineCount();
1869                                         }
1870 <UsingDirective>{SCOPENAME}             { current->name=removeRedundantWhiteSpace(yytext);
1871                                           current->fileName = yyFileName; 
1872                                           current->section=Entry::USINGDIR_SEC;
1873                                           current_root->addSubEntry(current);
1874                                           current             = new Entry ;
1875                                           initEntry();
1876                                           BEGIN(Using);
1877                                         }
1878 <Using>";"                              { BEGIN(FindMembers); }
1879 <FindMembers>{SCOPENAME}{BN}*"<>"       { // guided template decl
1880                                           QCString n=yytext;
1881                                           addType( current );
1882                                           current->name=n.left(n.length()-2);
1883                                         }
1884 <FindMembers>{SCOPENAME}{BN}*/"<"       { // Note: this could be a return type!
1885                                           roundCount=0;
1886                                           sharpCount=0;
1887                                           lineCount();
1888                                           addType( current );
1889                                           current->name=yytext;
1890                                           current->name=current->name.stripWhiteSpace();
1891                                           //current->scopeSpec.resize(0);
1892                                           // currentTemplateSpec = &current->scopeSpec;
1893                                           if (nameIsOperator(current->name))
1894                                             BEGIN( Operator );
1895                                           else
1896                                             BEGIN( EndTemplate );
1897                                         }
1898 <FindMemberName>{SCOPENAME}{BN}*/"<"    {
1899                                           sharpCount=0;
1900                                           roundCount=0;
1901                                           lineCount();
1902                                           current->name+=((QCString)yytext).stripWhiteSpace();
1903                                           //current->memberSpec.resize(0);
1904                                           // currentTemplateSpec = &current->memberSpec;
1905                                           if (nameIsOperator(current->name))
1906                                             BEGIN( Operator );
1907                                           else
1908                                             BEGIN( EndTemplate );
1909                                         }
1910 <EndTemplate>"<<<"                      {
1911                                           if (!insidePHP) 
1912                                           {
1913                                             REJECT;
1914                                           }
1915                                           else
1916                                           {
1917                                             lastHereDocContext = YY_START;
1918                                             BEGIN(HereDoc);
1919                                           }
1920                                         }
1921 <ClassTemplSpec,EndTemplate>"<<"        {
1922                                           current->name+=yytext;
1923                                           // *currentTemplateSpec+=yytext; 
1924                                         }
1925 <EndTemplate>"<"                        { 
1926                                           current->name+='<';
1927                                           // *currentTemplateSpec+='<'; 
1928                                           sharpCount++; 
1929                                         }
1930 <ClassTemplSpec,EndTemplate>">>"        {
1931                                           if (insideJava || insideCS || insideCli || roundCount==0)
1932                                           {
1933                                             unput('>');
1934                                             unput(' ');
1935                                             unput('>');
1936                                           }
1937                                           else
1938                                           {
1939                                             current->name+=yytext;
1940                                           }
1941                                           // *currentTemplateSpec+=yytext; 
1942                                         }
1943 <EndTemplate>">"                        {
1944                                           current->name+='>';
1945                                           // *currentTemplateSpec+='>';
1946                                           if (--sharpCount<=0)
1947                                           {  
1948                                             //printf("Found %s\n",current->name.data());
1949                                             BEGIN(FindMembers);
1950                                           }
1951                                         }
1952 <EndTemplate>">"{BN}*"("                { 
1953                                           lineCount();
1954                                           current->name+='>';
1955                                           // *currentTemplateSpec+='>';
1956                                           if (--sharpCount<=0)
1957                                           {
1958                                             current->bodyLine = yyLineNr;
1959                                             current->args = "(";
1960                                             currentArgumentContext = FuncQual;
1961                                             fullArgString = current->args.copy();
1962                                             copyArgString = &current->args;
1963                                             //printf("Found %s\n",current->name.data());
1964                                             BEGIN( ReadFuncArgType ) ;
1965                                           }
1966                                         }
1967 <EndTemplate>">"{BN}*/"("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance
1968                                           lineCount();
1969                                           current->name+='>';
1970                                           BEGIN(FindMembers);
1971                                         }
1972 <EndTemplate>">"{BN}*/"::"              {
1973                                           lineCount();
1974                                           current->name+='>';
1975                                           // *currentTemplateSpec+='>';
1976                                           if (--sharpCount<=0)
1977                                           {
1978                                             BEGIN(FindMemberName);
1979                                           }
1980                                         }
1981 <ClassTemplSpec,EndTemplate>"("         { current->name+=*yytext;
1982                                           roundCount++; 
1983                                         }
1984 <ClassTemplSpec,EndTemplate>")"         { current->name+=*yytext;
1985                                           if (roundCount>0) roundCount--; 
1986                                         }
1987 <EndTemplate>.                          { 
1988                                           current->name+=*yytext;
1989                                           // *currentTemplateSpec+=*yytext; 
1990                                         }
1991 <FindMembers>"define"{BN}*"("{BN}*["']  {
1992                                           if (insidePHP)
1993                                           {
1994                                             current->bodyLine = yyLineNr;
1995                                             BEGIN( DefinePHP );
1996                                           }
1997                                           else
1998                                             REJECT;
1999                                         }
2000 <CopyHereDoc>{ID}                       { // PHP heredoc
2001                                           g_delimiter = yytext;
2002                                           *pCopyHereDocGString += yytext;
2003                                           BEGIN(CopyHereDocEnd);
2004                                         }
2005 <CopyHereDoc>"'"{ID}/"'"                { // PHP nowdoc
2006                                           g_delimiter = &yytext[1];
2007                                           *pCopyHereDocGString += yytext;
2008                                           BEGIN(CopyHereDocEnd);
2009                                         }
2010 <HereDoc>{ID}                           { // PHP heredoc
2011                                           g_delimiter = yytext;
2012                                           BEGIN(HereDocEnd);
2013                                         }
2014 <HereDoc>"'"{ID}/"'"                    { // PHP nowdoc
2015                                           g_delimiter = &yytext[1];
2016                                           BEGIN(HereDocEnd);
2017                                         }
2018 <HereDocEnd>^{ID}                       { // id at start of the line could mark the end of the block
2019                                           if (g_delimiter==yytext) // it is the end marker
2020                                           {
2021                                             BEGIN(lastHereDocContext);
2022                                           }
2023                                         }
2024 <HereDocEnd>.                           { }
2025 <CopyHereDocEnd>^{ID}                   { // id at start of the line could mark the end of the block
2026                                           *pCopyHereDocGString += yytext;
2027                                           if (g_delimiter==yytext) // it is the end marker
2028                                           {
2029                                             BEGIN(lastHereDocContext);
2030                                           }
2031                                         }
2032 <CopyHereDocEnd>\n                      { 
2033                                           *pCopyHereDocGString += yytext;
2034                                         }
2035 <CopyHereDocEnd>.                       { 
2036                                           *pCopyHereDocGString += yytext;
2037                                         }
2038 <FindMembers>"Q_OBJECT"                 { // Qt object macro
2039                                         }
2040 <FindMembers>"Q_PROPERTY"               { // Qt property declaration
2041                                           current->protection = protection = Public ;
2042                                           current->mtype = mtype = Property;
2043                                           current->type.resize(0);
2044                                           BEGIN(QtPropType);
2045                                         }
2046 <QtPropType>"("                         { // start of property arguments
2047                                         }
2048 <QtPropAttr>")"                         { // end of property arguments
2049                                           unput(';');
2050                                           BEGIN(FindMembers);
2051                                         }
2052 <QtPropType>"const"|"volatile"          {
2053                                           current->type+=yytext;
2054                                         }
2055 <QtPropType>{B}+                        {
2056                                           current->type+=yytext;
2057                                         }
2058 <QtPropType>({TSCOPE}"::")*{TSCOPE}     {
2059                                           current->type+=yytext;
2060                                           BEGIN(QtPropName);
2061                                         }
2062 <QtPropName>{ID}                        {
2063                                           current->name=yytext;
2064                                           BEGIN(QtPropAttr);
2065                                         }
2066 <QtPropAttr>"READ"                      {
2067                                           current->spec |= Entry::Readable;
2068                                           BEGIN(QtPropRead);
2069                                         }
2070 <QtPropAttr>"WRITE"                     {
2071                                           current->spec |= Entry::Writable;
2072                                           BEGIN(QtPropWrite);
2073                                         }
2074 <QtPropAttr>"RESET"{B}+{ID}             { // reset method => not supported yet
2075                                         }
2076 <QtPropAttr>"SCRIPTABLE"{B}+{ID}        { // scriptable property => not supported yet
2077                                         }
2078 <QtPropAttr>"DESIGNABLE"{B}+{ID}        { // designable property => not supported yet
2079                                         }
2080 <QtPropRead>{ID}                        {
2081                                           current->read = yytext;
2082                                           BEGIN(QtPropAttr);
2083                                         }
2084 <QtPropWrite>{ID}                       {
2085                                           current->write = yytext;
2086                                           BEGIN(QtPropAttr);
2087                                         }
2088 <FindMembers>"friend"{BN}+("class"|"union"|"struct"){BN}+ {
2089                                           current->name=yytext;
2090                                           BEGIN(FindMembers);
2091                                         }
2092 <FindMembers,FindMemberName>{SCOPENAME} {
2093                                           lineCount();
2094                                           if (insideIDL && yyleng==9 && strcmp(yytext,"cpp_quote")==0)
2095                                           {
2096                                             BEGIN(CppQuote);
2097                                           }
2098                                           else if ((insideIDL || insideJava || insideD) && yyleng==6 && strcmp(yytext,"import")==0)
2099                                           {
2100                                             if (insideIDL)
2101                                               BEGIN(NextSemi);
2102                                             else // insideJava or insideD
2103                                               BEGIN(JavaImport);
2104                                           }
2105                                           else if (insidePHP && strcmp(yytext,"use")==0)
2106                                           {
2107                                             BEGIN(PHPUse);
2108                                           }
2109                                           else if (insideJava && strcmp(yytext,"package")==0)
2110                                           {
2111                                             lineCount();
2112                                             BEGIN(PackageName);
2113                                           }
2114                                           else if (insideIDL && strcmp(yytext,"case")==0)
2115                                           {
2116                                             BEGIN(IDLUnionCase);
2117                                           }
2118                                           else if (insideTryBlock && strcmp(yytext,"catch")==0)
2119                                           {
2120                                             insideTryBlock=FALSE;
2121                                             BEGIN(TryFunctionBlock);
2122                                           }
2123                                           else if (insideJS && strcmp(yytext,"var")==0)
2124                                           { // javascript variable
2125                                             current->type="var";
2126                                           }
2127                                           else if (insideJS && strcmp(yytext,"function")==0)
2128                                           { // javascript function
2129                                             current->type="function";
2130                                           }
2131                                           else if (insideCS && strcmp(yytext,"this")==0)
2132                                           {
2133                                             // C# indexer
2134                                             addType( current ) ;
2135                                             current->name="this";
2136                                             BEGIN(CSIndexer);
2137                                           }
2138                                           else if (insideCpp && strcmp(yytext,"static_assert")==0)
2139                                           {
2140                                             // C++11 static_assert
2141                                             BEGIN(StaticAssert);
2142                                           }
2143                                           else if (insideCpp && strcmp(yytext,"decltype")==0)
2144                                           {
2145                                             // C++11 decltype(x)
2146                                             current->type+=yytext;
2147                                             BEGIN(DeclType);
2148                                           }
2149                                           else
2150                                           {
2151                                             if (YY_START==FindMembers)
2152                                             {
2153                                               addType( current ) ;
2154                                             }
2155                                             bool javaLike = insideJava || insideCS || insideD || insidePHP || insideJS;
2156                                             if (javaLike && strcmp(yytext,"public")==0)
2157                                             {
2158                                               current->protection = Public;
2159                                             }
2160                                             else if (javaLike && strcmp(yytext,"protected")==0)
2161                                             {
2162                                               current->protection = Protected;
2163                                             }
2164                                             else if (javaLike && strcmp(yytext,"internal")==0)
2165                                             {
2166                                               current->protection = Package;
2167                                             }
2168                                             else if (javaLike && strcmp(yytext,"private")==0)
2169                                             {
2170                                               current->protection = Private;
2171                                             }
2172                                             else if (javaLike && strcmp(yytext,"static")==0)
2173                                             {
2174                                               if (YY_START==FindMembers)
2175                                                 current->name  = yytext;
2176                                               else
2177                                                 current->name += yytext;
2178                                               current->stat = TRUE;
2179                                             }
2180                                             else
2181                                             {
2182                                               if (YY_START==FindMembers)
2183                                                 current->name  = yytext;
2184                                               else
2185                                                 current->name += yytext;
2186                                               if (current->name.left(7)=="static ")
2187                                               {
2188                                                 current->stat = TRUE;
2189                                                 current->name= current->name.mid(7);
2190                                               }
2191                                               else if (current->name.left(7)=="inline ")
2192                                               {
2193                                                 if (current->type.isEmpty())
2194                                                 {
2195                                                   current->type="inline";
2196                                                 }
2197                                                 else
2198                                                 {
2199                                                   current->type+="inline ";
2200                                                 }
2201                                                 current->name= current->name.mid(7);
2202                                               }
2203                                               else if (current->name.left(6)=="const ")
2204                                               {
2205                                                 if (current->type.isEmpty())
2206                                                 {
2207                                                   current->type="const";
2208                                                 }
2209                                                 else
2210                                                 {
2211                                                   current->type+="const ";
2212                                                 }
2213                                                 current->name=current->name.mid(6);
2214                                               }
2215                                             }
2216                                             QCString tmp=yytext;
2217                                             if (nameIsOperator(tmp))
2218                                             {
2219                                               BEGIN( Operator );
2220                                             }
2221                                             else
2222                                             {
2223                                               BEGIN(FindMembers);
2224                                             }
2225                                           }
2226                                         }
2227 <StaticAssert>"("                       {
2228                                           lastSkipRoundContext = FindMembers;
2229                                           roundCount=1;
2230                                           BEGIN(SkipRound);
2231                                         }
2232 <StaticAssert>{BN}+                     { lineCount(); }
2233 <StaticAssert>.                         { // variable with static_assert as name?
2234                                           unput(*yytext);
2235                                           BEGIN(FindMembers);
2236                                         }
2237 <DeclType>"("                           {
2238                                           current->type+=yytext;
2239                                           lastRoundContext=FindMembers;
2240                                           pCopyRoundString=&current->type;
2241                                           roundCount=0;
2242                                           BEGIN(CopyRound);
2243                                         }
2244 <DeclType>{BN}+                         { lineCount(); }
2245 <DeclType>.                             {
2246                                           unput(*yytext);
2247                                           BEGIN(FindMembers);
2248                                         }
2249 <CSIndexer>"["[^\n\]]*"]"               {
2250                                           current->name+=removeRedundantWhiteSpace(yytext);
2251                                           BEGIN(FindMembers);
2252                                         }
2253 <FindMembers>[0-9]{ID}                  { // some number where we did not expect one
2254                                         }
2255 <FindMembers>"."                        {
2256                                           if (insideJava || insideCS || insideD)
2257                                           {
2258                                             current->name+=".";
2259                                           }
2260                                         }
2261 <FindMembers>"::"                       {
2262                                           current->name+=yytext;
2263                                         }
2264 <CppQuote>"("{B}*"\""                   {
2265                                           insideCppQuote=TRUE;
2266                                           BEGIN(FindMembers);
2267                                         }
2268 <IDLUnionCase>"::"
2269 <IDLUnionCase>":"                       { BEGIN(FindMembers); }
2270 <IDLUnionCase>\n                        { lineCount(); }
2271 <IDLUnionCase>.
2272 <TryFunctionBlock>\n                    { lineCount(); }
2273 <TryFunctionBlock>"{"                   { 
2274                                           curlyCount=0;
2275                                           lastCurlyContext = TryFunctionBlockEnd ;
2276                                           BEGIN( SkipCurly );
2277                                         }
2278 <TryFunctionBlock>.
2279 <TryFunctionBlockEnd>{BN}*"catch"       { lineCount(); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193
2280                                         }
2281 <TryFunctionBlockEnd>\n                 { unput(*yytext); // rule added to fix bug id 601138
2282                                           BEGIN( FindMembers );
2283                                         }
2284 <TryFunctionBlockEnd>.                  { unput(*yytext);
2285                                           BEGIN( FindMembers );
2286                                         }
2287 <EndCppQuote>")"                        {
2288                                           insideCppQuote=FALSE;
2289                                           BEGIN(FindMembers);
2290                                         }
2291 <FindMembers,FindFields>{B}*"#"         { if (insidePHP)
2292                                             REJECT;
2293                                           lastCPPContext = YY_START;
2294                                           BEGIN( SkipCPP ) ;
2295                                         }
2296 <FindMembers,FindFields>{B}*"#"{B}*("cmake")?"define"   {
2297                                           if (insidePHP)
2298                                             REJECT;
2299                                           current->bodyLine = yyLineNr;
2300                                           lastDefineContext = YY_START;
2301                                           BEGIN( Define );
2302                                         }
2303 <FindMembers,ReadBody,ReadNSBody,ReadBodyIntf,SkipCurly,SkipCurlyCpp>{B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */
2304                                           yyLineNr = atoi(&yytext[1]);
2305                                           //printf("setting line number to %d\n",yyLineNr);
2306                                           lastPreLineCtrlContext = YY_START;
2307                                           if (YY_START==ReadBody || 
2308                                               YY_START==ReadNSBody ||
2309                                               YY_START==ReadBodyIntf)
2310                                           {
2311                                             current->program+=yytext;
2312                                           }
2313                                           BEGIN( PreLineCtrl );
2314                                         }
2315 <PreLineCtrl>"\""[^\n\"]*"\""           {
2316                                           yyFileName = stripQuotes(yytext);
2317                                           if (lastPreLineCtrlContext==ReadBody || 
2318                                               lastPreLineCtrlContext==ReadNSBody ||
2319                                               lastPreLineCtrlContext==ReadBodyIntf)
2320                                           {
2321                                             current->program+=yytext;
2322                                           }
2323                                         }
2324 <PreLineCtrl>.                          {
2325                                           if (lastPreLineCtrlContext==ReadBody || 
2326                                               lastPreLineCtrlContext==ReadNSBody ||
2327                                               lastPreLineCtrlContext==ReadBodyIntf)
2328                                           {
2329                                             current->program+=yytext;
2330                                           }
2331                                         }
2332 <PreLineCtrl>\n                         {
2333                                           if (lastPreLineCtrlContext==ReadBody || 
2334                                               lastPreLineCtrlContext==ReadNSBody ||
2335                                               lastPreLineCtrlContext==ReadBodyIntf)
2336                                           {
2337                                             current->program+=yytext;
2338                                           }
2339                                           lineCount();
2340                                           BEGIN( lastPreLineCtrlContext );
2341                                         }
2342 <SkipCPP>.
2343 <SkipCPP>\\[\r]*"\n"[\r]*               { lineCount(); }
2344 <SkipCPP>[\r]*\n[\r]*                   { lineCount();
2345                                           BEGIN( lastCPPContext) ;
2346                                         }
2347 <Define>{ID}{B}*"("                     {
2348                                           current->name = yytext;
2349                                           current->name = current->name.left(current->name.length()-1).stripWhiteSpace();
2350                                           current->args = "(";
2351                                           current->bodyLine = yyLineNr;
2352                                           currentArgumentContext = DefineEnd;
2353                                           fullArgString=current->args.copy();
2354                                           copyArgString=&current->args;
2355                                           BEGIN( ReadFuncArgType ) ;
2356                                         }
2357  /*
2358 <DefineArg>")"                          {
2359                                           //printf("Define with args\n");
2360                                           current->args += ')';
2361                                           BEGIN( DefineEnd );
2362                                         }
2363 <DefineArg>.                            {
2364                                           current->args += *yytext;
2365                                         }
2366   */
2367 <Define>{ID}                            {
2368                                           //printf("Define `%s' without args\n",yytext);
2369                                           current->bodyLine = yyLineNr;
2370                                           current->name = yytext;
2371                                           BEGIN(DefineEnd);
2372                                         }
2373 <DefineEnd>\n                           {
2374                                           //printf("End define: doc=%s docFile=%s docLine=%d\n",current->doc.data(),current->docFile.data(),current->docLine);
2375                                           lineCount();
2376                                           current->fileName   = yyFileName;
2377                                           current->startLine  = yyLineNr;
2378                                           current->type.resize(0);
2379                                           current->args       = current->args.simplifyWhiteSpace();
2380                                           current->name       = current->name.stripWhiteSpace();
2381                                           current->section    = Entry::DEFINE_SEC;
2382                                           current_root->addSubEntry(current);
2383                                           current             = new Entry ;
2384                                           initEntry();
2385                                           BEGIN(lastDefineContext);
2386                                         }
2387 <DefinePHPEnd>";"                       {
2388                                           //printf("End define\n");
2389                                           current->fileName   = yyFileName;
2390                                           current->startLine  = yyLineNr;
2391                                           current->type.resize(0);
2392                                           current->type       = "const";
2393                                           QCString init = current->initializer.data();
2394                                           init = init.simplifyWhiteSpace();
2395                                           init = init.left(init.length()-1);
2396                                           current->initializer = init;
2397                                           current->name       = current->name.stripWhiteSpace();
2398                                           current->section    = Entry::VARIABLE_SEC; 
2399                                           current_root->addSubEntry(current);
2400                                           current             = new Entry ;
2401                                           initEntry();
2402                                           BEGIN(FindMembers);
2403                                         }
2404 <DefinePHPEnd>.
2405 <DefineEnd>\\[\r]?\n                    {
2406                                           lineCount();
2407                                         }
2408 <DefineEnd>\"                           {
2409                                           if (insideIDL && insideCppQuote)
2410                                           {
2411                                             BEGIN(EndCppQuote);
2412                                           }
2413                                           else
2414                                           {
2415                                             lastStringContext=DefineEnd;
2416                                             BEGIN(SkipString);
2417                                           }
2418                                         }
2419 <DefineEnd>.                            
2420 <DefinePHP>{ID}["']{BN}*","{BN}*        {
2421                                           current->name = yytext;
2422                                           current->name = current->name.stripWhiteSpace();
2423                                           current->name = current->name.left(current->name.length()-1).stripWhiteSpace();
2424                                           current->name = current->name.left(current->name.length()-1);
2425                                           current->bodyLine = yyLineNr;
2426                                           lastRoundContext = DefinePHPEnd;
2427                                           pCopyRoundGString = &current->initializer;
2428                                           roundCount = 0;
2429                                           BEGIN( GCopyRound );
2430                                         }
2431
2432 <FindMembers>[\^%]                      {  // ^ and % are C++/CLI extensions
2433                                           if (insideCli)
2434                                           {
2435                                             addType( current );
2436                                             current->name = yytext ; 
2437                                           }
2438                                           else
2439                                           {
2440                                             REJECT;
2441                                           }
2442                                         }
2443 <FindMembers>[*&]+                      { 
2444                                           current->name += yytext ;  
2445                                           addType( current );
2446                                         }
2447 <FindMembers,MemberSpec,Function,NextSemi,EnumBaseType,BitFields,ReadInitializer,OldStyleArgs>";"{BN}*("/**"|"//!"|"/*!"|"///")"<" {
2448                                           lineCount();
2449                                           if (current->bodyLine==-1)
2450                                           {
2451                                             current->bodyLine=yyLineNr;
2452                                           }
2453                                           docBlockContext   = YY_START;
2454                                           docBlockInBody    = FALSE;
2455                                           docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) ||
2456                                                               ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") );
2457                                           docBlock.resize(0);
2458                                           docBlockTerm = ';';
2459                                           if (YY_START==EnumBaseType && current->section==Entry::ENUM_SEC)
2460                                           {
2461                                             current->bitfields = ":"+current->args;
2462                                             current->args.resize(0);
2463                                             current->section=Entry::VARIABLE_SEC;
2464                                           }
2465                                           if (yytext[yyleng-3]=='/')
2466                                           {
2467                                             startCommentBlock(TRUE);
2468                                             BEGIN( DocLine );
2469                                           }
2470                                           else
2471                                           {
2472                                             startCommentBlock(FALSE);
2473                                             BEGIN( DocBlock );
2474                                           }
2475                                         }
2476 <MemberSpec,FindFields,FindMembers,NextSemi,EnumBaseType,BitFields,ReadInitializer,OldStyleArgs>","{BN}*("/**"|"//!"|"/*!"|"///")"<" {
2477                                           lineCount();
2478                                           docBlockContext   = YY_START;
2479                                           docBlockInBody    = FALSE;
2480                                           docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) ||
2481                                                               ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") );
2482                                           docBlock.resize(0);
2483                                           docBlockTerm = ',';
2484                                           if (YY_START==EnumBaseType && current->section==Entry::ENUM_SEC)
2485                                           {
2486                                             current->bitfields = ":"+current->args;
2487                                             current->args.resize(0);
2488                                             current->section=Entry::VARIABLE_SEC;
2489                                           }
2490                                           if (yytext[yyleng-3]=='/')
2491                                           {
2492                                             startCommentBlock(TRUE);
2493                                             BEGIN( DocLine );
2494                                           }
2495                                           else
2496                                           {
2497                                             startCommentBlock(FALSE);
2498                                             BEGIN( DocBlock );
2499                                           }
2500                                         }
2501 <DefineEnd,FindFields,FindFieldArg,ReadInitializer,OldStyleArgs>{BN}*("/**"|"//!"|"/*!"|"///")"<" {
2502                                           lineCount();
2503                                           if (current->bodyLine==-1)
2504                                           {
2505                                             current->bodyLine=yyLineNr;
2506                                           }
2507                                           docBlockContext   = YY_START;
2508                                           docBlockInBody    = FALSE;
2509                                           docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) ||
2510                                                               ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") );
2511                                           docBlock.resize(0);
2512                                           docBlockTerm = 0;
2513                                           if (yytext[yyleng-3]=='/')
2514                                           {
2515                                             startCommentBlock(TRUE);
2516                                             BEGIN( DocLine );
2517                                           }
2518                                           else
2519                                           {
2520                                             startCommentBlock(FALSE);
2521                                             BEGIN( DocBlock );
2522                                           }
2523                                         }
2524    
2525 <FindMembers,FindFields>("//"([!/]?){B}*{CMD}"{")|("/*"([!*]?){B}*{CMD}"{")     {
2526                                           //handleGroupStartCommand(current->name);
2527                                           if (previous && previous->section==Entry::GROUPDOC_SEC)
2528                                           {
2529                                             // link open command to the group defined in the previous entry
2530                                             openGroup(previous,yyFileName,yyLineNr);
2531                                           }
2532                                           else
2533                                           {
2534                                             // link open command to the current entry
2535                                             openGroup(current,yyFileName,yyLineNr);
2536                                           }
2537                                           //current = tmp;
2538                                           initEntry();
2539                                           if (yytext[1]=='/')
2540                                           {
2541                                             if (yytext[2]=='!' || yytext[2]=='/')
2542                                             {
2543                                               docBlockContext   = YY_START;
2544                                               docBlockInBody    = FALSE;
2545                                               docBlockAutoBrief = FALSE;
2546                                               docBlock.resize(0);
2547                                               docBlockTerm = 0;
2548                                               startCommentBlock(TRUE);
2549                                               BEGIN(DocLine);
2550                                             }
2551                                             else
2552                                             {
2553                                               lastCContext=YY_START;
2554                                               BEGIN(SkipCxxComment);
2555                                             }
2556                                           }
2557                                           else
2558                                           {
2559                                             if (yytext[2]=='!' || yytext[2]=='*')
2560                                             {
2561                                               docBlockContext   = YY_START;
2562                                               docBlockInBody    = FALSE;
2563                                               docBlock.resize(0);
2564                                               docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) ||
2565                                                                   ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") );
2566                                               docBlockTerm = 0;
2567                                               startCommentBlock(FALSE);
2568                                               BEGIN(DocBlock);
2569                                             }
2570                                             else
2571                                             {
2572                                               lastCContext=YY_START;
2573                                               BEGIN(SkipComment);
2574                                             }
2575                                           }
2576                                         }
2577 <FindMembers,FindFields,ReadInitializer>"//"([!/]?){B}*{CMD}"}".*|"/*"([!*]?){B}*{CMD}"}"[^*]*"*/"      {
2578                                           closeGroup(current,yyFileName,yyLineNr);
2579                                         }
2580 <FindMembers>"="                        { // in PHP code this could also be due to "<?="
2581                                           current->bodyLine = yyLineNr;
2582                                           current->initializer = yytext;
2583                                           lastInitializerContext = YY_START;
2584                                           initBracketCount=0;
2585                                           BEGIN(ReadInitializer);
2586                                         }
2587   /* Read initializer rules */
2588 <ReadInitializer>"("                    {
2589                                           lastRoundContext=YY_START;
2590                                           pCopyRoundGString=&current->initializer;
2591                                           roundCount=0;
2592                                           current->initializer+=*yytext; 
2593                                           BEGIN(GCopyRound);
2594                                         }
2595 <ReadInitializer>"{"                    {
2596                                           lastCurlyContext=YY_START;
2597                                           pCopyCurlyGString=&current->initializer;
2598                                           curlyCount=0;
2599                                           current->initializer+=*yytext; 
2600                                           BEGIN(GCopyCurly);
2601                                         }
2602 <ReadInitializer>[;,]                   {
2603                                           //printf(">> initializer `%s' <<\n",current->initializer.data());
2604                                           if (*yytext==';' && (current_root->spec&Entry::Enum))
2605                                           {
2606                                             current->fileName   = yyFileName;
2607                                             current->startLine  = yyLineNr;
2608                                             current->args       = current->args.simplifyWhiteSpace();
2609                                             current->name       = current->name.stripWhiteSpace();
2610                                             current->section    = Entry::VARIABLE_SEC;
2611                                             current_root->addSubEntry(current);
2612                                             current = new Entry;
2613                                             initEntry();
2614                                             BEGIN(FindMembers);
2615                                           }
2616                                           else if (*yytext==';' || (lastInitializerContext==FindFields && initBracketCount==0)) // initBracketCount==0 was added for bug 665778
2617                                           {
2618                                             unput(*yytext);
2619                                             BEGIN(lastInitializerContext);
2620                                           }
2621                                           else if (*yytext==',' && initBracketCount==0) // for "int a=0,b=0"
2622                                           {
2623                                             unput(*yytext);
2624                                             BEGIN(lastInitializerContext);
2625                                           }
2626                                           else
2627                                           {
2628                                             current->initializer+=*yytext; 
2629                                           }
2630                                         }
2631 <ReadInitializer>{RAWBEGIN}             { // C++11 raw string
2632                                           if (!insideCpp)
2633                                           { 
2634                                             REJECT;
2635                                           }
2636                                           else
2637                                           {
2638                                             QCString text=yytext;
2639                                             current->initializer+=text;
2640                                             int i=text.find('"');
2641                                             g_delimiter = yytext+i+1;
2642                                             g_delimiter=g_delimiter.left(g_delimiter.length()-1);
2643                                             lastRawStringContext = YY_START;
2644                                             pCopyRawGString = &current->initializer;
2645                                             BEGIN(RawGString);
2646                                             //printf("RawGString delimiter='%s'\n",delimiter.data());
2647                                           }
2648                                         }
2649 <RawGString>{RAWEND}                    {
2650                                           *pCopyRawGString+=yytext;
2651                                           QCString delimiter = yytext+1;
2652                                           delimiter=delimiter.left(delimiter.length()-1);
2653                                           if (delimiter==g_delimiter)
2654                                           {
2655                                             BEGIN(lastRawStringContext);
2656                                           }
2657                                         }
2658 <RawGString>[^)]+                       {
2659                                           *pCopyRawGString+=yytext;
2660                                         }
2661 <RawGString>.                           {
2662                                           *pCopyRawGString+=yytext;
2663                                         }
2664 <RawGString>\n                          {
2665                                           *pCopyRawGString+=yytext;
2666                                           lineCount();
2667                                         }
2668 <RawString>{RAWEND}                     {
2669                                           *pCopyRawString+=yytext;
2670                                           fullArgString+=yytext;
2671                                           QCString delimiter = yytext+1;
2672                                           delimiter=delimiter.left(delimiter.length()-1);
2673                                           if (delimiter==g_delimiter)
2674                                           {
2675                                             BEGIN(lastRawStringContext);
2676                                           }
2677                                         }
2678 <RawString>[^)]+                        {
2679                                           *pCopyRawString+=yytext;
2680                                           fullArgString+=yytext;
2681                                         }
2682 <RawString>.                            {
2683                                           *pCopyRawString+=yytext;
2684                                           fullArgString+=yytext;
2685                                         }
2686 <RawString>\n                           {
2687                                           *pCopyRawString+=yytext;
2688                                           fullArgString+=yytext;
2689                                           lineCount();
2690                                         }
2691 <ReadInitializer>\"                     {
2692                                           if (insideIDL && insideCppQuote)
2693                                           {
2694                                             BEGIN(EndCppQuote);
2695                                           }
2696                                           else
2697                                           {
2698                                             lastStringContext=YY_START;
2699                                             current->initializer+=yytext; 
2700                                             pCopyQuotedGString=&current->initializer;
2701                                             BEGIN(CopyGString);
2702                                           }
2703                                         }
2704 <ReadInitializer>"->"                   {
2705                                           current->initializer+=yytext; 
2706                                         }
2707 <ReadInitializer>"<<"                   {
2708                                           current->initializer+=yytext; 
2709                                         }
2710 <ReadInitializer>">>"                   {
2711                                           current->initializer+=yytext; 
2712                                         }
2713 <ReadInitializer>[<\[{(]                {
2714                                           initBracketCount++;
2715                                           current->initializer+=*yytext; 
2716                                         }
2717 <ReadInitializer>[>\]})]                {
2718                                           initBracketCount--;
2719                                           current->initializer+=*yytext; 
2720                                         }
2721 <ReadInitializer>\'                     {       
2722                                           if (insidePHP)
2723                                           {
2724                                             current->initializer+=yytext; 
2725                                             pCopyQuotedGString = &current->initializer;
2726                                             lastStringContext=YY_START;
2727                                             BEGIN(CopyPHPGString);
2728                                           }
2729                                           else
2730                                           {
2731                                             current->initializer+=yytext; 
2732                                           }
2733                                         }
2734 <ReadInitializer>{CHARLIT}              { 
2735                                           if (insidePHP) 
2736                                           {
2737                                             REJECT;
2738                                           }
2739                                           else
2740                                           {  
2741                                             current->initializer+=yytext; 
2742                                           }
2743                                         } 
2744 <ReadInitializer>\n                     {
2745                                           current->initializer+=*yytext;
2746                                           lineCount();
2747                                         }
2748 <ReadInitializer>"@\""                  { 
2749                                           //printf("insideCS=%d\n",insideCS);
2750                                           current->initializer+=yytext;
2751                                           if (!insideCS && !insideObjC) 
2752                                           {
2753                                             REJECT;
2754                                           }
2755                                           else
2756                                           {
2757                                             // C#/ObjC verbatim string
2758                                             lastSkipVerbStringContext=YY_START;
2759                                             pSkipVerbString=&current->initializer;
2760                                             BEGIN(SkipVerbString);
2761                                           }
2762                                         }
2763 <SkipVerbString>[^\n"]+                 {
2764                                           *pSkipVerbString+=yytext;
2765                                         }
2766 <SkipVerbString>"\"\""                  { // quote escape
2767                                           *pSkipVerbString+=yytext;
2768                                         }
2769 <SkipVerbString>"\""                    {
2770                                           *pSkipVerbString+=*yytext;
2771                                           BEGIN(lastSkipVerbStringContext);
2772                                         }
2773 <SkipVerbString>\n                      {
2774                                           *pSkipVerbString+=*yytext;
2775                                           lineCount();
2776                                         }
2777 <SkipVerbString>.                       {
2778                                           *pSkipVerbString+=*yytext;
2779                                         }
2780 <ReadInitializer>"?>"                   {
2781                                           if (insidePHP)
2782                                             BEGIN( FindMembersPHP );
2783                                           else
2784                                             current->initializer+=yytext;
2785                                         }
2786 <ReadInitializer>.                      { 
2787                                           current->initializer+=*yytext; 
2788                                         }
2789
2790   /* generic quoted string copy rules */
2791 <CopyString,CopyPHPString>\\.           {
2792                                           *pCopyQuotedString+=yytext;
2793                                         }
2794 <CopyString>\"                          { 
2795                                           *pCopyQuotedString+=*yytext;
2796                                           BEGIN( lastStringContext ); 
2797                                         }
2798 <CopyPHPString>\'                       { 
2799                                           *pCopyQuotedString+=*yytext;
2800                                           BEGIN( lastStringContext ); 
2801                                         }
2802 <CopyString,CopyPHPString>"/*"|"*/"|"//" {
2803                                           *pCopyQuotedString+=yytext;
2804                                         }
2805 <CopyString,CopyPHPString>\n            {
2806                                           *pCopyQuotedString+=*yytext;
2807                                           lineCount();
2808                                         }
2809 <CopyString,CopyPHPString>.             {
2810                                           *pCopyQuotedString+=*yytext;
2811                                         }
2812
2813   /* generic quoted growable string copy rules */
2814 <CopyGString,CopyPHPGString>\\.         {
2815                                           *pCopyQuotedGString+=yytext;
2816                                         }
2817 <CopyGString>\"                         { 
2818                                           *pCopyQuotedGString+=*yytext;
2819                                           BEGIN( lastStringContext ); 
2820                                         }
2821 <CopyPHPGString>\'                      { 
2822                                           *pCopyQuotedGString+=*yytext;
2823                                           BEGIN( lastStringContext ); 
2824                                         }
2825 <CopyGString,CopyPHPGString>"/*"|"*/"|"//" {
2826                                           *pCopyQuotedGString+=yytext;
2827                                         }
2828 <CopyGString,CopyPHPGString>\n          {
2829                                           *pCopyQuotedGString+=*yytext;
2830                                           lineCount();
2831                                         }
2832 <CopyGString,CopyPHPGString>.           {
2833                                           *pCopyQuotedGString+=*yytext;
2834                                         }
2835
2836   /* generic round bracket list copy rules */
2837 <CopyRound>\"                           {
2838                                           *pCopyRoundString+=*yytext;
2839                                           pCopyQuotedString=pCopyRoundString;
2840                                           lastStringContext=YY_START;
2841                                           BEGIN(CopyString);
2842                                         }
2843 <CopyRound>"("                          {
2844                                           *pCopyRoundString+=*yytext;
2845                                           roundCount++;
2846                                         }
2847 <CopyRound>")"                          {
2848                                           *pCopyRoundString+=*yytext;
2849                                           if (--roundCount<0)
2850                                             BEGIN(lastRoundContext);
2851                                         }
2852 <CopyRound>\n                           {
2853                                           lineCount();
2854                                           *pCopyRoundString+=*yytext;
2855                                         }
2856 <CopyRound>\'                           {
2857                                           if (insidePHP)
2858                                           {
2859                                             current->initializer+=yytext; 
2860                                             pCopyQuotedString = pCopyRoundString;
2861                                             lastStringContext=YY_START;
2862                                             BEGIN(CopyPHPString);
2863                                           }
2864                                           else
2865                                           {
2866                                             *pCopyRoundString+=yytext;
2867                                           }
2868                                         }
2869 <CopyRound>{CHARLIT}                    { 
2870                                           if (insidePHP)
2871                                           {
2872                                             REJECT;
2873                                           }
2874                                           else
2875                                           {
2876                                             *pCopyRoundString+=yytext; 
2877                                           }
2878                                         }
2879 <CopyRound>[^"'()\n]+                   {
2880                                           *pCopyRoundString+=yytext;
2881                                         }
2882 <CopyRound>.                            {
2883                                           *pCopyRoundString+=*yytext;
2884                                         }
2885
2886   /* generic round bracket list copy rules for growable strings */
2887 <GCopyRound>\"                          {
2888                                           *pCopyRoundGString+=*yytext;
2889                                           pCopyQuotedGString=pCopyRoundGString;
2890                                           lastStringContext=YY_START;
2891                                           BEGIN(CopyGString);
2892                                         }
2893 <GCopyRound>"("                         {
2894                                           *pCopyRoundGString+=*yytext;
2895                                           roundCount++;
2896                                         }
2897 <GCopyRound>")"                         {
2898                                           *pCopyRoundGString+=*yytext;
2899                                           if (--roundCount<0)
2900                                             BEGIN(lastRoundContext);
2901                                         }
2902 <GCopyRound>\n                          {
2903                                           lineCount();
2904                                           *pCopyRoundGString+=*yytext;
2905                                         }
2906 <GCopyRound>\'                          {
2907                                           if (insidePHP)
2908                                           {
2909                                             current->initializer+=yytext; 
2910                                             pCopyQuotedGString = pCopyRoundGString;
2911                                             lastStringContext=YY_START;
2912                                             BEGIN(CopyPHPGString);
2913                                           }
2914                                           else
2915                                           {
2916                                             *pCopyRoundGString+=yytext;
2917                                           }
2918                                         }
2919 <GCopyRound>{CHARLIT}                   { 
2920                                           if (insidePHP)
2921                                           {
2922                                             REJECT;
2923                                           }
2924                                           else
2925                                           {
2926                                             *pCopyRoundGString+=yytext; 
2927                                           }
2928                                         }
2929 <GCopyRound>[^"'()\n/]+                 {
2930                                           *pCopyRoundGString+=yytext;
2931                                         }
2932 <GCopyRound>.                           {
2933                                           *pCopyRoundGString+=*yytext;
2934                                         }
2935
2936   /* generic curly bracket list copy rules */
2937 <CopyCurly>\"                           {
2938                                           *pCopyCurlyString+=*yytext;
2939                                           pCopyQuotedString=pCopyCurlyString;
2940                                           lastStringContext=YY_START;
2941                                           BEGIN(CopyString);
2942                                         }
2943 <CopyCurly>\'                           {
2944                                           *pCopyCurlyString+=*yytext;
2945                                           if (insidePHP)
2946                                           {
2947                                             pCopyQuotedString=pCopyCurlyString;
2948                                             lastStringContext=YY_START;
2949                                             BEGIN(CopyPHPString);
2950                                           }
2951                                         }
2952 <CopyCurly>"{"                          {
2953                                           *pCopyCurlyString+=*yytext;
2954                                           curlyCount++;
2955                                         }
2956 <CopyCurly>"}"                          {
2957                                           *pCopyCurlyString+=*yytext;
2958                                           if (--curlyCount<0)
2959                                             BEGIN(lastCurlyContext); 
2960                                         }
2961 <CopyCurly>{CHARLIT}                    { if (insidePHP) 
2962                                           { 
2963                                             REJECT; 
2964                                           } 
2965                                           else 
2966                                           {
2967                                             *pCopyCurlyString+=yytext; 
2968                                           }
2969                                         }
2970 <CopyCurly>[^"'{}\/\n]+                 {
2971                                           *pCopyCurlyString+=yytext;
2972                                         }
2973 <CopyCurly>"/"                          { *pCopyCurlyString+=yytext; }
2974 <CopyCurly>\n                           {
2975                                           lineCount();
2976                                           *pCopyCurlyString+=*yytext;
2977                                         }
2978 <CopyCurly>.                            {
2979                                           *pCopyCurlyString+=*yytext;
2980                                         }
2981
2982   /* generic curly bracket list copy rules for growable strings */
2983 <GCopyCurly>^"#"{B}+[0-9]+{B}+"\""[^\"\n]+"\""{B}+"1"{B}*\n? { // start of included file marker
2984                                         }
2985 <GCopyCurly>^"#"{B}+[0-9]+{B}+"\""[^\"\n]+"\""{B}+"2"{B}*\n? { // end of included file marker
2986                                           QCString line = QCString(yytext);
2987                                           int s = line.find(' ');
2988                                           int e = line.find('"',s);
2989                                           yyLineNr = line.mid(s,e-s).toInt();
2990                                           if (yytext[yyleng-1]=='\n')
2991                                           {
2992                                             yyLineNr++;
2993                                             g_column=0;
2994                                           }
2995                                         }
2996 <GCopyCurly>\"                          {
2997                                           *pCopyCurlyGString+=*yytext;
2998                                           pCopyQuotedGString=pCopyCurlyGString;
2999                                           lastStringContext=YY_START;
3000                                           BEGIN(CopyGString);
3001                                         }
3002 <GCopyCurly>\'                          {
3003                                           *pCopyCurlyGString+=*yytext;
3004                                           if (insidePHP)
3005                                           {
3006                                             pCopyQuotedGString=pCopyCurlyGString;
3007                                             lastStringContext=YY_START;
3008                                             BEGIN(CopyPHPGString);
3009                                           }
3010                                         }
3011 <GCopyCurly>"{"                         {
3012                                           *pCopyCurlyGString+=*yytext;
3013                                           curlyCount++;
3014                                         }
3015 <GCopyCurly>"}"                         {
3016                                           *pCopyCurlyGString+=*yytext;
3017                                           if (--curlyCount<0)
3018                                             BEGIN(lastCurlyContext); 
3019                                         }
3020 <GCopyCurly>{CHARLIT}                    { if (insidePHP) 
3021                                           { 
3022                                             REJECT; 
3023                                           } 
3024                                           else 
3025                                           {
3026                                             *pCopyCurlyGString+=yytext; 
3027                                           }
3028                                         }
3029 <GCopyCurly>[^"'{}\/\n]+                {
3030                                           *pCopyCurlyGString+=yytext;
3031                                         }
3032 <GCopyCurly>"/"                         { *pCopyCurlyGString+=yytext; }
3033 <GCopyCurly>\n                          {
3034                                           lineCount();
3035                                           *pCopyCurlyGString+=*yytext;
3036                                         }
3037 <GCopyCurly>.                           {
3038                                           *pCopyCurlyGString+=*yytext;
3039                                         }
3040
3041   /* ---------------------- */
3042
3043
3044 <FindMembers>":"                        {
3045                                           if (current->type.isEmpty()) // anonymous padding field, e.g. "int :7;"
3046                                           {
3047                                             addType(current);
3048                                             current->name.sprintf("__pad%d__",padCount++);
3049                                           }
3050                                           BEGIN(BitFields);
3051                                           current->bitfields+=":";
3052                                         }
3053 <BitFields>.                            {
3054                                           current->bitfields+=*yytext;
3055                                         }
3056 <EnumBaseType>.                         {
3057                                           current->args+=*yytext;
3058                                         }
3059 <EnumBaseType>\n                        {
3060                                           lineCount();
3061                                         }
3062 <FindMembers>[;,]                       { 
3063                                           QCString oldType = current->type;
3064                                           if (current->bodyLine==-1)
3065                                           {
3066                                             current->bodyLine = yyLineNr;
3067                                           }
3068                                           if ( insidePHP && current->type.left(3) == "var" )
3069                                           {
3070                                             current->type = current->type.mid(3);
3071                                           }
3072                                           if (isTypedef && current->type.left(8)!="typedef ")
3073                                           {
3074                                             current->type.prepend("typedef ");
3075                                           }
3076                                           bool needNewCurrent=FALSE;
3077                                           if (!current->name.isEmpty() && current->section!=Entry::ENUM_SEC)
3078                                           {
3079                                             current->type=current->type.simplifyWhiteSpace();
3080                                             current->args=removeRedundantWhiteSpace(current->args);
3081                                             current->name=current->name.stripWhiteSpace();
3082                                             if (current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;"
3083                                             {
3084                                                 current->spec = 0;
3085                                             }
3086                                             current->section = Entry::VARIABLE_SEC ;
3087                                             current->fileName = yyFileName;
3088                                             current->startLine = yyLineNr;
3089                                             current_root->addSubEntry( current ) ;
3090                                             needNewCurrent=TRUE;
3091                                           }
3092                                           if ( *yytext == ',')
3093                                           {
3094                                             bool stat = current->stat;
3095                                             if (needNewCurrent)
3096                                             {
3097                                               current = new Entry(*current);
3098                                               initEntry();
3099                                             }
3100                                             current->stat = stat; // the static attribute holds for all variables
3101                                             current->name.resize(0);
3102                                             current->args.resize(0);
3103                                             current->brief.resize(0);
3104                                             current->doc.resize(0);
3105                                             current->initializer.resize(0);
3106                                             current->bitfields.resize(0);
3107                                             int i=oldType.length(); 
3108                                             while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--;
3109                                             current->type = oldType.left(i);
3110                                           }
3111                                           else
3112                                           {
3113                                             if (needNewCurrent)
3114                                             {
3115                                               current = new Entry ;
3116                                             }
3117                                             else if (current->groups)
3118                                             {
3119                                               current->groups->clear();
3120                                             }
3121                                             initEntry();
3122                                           }
3123                                         }
3124
3125 <FindMembers>"["                        { 
3126                                           if (!insideCS &&  
3127                                               (current->name.isEmpty() || 
3128                                                current->name=="typedef"
3129                                               )
3130                                              ) // IDL function property
3131                                           {
3132                                             squareCount=1;
3133                                             lastSquareContext = YY_START;
3134                                             idlAttr.resize(0);
3135                                             idlProp.resize(0);
3136                                             current->mtype = mtype;
3137                                             BEGIN( IDLAttribute );
3138                                           }
3139                                           else if (insideCS &&
3140                                                   current->name.isEmpty())
3141                                           {
3142                                             squareCount=1;
3143                                             lastSquareContext = YY_START;
3144                                             // Skip the C# attribute
3145                                             // for this member
3146                                             current->args.resize(0);
3147                                             BEGIN( SkipSquare );
3148                                           }
3149                                           else
3150                                           {
3151                                             current->args += yytext ;
3152                                             squareCount=1;
3153                                             BEGIN( Array ) ;
3154                                           }
3155                                         }
3156 <IDLAttribute>"]"                       {
3157                                           // end of IDL function attribute
3158                                           if (--squareCount<=0)
3159                                           {
3160                                             lineCount();
3161                                             if (current->mtype == Property)
3162                                               BEGIN( IDLPropName );
3163                                             else
3164                                               BEGIN( lastSquareContext );
3165                                           }
3166                                         }
3167 <IDLAttribute>"propput"                 {
3168                                           if (Config_getBool("IDL_PROPERTY_SUPPORT"))
3169                                           {
3170                                             current->mtype = Property;
3171                                           }
3172                                           current->spec |= Entry::Settable;
3173                                         }
3174 <IDLAttribute>"propget"                 {
3175                                           if (Config_getBool("IDL_PROPERTY_SUPPORT"))
3176                                           {
3177                                             current->mtype = Property;
3178                                           }
3179                                           current->spec |= Entry::Gettable;
3180                                         }
3181 <IDLAttribute>.                         {
3182                                         }
3183 <IDLPropName>{BN}*{ID}{BN}*             {
3184                                           // return type (probably HRESULT) - skip it
3185                                         }
3186 <IDLPropName>{ID}{BN}*"("               {
3187                                           current->name = yytext;
3188                                           current->name = current->name.left(current->name.length()-1).stripWhiteSpace();
3189                                           current->startLine = yyLineNr;
3190                                           BEGIN( IDLProp );
3191                                         }
3192 <IDLProp>{BN}*"["[^\]]*"]"{BN}*         {  // attribute of a parameter
3193                                            idlAttr = yytext;
3194                                            idlAttr=idlAttr.stripWhiteSpace();
3195                                         }
3196 <IDLProp>{ID}                           {  // property type
3197                                            idlProp = yytext;
3198                                         }
3199 <IDLProp>{BN}*{ID}{BN}*","              {  // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);)
3200                                           if (!current->args)
3201                                             current->args = "(";
3202                                           else
3203                                             current->args += ", ";
3204                                           current->args += idlAttr;
3205                                           current->args += " ";
3206                                           current->args += idlProp;     // prop was actually type of extra parameter
3207                                           current->args += " ";
3208                                           current->args += yytext;
3209                                           current->args = current->args.left(current->args.length() - 1);       // strip comma
3210                                           idlProp.resize(0);
3211                                           idlAttr.resize(0);
3212                                           BEGIN( IDLProp );
3213                                         }
3214 <IDLProp>{BN}*{ID}{BN}*")"{BN}*         {
3215                                           // the parameter name for the property - just skip.
3216                                         }
3217 <IDLProp>";"                            {
3218                                           current->fileName   = yyFileName;
3219                                           current->type         = idlProp;
3220                                           current->args       = current->args.simplifyWhiteSpace();
3221                                           if (current->args)
3222                                             current->args += ")";
3223                                           current->name       = current->name.stripWhiteSpace();
3224                                           current->section    = Entry::VARIABLE_SEC;
3225                                           current_root->addSubEntry(current);
3226                                           current             = new Entry;
3227                                           initEntry();
3228                                           BEGIN( FindMembers );
3229                                         }
3230 <IDLProp>.                              { // spaces, *, or other stuff
3231                                           //idlProp+=yytext;
3232                                         }
3233 <Array>"]"                              { current->args += *yytext ;
3234                                           if (--squareCount<=0)
3235                                              BEGIN( FindMembers ) ;
3236                                         }
3237 <FuncFuncArray>"]"                      { current->args += *yytext ;
3238                                           if (--squareCount<=0)
3239                                              BEGIN( Function ) ;
3240                                         }
3241 <Array,FuncFuncArray>"["                { current->args += *yytext ;
3242                                           squareCount++;        
3243                                         }
3244 <Array,FuncFuncArray>.                  { current->args += *yytext ; }
3245 <SkipSquare>"["                         { squareCount++; }
3246 <SkipSquare>"]"                         {
3247                                           if (--squareCount<=0)
3248                                             BEGIN( lastSquareContext );
3249                                         }
3250 <SkipSquare>\"                          {
3251                                           lastStringContext=YY_START;
3252                                           BEGIN( SkipString ); 
3253                                         }
3254 <SkipSquare>[^\n\[\]\"]+
3255 <FindMembers>"<"                        { addType( current ) ;
3256                                           current->type += yytext ;
3257                                           BEGIN( Sharp ) ;
3258                                         }
3259 <Sharp>">"                              { current->type += *yytext ;
3260                                           if (--sharpCount<=0)
3261                                              BEGIN( FindMembers ) ;
3262                                         }
3263 <Sharp>"<"                              { current->type += *yytext ;
3264                                           sharpCount++; 
3265                                         }
3266 <Sharp>{BN}+                            {
3267                                           lineCount();
3268                                         }
3269 <Sharp>.                                { current->type += *yytext ; }
3270 <FindFields>{ID}                        {
3271                                           current->bodyLine = yyLineNr;
3272                                           current->name     = yytext;
3273                                         }
3274 <FindFields>"("                         {
3275                                           // Java enum initializer
3276                                           unput('(');
3277                                           lastInitializerContext = YY_START;
3278                                           initBracketCount=0;
3279                                           current->initializer = "=";
3280                                           BEGIN(ReadInitializer);
3281                                         }
3282 <FindFields>"="                         {
3283                                           lastInitializerContext = YY_START;
3284                                           initBracketCount=0;
3285                                           current->initializer = yytext;
3286                                           BEGIN(ReadInitializer);
3287                                         }
3288 <FindFields>";"                         {
3289                                           if (insideJava)  // last enum field in Java class
3290                                           {
3291                                             if (!current->name.isEmpty())
3292                                             {
3293                                               current->fileName   = yyFileName;
3294                                               current->startLine  = yyLineNr;
3295                                               current->type       = "@"; // enum marker
3296                                               current->args       = current->args.simplifyWhiteSpace();
3297                                               current->name       = current->name.stripWhiteSpace();
3298                                               current->section    = Entry::VARIABLE_SEC;
3299                                               current_root->addSubEntry(current);
3300                                               current             = new Entry ;
3301                                               initEntry();
3302                                             }
3303
3304                                             BEGIN( FindMembers );
3305                                           }
3306                                           else
3307                                           {
3308                                             REJECT;
3309                                           }
3310                                         }
3311 <SkipRemainder>\n                       { 
3312                                           lineCount();
3313                                         }
3314 <SkipRemainder>[^\n]*
3315 <FindFields>","                         {
3316                                           //printf("adding `%s' `%s' `%s' to enum `%s' (mGrpId=%d)\n",
3317                                           //     current->type.data(), current->name.data(),
3318                                           //     current->args.data(), current_root->name.data(),current->mGrpId);
3319                                           if (!current->name.isEmpty())
3320                                           {
3321                                             current->fileName   = yyFileName;
3322                                             current->startLine  = yyLineNr;
3323                                             if (!(current_root->spec&Entry::Enum))
3324                                             {
3325                                               current->type       = "@"; // enum marker
3326                                             }
3327                                             current->args       = current->args.simplifyWhiteSpace();
3328                                             current->name       = current->name.stripWhiteSpace();
3329                                             current->section    = Entry::VARIABLE_SEC;
3330                                             // add to the scope of the enum
3331                                             current_root->addSubEntry(current);
3332                                             if (!insideCS && !insideJava &&
3333                                                 !(current_root->spec&Entry::Strong)) 
3334                                                 // for C# and Java 1.5+ enum values always have to be explicitly qualified,
3335                                                 // same for C++11 style enums (enum class Name {})
3336                                             {
3337                                               current             = new Entry(*current);
3338                                               // add to the scope surrounding the enum (copy!)
3339                                               current_root->parent()->addSubEntry(current);
3340                                             }
3341                                             current             = new Entry ;
3342                                             initEntry();
3343                                           }
3344                                           else // probably a redundant , 
3345                                           {
3346                                             current->reset();
3347                                             initEntry();
3348                                           }
3349                                         }
3350 <FindFields>"["                         { // attribute list in IDL
3351                                           squareCount=1;
3352                                           lastSquareContext = YY_START;
3353                                           BEGIN(SkipSquare);
3354                                         }
3355   /*
3356 <FindFieldArg>","                       { unput(*yytext); BEGIN(FindFields); }
3357   */
3358 <ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]*     { current->program += yytext ; }
3359 <ReadBody,ReadNSBody,ReadBodyIntf>"//".*                { current->program += yytext ; }
3360 <ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!insidePHP) 
3361                                             REJECT;
3362                                           // append PHP comment.
3363                                           current->program += yytext ;
3364                                         }
3365 <ReadBody,ReadNSBody,ReadBodyIntf>@\"   { current->program += yytext ; 
3366                                           pSkipVerbString = &current->program;
3367                                           lastSkipVerbStringContext=YY_START;
3368                                           BEGIN( SkipVerbString );
3369                                         }
3370 <ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { if (insidePHP)
3371                                           {
3372                                             current->program += yytext ; 
3373                                             pCopyHereDocGString = &current->program;
3374                                             lastHereDocContext=YY_START;
3375                                             BEGIN( CopyHereDoc );
3376                                           }
3377                                           else
3378                                           {
3379                                             REJECT;
3380                                           }
3381                                         }
3382 <ReadBody,ReadNSBody,ReadBodyIntf>\"    { current->program += yytext ; 
3383                                           pCopyQuotedGString = &current->program;
3384                                           lastStringContext=YY_START;
3385                                           BEGIN( CopyGString );
3386                                         }
3387 <ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}*              { current->program += yytext ;
3388                                           lastContext = YY_START ;
3389                                           BEGIN( Comment ) ;
3390                                         }
3391 <ReadBody,ReadNSBody,ReadBodyIntf>"/*"{BL}              { current->program += yytext ;
3392                                           ++yyLineNr ;
3393                                           lastContext = YY_START ;
3394                                           BEGIN( Comment ) ;
3395                                         }
3396 <ReadBody,ReadNSBody,ReadBodyIntf>"'"   {
3397                                           if (!insidePHP)
3398                                           {
3399                                             current->program += yytext;
3400                                           }
3401                                           else
3402                                           { // begin of single quoted string
3403                                             current->program += yytext;
3404                                             pCopyQuotedGString = &current->program;
3405                                             lastStringContext=YY_START;
3406                                             BEGIN(CopyPHPGString);
3407                                           }
3408                                         }
3409 <ReadBody,ReadNSBody,ReadBodyIntf>{CHARLIT} { 
3410                                               if (insidePHP) 
3411                                               {
3412                                                 REJECT; // for PHP code single quotes 
3413                                                         // are used for strings of arbitrary length
3414                                               }
3415                                               else
3416                                               {
3417                                                 current->program += yytext; 
3418                                               }
3419                                             }
3420 <ReadBody,ReadNSBody,ReadBodyIntf>"{"       { current->program += yytext ;
3421                                           ++curlyCount ;
3422                                         }
3423 <ReadBodyIntf>"}"                       {
3424                                           current->program += yytext ;
3425                                           --curlyCount ;
3426                                         }
3427 <ReadBody,ReadNSBody>"}"                { //err("ReadBody count=%d\n",curlyCount);
3428                                           if ( curlyCount>0 )
3429                                           {
3430                                             current->program += yytext ;
3431                                             --curlyCount ;
3432                                           }
3433                                           else
3434                                           {
3435                                             current->endBodyLine = yyLineNr;
3436                                             QCString &cn = current->name;
3437                                             QCString rn = current_root->name.copy();
3438                                             //printf("cn=`%s' rn=`%s' isTypedef=%d\n",cn.data(),rn.data(),isTypedef);
3439                                             if (!cn.isEmpty() && !rn.isEmpty())
3440                                             {
3441                                               prependScope();
3442                                             }
3443                                             if (isTypedef && cn.isEmpty())
3444                                             {
3445                                               //printf("Typedef Name\n");
3446                                               BEGIN( TypedefName );
3447                                             }
3448                                             else
3449                                             {
3450                                               if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum))
3451                                               {
3452                                                 current->program+=','; // add field terminator
3453                                               }
3454                                               // add compound definition to the tree
3455                                               current->args=removeRedundantWhiteSpace(current->args);
3456                                                         // was: current->args.simplifyWhiteSpace();
3457                                               current->type = current->type.simplifyWhiteSpace();
3458                                               current->name = current->name.stripWhiteSpace();
3459                                               //printf("adding `%s' `%s' `%s' brief=%s insideObjC=%d %x\n",current->type.data(),current->name.data(),current->args.data(),current->brief.data(),insideObjC,current->section);
3460                                               if (insideObjC && 
3461                                                   ((current->spec&Entry::Interface) || (current->spec==Entry::Category))
3462                                                  ) // method definition follows
3463                                               {
3464                                                 BEGIN( ReadBodyIntf ) ;
3465                                               }
3466                                               else
3467                                               {
3468                                                 current_root->addSubEntry( current ) ;
3469                                                 memspecEntry = current;
3470                                                 current = new Entry(*current);
3471                                                 if (current->section==Entry::NAMESPACE_SEC || 
3472                                                     (current->spec==Entry::Interface) ||
3473                                                     insideJava || insidePHP || insideCS || insideD || insideJS
3474                                                    )
3475                                                 { // namespaces and interfaces and java classes ends with a closing bracket without semicolon
3476                                                   current->reset();
3477                                                   initEntry();
3478                                                   memspecEntry = 0;
3479                                                   BEGIN( FindMembers ) ;
3480                                                 }
3481                                                 else
3482                                                 {
3483                                                   if (!isTypedef) // not typedef 
3484                                                   {
3485                                                     // enabled the next two lines for bug 623424
3486                                                     current->doc.resize(0);
3487                                                     current->brief.resize(0);
3488                                                   }
3489                                                   BEGIN( MemberSpec ) ;
3490                                                 }
3491                                               }
3492                                             }
3493                                           }
3494                                         }
3495 <ReadBody>"}"{BN}+"typedef"{BN}+        { //err("ReadBody count=%d\n",curlyCount);
3496                                           lineCount();
3497                                           if ( curlyCount>0 )
3498                                           {
3499                                             current->program += yytext ;
3500                                             --curlyCount ;
3501                                           }
3502                                           else
3503                                           {
3504                                             isTypedef = TRUE;
3505                                             current->endBodyLine = yyLineNr;
3506                                             QCString &cn = current->name;
3507                                             QCString rn = current_root->name.copy();
3508                                             if (!cn.isEmpty() && !rn.isEmpty())
3509                                             {
3510                                               prependScope();
3511                                             }
3512                                             BEGIN( TypedefName );
3513                                           }
3514                                         }
3515 <TypedefName>("const"|"volatile"){BN}   { // late "const" or "volatile" keyword
3516                                           lineCount();
3517                                           current->type.prepend(yytext);
3518                                         }
3519 <TypedefName>{ID}                       {
3520                                           if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum))
3521                                           {
3522                                             current->program+=","; // add field terminator
3523                                           }
3524                                           current->name=yytext;
3525                                           prependScope();
3526                                           current->args = current->args.simplifyWhiteSpace();
3527                                           current->type = current->type.simplifyWhiteSpace();
3528                                           //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data());
3529                                           current_root->addSubEntry( current ) ;
3530                                           if (!firstTypedefEntry)
3531                                           {
3532                                             firstTypedefEntry = current;
3533                                           }
3534                                           current = new Entry;
3535                                           initEntry();
3536                                           isTypedef=TRUE; // to undo reset by initEntry()
3537                                           BEGIN(MemberSpecSkip); 
3538                                         }
3539 <TypedefName>";"                        { /* typedef of anonymous type */
3540                                           current->name.sprintf("@%d",anonCount++);
3541                                           if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum))
3542                                           {
3543                                             current->program+=','; // add field terminator
3544                                           }
3545                                           // add compound definition to the tree
3546                                           current->args = current->args.simplifyWhiteSpace();
3547                                           current->type = current->type.simplifyWhiteSpace();
3548                                           current_root->addSubEntry( current ) ;
3549                                           memspecEntry = current;
3550                                           current = new Entry(*current);
3551                                           initEntry();
3552                                           unput(';');
3553                                           BEGIN( MemberSpec ) ;
3554                                         }
3555 <MemberSpec>([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part could be improved.
3556                                           lineCount();
3557                                           int i=0,l=yyleng,j;
3558                                           while (i<l && (!isId(yytext[i]))) i++;
3559                                           msName = QCString(yytext).right(l-i).stripWhiteSpace();
3560                                           j=msName.find("[");
3561                                           if (j!=-1) 
3562                                           {
3563                                             msArgs=msName.right(msName.length()-j);
3564                                             msName=msName.left(j);
3565                                           }
3566                                           msType=QCString(yytext).left(i);
3567
3568                                           // handle *pName in: typedef { ... } name, *pName;
3569                                           if (firstTypedefEntry) 
3570                                           {
3571                                             if (firstTypedefEntry->spec&Entry::Struct)
3572                                             {
3573                                               msType.prepend("struct "+firstTypedefEntry->name);
3574                                             }
3575                                             else if (firstTypedefEntry->spec&Entry::Union)
3576                                             {
3577                                               msType.prepend("union "+firstTypedefEntry->name);
3578                                             }
3579                                             else if (firstTypedefEntry->section==Entry::ENUM_SEC)
3580                                             {
3581                                               msType.prepend("enum "+firstTypedefEntry->name);
3582                                             }
3583                                             else
3584                                             {
3585                                               msType.prepend(firstTypedefEntry->name);
3586                                             }
3587                                           }
3588                                         }
3589 <MemberSpec>"("                         { // function with struct return type
3590                                           addType(current);
3591                                           current->name = msName;
3592                                           current->spec = 0;
3593                                           unput('(');
3594                                           BEGIN(FindMembers);
3595                                         }
3596 <MemberSpec>[,;]                        {
3597                                           if (msName.isEmpty() && !current->name.isEmpty())
3598                                           { 
3599                                             // see if the compound does not have a name or is inside another
3600                                             // anonymous compound. If so we insert a 
3601                                             // special `anonymous' variable.
3602                                             //Entry *p=current_root;
3603                                             Entry *p=current;
3604                                             while (p)
3605                                             {
3606                                               // only look for class scopes, not namespace scopes
3607                                               if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty())
3608                                               {
3609                                                 //printf("Trying scope `%s'\n",p->name.data());
3610                                                 int i=p->name.findRev("::");
3611                                                 int pi = (i==-1) ? 0 : i+2;
3612                                                 if (p->name.at(pi)=='@')
3613                                                 {
3614                                                   // anonymous compound inside -> insert dummy variable name
3615                                                   //printf("Adding anonymous variable for scope %s\n",p->name.data());
3616                                                   msName.sprintf("@%d",anonCount++); 
3617                                                   break;
3618                                                 }
3619                                               }
3620                                               //p=p->parent;
3621                                               if (p==current) p=current_root; else p=p->parent();
3622                                             }
3623                                           }
3624                                           //printf("msName=%s current->name=%s\n",msName.data(),current->name.data());
3625                                           if (!msName.isEmpty() 
3626                                               /*&& msName!=current->name*/) // skip typedef T {} T;, removed due to bug608493
3627                                           {
3628                                             static bool typedefHidesStruct = Config_getBool("TYPEDEF_HIDES_STRUCT");
3629                                             // case 1: typedef struct _S { ... } S_t; 
3630                                             // -> omit typedef and use S_t as the struct name
3631                                             if (typedefHidesStruct && 
3632                                                 isTypedef && 
3633                                                 ((current->spec&(Entry::Struct|Entry::Union)) ||
3634                                                  current->section==Entry::ENUM_SEC )&&
3635                                                 msType.stripWhiteSpace().isEmpty() && 
3636                                                 memspecEntry)
3637                                             {
3638                                               memspecEntry->name=msName;
3639                                             }
3640                                             else // case 2: create a typedef field
3641                                             {
3642                                               Entry *varEntry=new Entry;
3643                                               varEntry->lang = language;
3644                                               varEntry->protection = current->protection ;
3645                                               varEntry->mtype = current->mtype;
3646                                               varEntry->virt = current->virt;
3647                                               varEntry->stat = current->stat;
3648                                               varEntry->section = Entry::VARIABLE_SEC;
3649                                               varEntry->name = msName.stripWhiteSpace();
3650                                               varEntry->type = current->type.simplifyWhiteSpace()+" ";
3651                                               varEntry->args = msArgs; 
3652                                               if (isTypedef)
3653                                               {
3654                                                 varEntry->type.prepend("typedef ");
3655                                                 //  //printf("current->name = %s %s\n",current->name.data(),msName.data());
3656                                               }
3657                                               if (typedefHidesStruct &&
3658                                                   isTypedef &&
3659                                                   (current->spec&(Entry::Struct|Entry::Union)) &&
3660                                                   memspecEntry
3661                                                  ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;"
3662                                               {
3663                                                 varEntry->type+=memspecEntry->name+msType;
3664                                               }
3665                                               else // case 2: use _S as type for for pS_t
3666                                               {
3667                                                 varEntry->type+=current->name+msType;
3668                                               }
3669                                               varEntry->fileName = yyFileName;
3670                                               varEntry->startLine = yyLineNr;
3671                                               varEntry->doc = current->doc.copy();
3672                                               varEntry->brief = current->brief.copy();
3673                                               varEntry->mGrpId = current->mGrpId;
3674                                               varEntry->initializer = current->initializer;
3675
3676                                               // deep copy group list
3677                                               QListIterator<Grouping> gli(*current->groups);
3678                                               Grouping *g;
3679                                               for (;(g=gli.current());++gli)
3680                                               {
3681                                                 varEntry->groups->append(new Grouping(*g));
3682                                               }
3683                                               if (current->sli) // copy special list items
3684                                               {
3685                                                 QListIterator<ListItemInfo> li(*current->sli);
3686                                                 ListItemInfo *lii;
3687                                                 for (li.toFirst();(lii=li.current());++li)
3688                                                 {
3689                                                   varEntry->addSpecialListItem(lii->type,lii->itemId);
3690                                                 }
3691                                               }
3692
3693                                               //printf("Add: type=`%s',name=`%s',args=`%s' brief=%s doc=%s\n",
3694                                               //      varEntry->type.data(),varEntry->name.data(),
3695                                               //      varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data());
3696                                               current_root->addSubEntry(varEntry);
3697                                             }
3698                                           }
3699                                           if (*yytext==';') // end of a struct/class ...
3700                                           {
3701                                             if (!isTypedef && msName.isEmpty() && memspecEntry && (current->section&Entry::COMPOUND_MASK))
3702                                             { // case where a class/struct has a doc block after it
3703                                               if (!current->doc.isEmpty())
3704                                               {
3705                                                 memspecEntry->doc += current->doc;
3706                                               }
3707                                               if (!current->brief.isEmpty())
3708                                               {
3709                                                 memspecEntry->brief += current->brief;
3710                                               }
3711                                             }
3712                                             msType.resize(0);
3713                                             msName.resize(0);
3714                                             msArgs.resize(0);
3715                                             isTypedef=FALSE;
3716                                             firstTypedefEntry=0;
3717                                             memspecEntry=0;
3718                                             current->reset();
3719                                             initEntry();
3720                                             BEGIN( FindMembers );
3721                                           }
3722                                           else
3723                                           {
3724                                             current->doc.resize(0);
3725                                             current->brief.resize(0);
3726                                           }
3727
3728                                         }
3729 <MemberSpec>"="                         { 
3730                                           lastInitializerContext=YY_START;
3731                                           initBracketCount=0;
3732                                           current->initializer = yytext;
3733                                           BEGIN(ReadInitializer);
3734                                           /* BEGIN(MemberSpecSkip); */
3735                                         }
3736   /*
3737 <MemberSpecSkip>"{"                     {
3738                                           curlyCount=0;
3739                                           lastCurlyContext = MemberSpecSkip;
3740                                           previous = current;
3741                                           BEGIN(SkipCurly);
3742                                         }
3743   */
3744 <MemberSpecSkip>","                     { BEGIN(MemberSpec); }
3745 <MemberSpecSkip>";"                     { unput(';'); BEGIN(MemberSpec); }
3746 <ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { current->program += yytext ;
3747                                           lineCount() ;
3748                                         }
3749 <ReadBodyIntf>"@end"/[^a-z_A-Z0-9]      { // end of Objective C block
3750                                           current_root->addSubEntry( current ) ;
3751                                           current=new Entry;
3752                                           initEntry();
3753                                           insideObjC=FALSE;
3754                                           BEGIN( FindMembers ); 
3755                                         }
3756 <ReadBody,ReadNSBody,ReadBodyIntf>.     { current->program += yytext ; }
3757
3758 <FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */
3759 <FindMembers>("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ {   /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */
3760                                           if (insidePHP) // reference parameter
3761                                           {
3762                                             REJECT
3763                                           }
3764                                           else
3765                                           {
3766                                             current->bodyLine = yyLineNr;
3767                                             lineCount();
3768                                             addType(current);
3769                                             funcPtrType=yytext;
3770                                             roundCount=0;
3771                                             //current->type += yytext;
3772                                             BEGIN( FuncPtr );
3773                                           }
3774                                         }
3775 <FuncPtr>{SCOPENAME}                    {
3776                                           current->name = yytext;
3777                                           if (nameIsOperator(current->name))
3778                                           {
3779                                             BEGIN( FuncPtrOperator );
3780                                           }
3781                                           else
3782                                           {
3783                                             if (current->name=="const" || current->name=="volatile")
3784                                             {
3785                                               funcPtrType += current->name;
3786                                             }
3787                                             else
3788                                             {
3789                                               BEGIN( EndFuncPtr );
3790                                             }
3791                                           }
3792                                         }
3793 <FuncPtr>.                              {
3794                                           //printf("error: FuncPtr `%c' unexpected at line %d of %s\n",*yytext,yyLineNr,yyFileName);
3795                                         }
3796 <FuncPtrOperator>"("{BN}*")"{BN}*/"("   {
3797                                           current->name += yytext;
3798                                           current->name = current->name.simplifyWhiteSpace();
3799                                           lineCount();
3800                                         }
3801 <FuncPtrOperator>\n                     {
3802                                           lineCount();
3803                                           current->name += *yytext;
3804                                         }
3805 <FuncPtrOperator>"("                    {
3806                                           unput(*yytext);
3807                                           BEGIN( EndFuncPtr );
3808                                         }
3809 <FuncPtrOperator>.                      {
3810                                           current->name += *yytext;
3811                                         }
3812 <EndFuncPtr>")"{BN}*/";"                { // a variable with extra braces
3813                                           lineCount();
3814                                           current->type+=funcPtrType.data()+1;
3815                                           BEGIN(FindMembers);
3816                                         }
3817 <EndFuncPtr>")"{BN}*/"("                { // a function pointer
3818                                           lineCount();
3819                                           current->type+=funcPtrType+")";
3820                                           BEGIN(FindMembers);
3821                                         }
3822 <EndFuncPtr>")"{BN}*/"["                { // an array of variables
3823                                           lineCount();
3824                                           current->type+=funcPtrType.data();
3825                                           current->args += ")";
3826                                           BEGIN(FindMembers);
3827                                         }
3828 <EndFuncPtr>"("                         { // a function returning a function or 
3829                                           // a function returning a pointer to an array
3830                                           current->args += *yytext ;
3831                                           //roundCount=0;
3832                                           //BEGIN( FuncFunc );
3833                                           current->bodyLine = yyLineNr;
3834                                           currentArgumentContext = FuncFuncEnd;
3835                                           fullArgString=current->args.copy();
3836                                           copyArgString=&current->args;
3837                                           BEGIN( ReadFuncArgType ) ;
3838                                         }
3839 <EndFuncPtr>"["[^\n\]]*"]"              {
3840                                           funcPtrType+=yytext;
3841                                         }
3842 <EndFuncPtr>")"                         {
3843                                           BEGIN(FindMembers);
3844                                         }
3845 <FuncFunc>"("                           {
3846                                           current->args += *yytext ;
3847                                           ++roundCount;
3848                                         }
3849 <FuncFunc>")"                           {
3850                                           current->args += *yytext ;
3851                                           if ( roundCount )
3852                                             --roundCount;
3853                                           else
3854                                           {
3855                                             BEGIN(FuncFuncEnd);
3856                                           }
3857                                         }
3858 <FuncFuncEnd>")"{BN}*"("                {
3859                                           lineCount();
3860                                           current->type+=funcPtrType+")(";
3861                                           BEGIN(FuncFuncType);
3862                                         }
3863 <FuncFuncEnd>")"{BN}*/[;{]              {
3864                                           lineCount();
3865                                           current->type+=funcPtrType.data()+1;
3866                                           BEGIN(Function);
3867                                         }
3868 <FuncFuncEnd>")"{BN}*/"["               { // function returning a pointer to an array
3869                                           lineCount();
3870                                           current->type+=funcPtrType;
3871                                           current->args+=")";
3872                                           BEGIN(FuncFuncArray);
3873                                         }
3874 <FuncFuncEnd>.                          {
3875                                           current->args += *yytext;
3876                                         }
3877 <FuncFuncType>"("                       {
3878                                           current->type += *yytext;
3879                                           roundCount++;
3880                                         }
3881 <FuncFuncType>")"                       {
3882                                           current->type += *yytext;
3883                                           if (roundCount)
3884                                             --roundCount;
3885                                           else
3886                                             BEGIN(Function);
3887                                         }
3888 <FuncFuncType>{BN}*","{BN}*             { lineCount() ; current->type += ", " ; }
3889 <FuncFuncType>{BN}+                     { lineCount() ; current->type += ' ' ; }
3890 <FuncFuncType>.                         {
3891                                           current->type += *yytext;
3892                                         }
3893 <FindMembers>"("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")(" { // for catching typedef void (__stdcall *f)() like definitions
3894                                           if (current->type.left(7)=="typedef" && current->bodyLine==-1) 
3895                                             // the bodyLine check is to prevent this guard to be true more than once
3896                                           {
3897                                             current->bodyLine = yyLineNr;
3898                                             BEGIN( GetCallType );
3899                                           }
3900                                           else if (!current->name.isEmpty()) // normal function
3901                                           {
3902                                             current->args = yytext;
3903                                             current->bodyLine = yyLineNr;
3904                                             currentArgumentContext = FuncQual;
3905                                             fullArgString=current->args.copy();
3906                                             copyArgString=&current->args;
3907                                             BEGIN( ReadFuncArgType ) ;
3908                                             //printf(">>> Read function arguments!\n");
3909                                           }
3910                                         }
3911 <GetCallType>{BN}*{ID}{BN}*"*"          {
3912                                           lineCount();
3913                                           addType(current);
3914                                           funcPtrType="(";
3915                                           funcPtrType+=yytext;
3916                                           roundCount=0;
3917                                           BEGIN( FuncPtr );
3918                                         }
3919 <FindMembers>"("                        { 
3920                                           if (!current->name.isEmpty())
3921                                           {
3922                                             current->args = yytext;
3923                                             current->bodyLine = yyLineNr;
3924                                             currentArgumentContext = FuncQual;
3925                                             fullArgString=current->args.copy();
3926                                             copyArgString=&current->args;
3927                                             BEGIN( ReadFuncArgType ) ;
3928                                             //printf(">>> Read function arguments current->argList->count()=%d\n",current->argList->count());
3929                                           }
3930                                         }
3931   /*
3932 <FindMembers>"("{BN}*("void"{BN}*)?")"  {
3933                                           lineCount();
3934                                           current->args = "()"; 
3935                                           BEGIN( FuncQual );
3936                                         }
3937   */
3938
3939   /*- Function argument reading rules ---------------------------------------*/
3940
3941 <ReadFuncArgType>[^ \/\r\t\n\)\(\"\'#]+ { *copyArgString+=yytext; 
3942                                           fullArgString+=yytext;
3943                                         }
3944 <CopyArgString,CopyArgPHPString>[^\n\\\"\']+            { *copyArgString+=yytext; 
3945                                           fullArgString+=yytext;
3946                                         }
3947 <CopyArgRound>[^\/\n\)\(\"\']+          { 
3948                                           *copyArgString+=yytext; 
3949                                           fullArgString+=yytext;
3950                                         }
3951 <ReadFuncArgType,ReadTempArgs>{BN}*     {
3952                                           *copyArgString+=" ";
3953                                           fullArgString+=" ";
3954                                           lineCount();
3955                                         }
3956 <ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>{RAWBEGIN}      {
3957                                           g_delimiter = yytext+2;
3958                                           g_delimiter=g_delimiter.left(g_delimiter.length()-1);
3959                                           lastRawStringContext = YY_START;
3960                                           pCopyRawString = copyArgString;
3961                                           *pCopyRawString+=yytext;
3962                                           fullArgString+=yytext;
3963                                           BEGIN(RawString);
3964                                         }
3965 <ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>\"      {
3966                                           *copyArgString+=*yytext;
3967                                           fullArgString+=*yytext;
3968                                           lastCopyArgStringContext = YY_START;
3969                                           BEGIN( CopyArgString );
3970                                         }
3971 <ReadFuncArgType,ReadTempArgs>"("       {
3972                                           *copyArgString+=*yytext;
3973                                           fullArgString+=*yytext;
3974                                           argRoundCount=0; 
3975                                           lastCopyArgContext = YY_START;
3976                                           BEGIN( CopyArgRound ); 
3977                                         }
3978 <ReadFuncArgType>")"                    { 
3979                                           *copyArgString+=*yytext;
3980                                           fullArgString+=*yytext;
3981                                           stringToArgumentList(fullArgString,current->argList);
3982                                           if (insideJS)
3983                                           {
3984                                             fixArgumentListForJavaScript(current->argList);
3985                                           }
3986                                           handleParametersCommentBlocks(current->argList);
3987
3988                                           /* remember the current documentation block, since
3989                                              we could overwrite it with the documentation of
3990                                              a function argument, which we then have to correct later
3991                                              on
3992                                            */
3993                                           docBackup = current->doc;
3994                                           briefBackup = current->brief;
3995
3996                                           BEGIN( currentArgumentContext );
3997                                         }
3998         /* a special comment */
3999 <ReadFuncArgType,ReadTempArgs>("/*"[*!]|"//"[/!])("<"?) { 
4000                                           if (currentArgumentContext==DefineEnd)
4001                                           {
4002                                             // for defines we interpret a comment
4003                                             // as documentation for the define 
4004                                             int i;for (i=yyleng-1;i>=0;i--)
4005                                             {
4006                                               unput(yytext[i]);
4007                                             }
4008                                             stringToArgumentList(fullArgString,current->argList);
4009                                             handleParametersCommentBlocks(current->argList);
4010                                             BEGIN( currentArgumentContext );
4011                                           }
4012                                           else // not a define
4013                                           {
4014                                             // for functions we interpret a comment
4015                                             // as documentation for the argument
4016                                             fullArgString+=yytext;
4017                                             lastCopyArgChar=0;
4018                                             lastCommentInArgContext=YY_START;
4019                                             if (yytext[1]=='/')
4020                                               BEGIN( CopyArgCommentLine );
4021                                             else
4022                                               BEGIN( CopyArgComment );
4023                                           }
4024                                         }
4025         /* a non-special comment */
4026 <ReadFuncArgType,ReadTempArgs>"/**/"    { /* empty comment */ }
4027 <ReadFuncArgType,ReadTempArgs>"/*"      {
4028                                           lastCContext = YY_START;
4029                                           BEGIN( SkipComment );
4030                                         }
4031 <ReadFuncArgType,ReadTempArgs>"//"      {
4032                                           lastCContext = YY_START;
4033                                           BEGIN( SkipCxxComment );
4034                                         }
4035   /*
4036 <ReadFuncArgType,ReadTempArgs>"'#"      { if (insidePHP)
4037                                             REJECT;
4038                                           *copyArgString+=yytext; 
4039                                           fullArgString+=yytext; 
4040                                         }
4041 <ReadFuncArgType,ReadTempArgs>"#"       {
4042                                           if (!insidePHP)
4043                                             REJECT;
4044                                           lastCContext = YY_START;
4045                                           BEGIN( SkipCxxComment );
4046                                         }
4047   */
4048         /* `)' followed by a special comment */
4049 <ReadFuncArgType>")"{BN}*("/*"[*!]|"//"[/!])"<" {
4050                                           lineCount();
4051                                           if (currentArgumentContext==DefineEnd)
4052                                           {
4053                                             // for defines we interpret a comment
4054                                             // as documentation for the define 
4055                                             int i;for (i=yyleng-1;i>0;i--)
4056                                             {
4057                                               unput(yytext[i]);
4058                                             }
4059                                             *copyArgString+=*yytext;
4060                                             fullArgString+=*yytext;
4061                                             stringToArgumentList(fullArgString,current->argList);
4062                                             handleParametersCommentBlocks(current->argList);
4063                                             BEGIN( currentArgumentContext );
4064                                           }
4065                                           else
4066                                           {
4067                                             // for functions we interpret a comment
4068                                             // as documentation for the last argument
4069                                             lastCopyArgChar=*yytext;
4070                                             QCString text=&yytext[1];
4071                                             text=text.stripWhiteSpace();
4072                                             lastCommentInArgContext=YY_START;
4073                                             fullArgString+=text;
4074                                             if (text.find("//")!=-1)
4075                                               BEGIN( CopyArgCommentLine );
4076                                             else
4077                                               BEGIN( CopyArgComment );
4078                                           }
4079                                         }
4080 <CopyArgComment>^{B}*"*"+/{BN}+         
4081 <CopyArgComment>[^\n\\\@\*]+            { fullArgString+=yytext; }
4082 <CopyArgComment>"*/"                    { fullArgString+=yytext; 
4083                                           if (lastCopyArgChar!=0)
4084                                             unput(lastCopyArgChar); 
4085                                           BEGIN( lastCommentInArgContext ); 
4086                                         }
4087 <CopyArgCommentLine>\n                  { fullArgString+=yytext;
4088                                           lineCount();
4089                                           if (lastCopyArgChar!=0)
4090                                             unput(lastCopyArgChar);
4091                                           BEGIN( lastCommentInArgContext );
4092                                         }
4093 <CopyArgCommentLine>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9]     { // verbatim command (which could contain nested comments!)
4094                                           docBlockName=&yytext[1];
4095                                           fullArgString+=yytext;
4096                                           BEGIN(CopyArgVerbatim);
4097                                         }
4098 <CopyArgCommentLine>{CMD}("f$"|"f["|"f{")               {
4099                                           docBlockName=&yytext[1];
4100                                           if (docBlockName.at(1)=='[')
4101                                           {
4102                                             docBlockName.at(1)='}';
4103                                           }
4104                                           if (docBlockName.at(1)=='{')
4105                                           {
4106                                             docBlockName.at(1)='}';
4107                                           }
4108                                           fullArgString+=yytext;
4109                                           BEGIN(CopyArgVerbatim);
4110                                         }
4111 <CopyArgVerbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9] { // end of verbatim block
4112                                           fullArgString+=yytext;
4113                                           if (yytext[1]=='f') // end of formula
4114                                           {
4115                                             BEGIN(CopyArgCommentLine);
4116                                           }
4117                                           if (&yytext[4]==docBlockName)
4118                                           {
4119                                             BEGIN(CopyArgCommentLine);
4120                                           }
4121                                         }
4122 <CopyArgCommentLine>[^\\\@\n]+          { fullArgString+=yytext; }
4123 <CopyArgCommentLine>.                   { fullArgString+=*yytext; }
4124 <CopyArgComment,CopyArgVerbatim>\n      { fullArgString+=*yytext; lineCount(); }
4125 <CopyArgComment,CopyArgVerbatim>.       { fullArgString+=*yytext; }
4126 <CopyArgComment>{CMD}("brief"|"short"){B}+ {
4127                                           warn(yyFileName,yyLineNr,
4128                                               "warning: Ignoring %cbrief command inside argument documentation",*yytext
4129                                              );
4130                                           fullArgString+=' ';
4131                                         }
4132 <ReadTempArgs>"<"                       {
4133                                           *copyArgString+=*yytext;
4134                                           fullArgString+=*yytext;
4135                                           argSharpCount=1;
4136                                           BEGIN( CopyArgSharp );
4137                                         }
4138 <ReadTempArgs>">"                       {
4139                                           *copyArgString+=*yytext;
4140                                           fullArgString+=*yytext;
4141                                           //printf("end template list %s\n",copyArgString->data());
4142                                           stringToArgumentList(fullArgString,currentArgumentList);
4143                                           BEGIN( currentArgumentContext );
4144                                         }
4145 <CopyArgRound>"("                       {
4146                                           argRoundCount++;
4147                                           *copyArgString+=*yytext;
4148                                           fullArgString+=*yytext;
4149                                         }
4150 <CopyArgRound>")"                       {
4151                                           *copyArgString+=*yytext;
4152                                           fullArgString+=*yytext;
4153                                           if (argRoundCount>0) 
4154                                             argRoundCount--;
4155                                           else 
4156                                             BEGIN( lastCopyArgContext );
4157                                         }
4158 <CopyArgSharp>"<"                       {
4159                                           argSharpCount++;
4160                                           //printf("argSharpCount++=%d  copy\n",argSharpCount);
4161                                           *copyArgString+=*yytext;
4162                                           fullArgString+=*yytext;
4163                                         }
4164 <CopyArgSharp>">"                       {
4165                                           *copyArgString+=*yytext;
4166                                           fullArgString+=*yytext;
4167                                           argSharpCount--;
4168                                           if (argSharpCount>0)
4169                                           {
4170                                             //printf("argSharpCount--=%d copy\n",argSharpCount);
4171                                           }
4172                                           else
4173                                           {
4174                                             BEGIN( ReadTempArgs );
4175                                             //printf("end of argSharpCount\n");
4176                                           }
4177                                         }
4178 <CopyArgString,CopyArgPHPString>\\.     {
4179                                           *copyArgString+=yytext;
4180                                           fullArgString+=yytext;
4181                                         }
4182 <CopyArgString>\"                       {
4183                                           *copyArgString+=*yytext;
4184                                           fullArgString+=*yytext;
4185                                           BEGIN( lastCopyArgStringContext );
4186                                         }
4187 <CopyArgPHPString>\'                    {
4188                                           *copyArgString+=*yytext;
4189                                           fullArgString+=*yytext;
4190                                           BEGIN( lastCopyArgStringContext );
4191                                         }
4192 <ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>{CHARLIT}     { 
4193                                           if (insidePHP)
4194                                           {
4195                                             REJECT;
4196                                           }
4197                                           else
4198                                           {
4199                                             *copyArgString+=yytext; 
4200                                             fullArgString+=yytext; 
4201                                           }
4202                                         }
4203 <ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>\'     { 
4204                                           *copyArgString+=yytext; 
4205                                           fullArgString+=yytext; 
4206                                           if (insidePHP)
4207                                           {
4208                                             lastCopyArgStringContext=YY_START;
4209                                             BEGIN(CopyArgPHPString);
4210                                           }
4211                                         }
4212 <ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>\n  { 
4213                                           lineCount();
4214                                           *copyArgString+=*yytext; 
4215                                           fullArgString+=*yytext; 
4216                                         }
4217 <ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>.          { 
4218                                           *copyArgString+=*yytext; 
4219                                           fullArgString+=*yytext; 
4220                                         }
4221
4222
4223
4224   /*------------------------------------------------------------------------*/
4225
4226
4227 <FuncRound>"("                          { current->args += *yytext ;
4228                                           ++roundCount ;
4229                                         }
4230 <FuncRound>")"                          { current->args += *yytext ; 
4231                                           if ( roundCount )
4232                                             --roundCount ;
4233                                           else
4234                                             BEGIN( FuncQual ) ;
4235                                         }
4236   /*
4237 <FuncQual>"#"                           { if (insidePHP)
4238                                             REJECT;
4239                                           lastCPPContext = YY_START;
4240                                           BEGIN(SkipCPP);
4241                                         }
4242   */
4243 <FuncQual>[{:;,]                        {
4244                                           if ( strcmp(yytext,";")==0 && 
4245                                                insidePHP && 
4246                                                !containsWord(current->type,"function") )
4247                                           {
4248                                             current->reset();
4249                                             initEntry();
4250                                             BEGIN( FindMembers );
4251                                           }
4252                                           else
4253                                           {
4254                                             unput(*yytext); BEGIN( Function );
4255                                           }
4256                                         }
4257 <FuncQual>{BN}*"abstract"{BN}*          { // pure virtual member function
4258                                           lineCount() ; 
4259                                           current->virt = Pure;
4260                                           current->args += " override "; 
4261                                         }
4262 <FuncQual,TrailingReturn>{BN}*"override"{BN}*          { // C++11 overridden virtual member function
4263                                           lineCount() ; 
4264                                           current->spec |= Entry::Override;
4265                                           current->args += " override "; 
4266                                           BEGIN(FuncQual);
4267                                         }
4268 <FuncQual,TrailingReturn>{BN}*"final"{BN}*             { // C++11 final method
4269                                           lineCount() ; 
4270                                           current->spec |= Entry::Final;
4271                                           current->args += " final "; 
4272                                           BEGIN(FuncQual);
4273                                         }
4274 <FuncQual>{BN}*"sealed"{BN}*            { // sealed member function
4275                                           lineCount() ; 
4276                                           current->spec |= Entry::Sealed;
4277                                           current->args += " sealed "; 
4278                                         }
4279 <FuncQual>{BN}*"new"{BN}*               { // new member function
4280                                           lineCount() ; 
4281                                           current->spec |= Entry::New;
4282                                           current->args += " new "; 
4283                                         }
4284 <FuncQual>{BN}*"const"{BN}*             { // const member function
4285                                           lineCount() ; 
4286                                           current->args += " const "; 
4287                                           current->argList->constSpecifier=TRUE;
4288                                         }
4289 <FuncQual>{BN}*"volatile"{BN}*          { // volatile member function
4290                                           lineCount() ; 
4291                                           current->args += " volatile "; 
4292                                           current->argList->volatileSpecifier=TRUE;
4293                                         }
4294 <FuncQual>{BN}*"noexcept"{BN}*          { // volatile member function
4295                                           lineCount() ; 
4296                                           current->args += " noexcept "; 
4297                                           current->spec |= Entry::NoExcept;
4298                                         }
4299 <FuncQual,TrailingReturn>{BN}*"="{BN}*"0"{BN}*          { // pure virtual member function
4300                                           lineCount() ; 
4301                                           current->args += " = 0"; 
4302                                           current->virt = Pure; 
4303                                           current->argList->pureSpecifier=TRUE;
4304                                           BEGIN(FuncQual);
4305                                         }
4306 <FuncQual,TrailingReturn>{BN}*"="{BN}*"delete"{BN}*     { // C++11 explicitly delete member
4307                                           lineCount();
4308                                           current->args += " = delete";
4309                                           current->spec |= Entry::Delete;
4310                                           BEGIN(FuncQual);
4311                                         }
4312 <FuncQual,TrailingReturn>{BN}*"="{BN}*"default"{BN}*     { // C++11 explicitly defaulted constructor/assignment operator
4313                                           lineCount();
4314                                           current->args += " = default";
4315                                           current->spec |= Entry::Default;
4316                                           BEGIN(FuncQual);
4317                                         }
4318 <FuncQual>{BN}*"->"{BN}*                {
4319                                           lineCount();
4320                                           current->argList->trailingReturnType = " -> ";
4321                                           current->args += " -> ";
4322                                           BEGIN(TrailingReturn);
4323                                         }
4324 <TrailingReturn>[{;]                    {
4325                                           unput(*yytext);
4326                                           BEGIN(FuncQual);
4327                                         }
4328 <TrailingReturn>.                       {
4329                                           current->argList->trailingReturnType+=yytext;
4330                                           current->args+=yytext;
4331                                         }
4332 <TrailingReturn>\n                      {
4333                                           lineCount();
4334                                           current->argList->trailingReturnType+=yytext;
4335                                           current->args+=' ';
4336                                         }
4337 <FuncRound,FuncFunc>{BN}*","{BN}*       { 
4338                                           lineCount() ; 
4339                                           current->args += ", " ; 
4340                                         }
4341 <FuncQual,FuncRound,FuncFunc>{BN}+      { 
4342                                           lineCount() ; 
4343                                           current->args += ' ' ; 
4344                                         }
4345 <Function,FuncQual,FuncRound,FuncFunc>"#" { if (insidePHP)
4346                                             REJECT;
4347                                           lastCPPContext = YY_START;
4348                                           BEGIN(SkipCPP);
4349                                         }       
4350 <FuncQual>"="                           { 
4351                                           if (insideCli && 
4352                                               (current_root->section&Entry::COMPOUND_MASK) 
4353                                              )
4354                                           {
4355                                             BEGIN(CliOverride);
4356                                           }
4357                                           else
4358                                           {
4359                                             // typically an initialized function pointer
4360                                             lastInitializerContext=YY_START;
4361                                             initBracketCount=0;
4362                                             current->initializer = yytext;
4363                                             BEGIN(ReadInitializer);
4364                                           }
4365                                         }
4366 <CliOverride>{ID}                       {
4367                                         }
4368 <CliOverride>"{"                        { 
4369                                           unput(*yytext);
4370                                           BEGIN(FuncQual);
4371                                         }
4372 <CliOverride>\n                         {
4373                                           lineCount();
4374                                         }
4375 <CliOverride>.                          {
4376                                         }
4377 <FuncPtrInit>[{;]                       {
4378                                           unput(*yytext);
4379                                           BEGIN(FuncQual);
4380                                         }
4381 <FuncPtrInit>\"                         {
4382                                           current->args += *yytext; 
4383                                           pCopyQuotedString=&current->args;
4384                                           lastStringContext=FuncPtrInit;
4385                                           BEGIN(CopyString);
4386                                         }
4387 <FuncPtrInit>\'                         {
4388                                           current->args += *yytext; 
4389                                           if (insidePHP)
4390                                           {
4391                                             pCopyQuotedString=&current->args;
4392                                             lastStringContext=FuncPtrInit;
4393                                             BEGIN(CopyPHPString);
4394                                           }
4395                                         }
4396 <FuncPtrInit>{CHARLIT}                  {
4397                                           if (insidePHP)
4398                                           {
4399                                             REJECT;
4400                                           }
4401                                           else
4402                                           {
4403                                             current->args += yytext; 
4404                                           }
4405                                         }
4406 <FuncPtrInit>{ID}                       {
4407                                           current->args += yytext; 
4408                                         }
4409 <FuncPtrInit>.                          {
4410                                           current->args += *yytext; 
4411                                         }
4412 <FuncPtrInit>\n                         {
4413                                           current->args += *yytext; 
4414                                           lineCount();
4415                                         }
4416 <FuncQual>{ID}                          { // typically a K&R style C function
4417                                           if (insideCS && strcmp(yytext,"where")==0)
4418                                           { 
4419                                             // type contraint for a method
4420                                             delete current->typeConstr;
4421                                             current->typeConstr = new ArgumentList;
4422                                             current->typeConstr->append(new Argument);
4423                                             lastCSConstraint = YY_START;
4424                                             BEGIN( CSConstraintName );
4425                                           }
4426                                           else if (checkForKnRstyleC())
4427                                           {
4428                                             //fprintf(stderr,"===> got a K&R style function\n");
4429                                             current->args = yytext; 
4430                                             oldStyleArgType.resize(0);
4431                                             BEGIN(OldStyleArgs);
4432                                           }
4433                                           else
4434                                           {
4435                                             current->args += yytext; 
4436                                           }
4437                                         }
4438 <OldStyleArgs>[,;]                      {
4439                                           QCString oldStyleArgPtr;
4440                                           QCString oldStyleArgName;
4441                                           splitKnRArg(oldStyleArgPtr,oldStyleArgName);
4442                                           QCString doc,brief;
4443                                           if (current->doc!=docBackup)
4444                                           {
4445                                             doc=current->doc.copy();
4446                                             current->doc=docBackup;
4447                                           }
4448                                           if (current->brief!=briefBackup)
4449                                           {
4450                                             brief=current->brief.copy();
4451                                             current->brief=briefBackup;
4452                                           }
4453                                           addKnRArgInfo(oldStyleArgType+oldStyleArgPtr,
4454                                                         oldStyleArgName,brief,doc);
4455                                           current->args.resize(0);
4456                                           if (*yytext==';') oldStyleArgType.resize(0);
4457                                         }
4458 <OldStyleArgs>{ID}                      { current->args += yytext; }
4459 <OldStyleArgs>"{"                       {
4460                                           current->args = argListToString(current->argList);
4461                                           unput('{');
4462                                           BEGIN(FuncQual);
4463                                         }
4464 <OldStyleArgs>.                         { current->args += *yytext; }
4465 <FuncQual,FuncRound,FuncFunc>.          { current->args += *yytext; }
4466 <FuncQual>{BN}*"try:"                   |
4467 <FuncQual>{BN}*"try"{BN}+               { /* try-function-block */ 
4468                                           insideTryBlock=TRUE;
4469                                           lineCount();
4470                                           if (yytext[yyleng-1]==':')
4471                                           {
4472                                             unput(':');
4473                                             BEGIN( Function );
4474                                           }
4475                                         }
4476 <FuncQual>{BN}*"throw"{BN}*"("          { // C++ style throw clause
4477                                           current->exception = " throw (" ;
4478                                           roundCount=0;
4479                                           lineCount() ;
4480                                           BEGIN( ExcpRound ) ;
4481                                         }
4482 <FuncQual>{BN}*"raises"{BN}*"("         {
4483                                           current->exception = " raises (" ;
4484                                           lineCount() ;
4485                                           roundCount=0;
4486                                           BEGIN( ExcpRound ) ;
4487                                         }
4488 <FuncQual>{BN}*"throws"{BN}+            { // Java style throw clause
4489                                           current->exception = " throws " ;
4490                                           lineCount() ;
4491                                           BEGIN( ExcpList );
4492                                         }
4493 <ExcpRound>"("                          { current->exception += *yytext ;
4494                                           ++roundCount ;
4495                                         }
4496 <ExcpRound>")"                          { current->exception += *yytext ; 
4497                                           if ( roundCount )
4498                                             --roundCount ;
4499                                           else
4500                                             BEGIN( FuncQual ) ;
4501                                         }
4502 <ExcpRound>.                            {
4503                                           current->exception += *yytext;
4504                                         }
4505 <ExcpList>"{"                           {
4506                                           unput('{'); BEGIN( FuncQual );
4507                                         }
4508 <ExcpList>";"                           {
4509                                           unput(';'); BEGIN( FuncQual );
4510                                         }
4511 <ExcpList>"\n"                          {
4512                                           current->exception += ' ';
4513                                           lineCount();
4514                                         }
4515 <ExcpList>.                             {
4516                                           current->exception += *yytext;
4517                                         }
4518 <Function>"("                           { current->type += current->name ;
4519                                           current->name  = current->args ;
4520                                           current->args  = yytext ;
4521                                           roundCount=0;
4522                                           BEGIN( FuncRound ) ;
4523                                         }
4524 <Function>":"                           {
4525                                           if (!insidePHP) BEGIN(SkipInits);
4526                                         }
4527 <Function>[;{,]                         { 
4528                                           current->name=current->name.simplifyWhiteSpace();
4529                                           current->type=current->type.simplifyWhiteSpace();
4530                                           current->args=removeRedundantWhiteSpace(current->args);
4531                                                         // was: current->args.simplifyWhiteSpace();
4532                                           current->fileName = yyFileName;
4533                                           current->startLine = yyLineNr;
4534                                           static QRegExp re("([^)]*[*&][^)]*)"); // (...*...)
4535                                           if (*yytext!=';' || (current_root->section&Entry::COMPOUND_MASK) )
4536                                           {
4537                                             int tempArg=current->name.find('<');
4538                                             int ts=current->type.find('<');
4539                                             int te=current->type.findRev('>');
4540                                             int ti=current->type.find(re,0);
4541
4542                                             // bug677315: A<int(void *, char *)> get(); is not a function pointer
4543                                             bool isFunction = ti==-1 || // not a (...*...) pattern
4544                                                               (ts!=-1 && ts<te && ts<ti && ti<te); // (...*...) is part of a template argument list
4545                                                               
4546                                             //printf("type=%s ts=%d te=%d ti=%d isFunction=%d\n",
4547                                             //    current->type.data(),ts,te,ti,isFunction);
4548                                             QCString tempName;
4549                                             if (tempArg==-1) tempName=current->name; else tempName=current->name.left(tempArg);
4550                                             if (!current->type.isEmpty() &&
4551                                                 (!isFunction || current->type.left(8)=="typedef "))
4552                                             {
4553                                               //printf("Scanner.l: found in class variable: `%s' `%s' `%s'\n", current->type.data(),current->name.data(),current->args.data());
4554                                               if (isTypedef && current->type.left(8)!="typedef ")
4555                                               {
4556                                                 current->type.prepend("typedef ");
4557                                               }
4558                                               current->section = Entry::VARIABLE_SEC ;
4559                                             }
4560                                             else              
4561                                             {
4562                                               //printf("Scanner.l: found in class function: `%s' `%s' `%s'\n", current->type.data(),current->name.data(),current->args.data());
4563                                               current->section = Entry::FUNCTION_SEC ;
4564                                               current->proto = *yytext==';';
4565                                             }
4566                                           }
4567                                           else // a global function prototype or function variable
4568                                           {
4569                                             //printf("Scanner.l: prototype? type=`%s' name=`%s' args=`%s'\n",current->type.data(),current->name.data(),current->args.data());
4570                                             if (!current->type.isEmpty() && 
4571                                                 (current->type.find(re,0)!=-1 || current->type.left(8)=="typedef "))
4572                                             {
4573                                               if (isTypedef && current->type.left(8)!="typedef ")
4574                                               {
4575                                                 current->type.prepend("typedef ");
4576                                               }
4577                                               //printf("Scanner.l: found function variable!\n");
4578                                               current->section = Entry::VARIABLE_SEC;
4579                                             }
4580                                             else
4581                                             {
4582                                               //printf("Scanner.l: found prototype\n");
4583                                               current->section = Entry::FUNCTION_SEC;
4584                                               current->proto = TRUE;
4585                                             }
4586                                           }
4587                                           //printf("Adding entry `%s'\n",current->name.data());
4588                                           if ( insidePHP)
4589                                           {
4590                                             if (findAndRemoveWord(current->type,"final"))
4591                                             {
4592                                               current->spec |= Entry::Final;
4593                                             }
4594                                             if (findAndRemoveWord(current->type,"abstract"))
4595                                             {
4596                                               current->spec |= Entry::Abstract;
4597                                             }
4598                                           }
4599                                           if ( insidePHP && !containsWord(current->type,"function"))
4600                                           {
4601                                             initEntry();
4602                                             if ( *yytext == '{' )
4603                                             {
4604                                               lastCurlyContext = FindMembers;
4605                                               curlyCount=0;
4606                                               BEGIN( SkipCurly );
4607                                             }
4608                                             else
4609                                             {
4610                                               BEGIN( FindMembers );
4611                                             }
4612                                           }
4613                                           else
4614                                           {
4615                                             if ( insidePHP)
4616                                             {
4617                                               findAndRemoveWord(current->type,"function");
4618                                             }
4619                                             previous = current;
4620                                             current_root->addSubEntry(current);
4621                                             current = new Entry ;
4622                                             initEntry();
4623                                             // Objective C 2.0: Required/Optional section
4624                                             if (previous->spec & (Entry::Optional | Entry::Required))
4625                                             {
4626                                               current->spec |= previous->spec & (Entry::Optional|Entry::Required);
4627                                             }
4628                                             lastCurlyContext = FindMembers;
4629                                             if ( *yytext == ',' )
4630                                             {
4631                                               current->type = previous->type;
4632                                               // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
4633                                               int i=current->type.length(); 
4634                                               while (i>0 && (current->type[i-1]=='*' || current->type[i-1]=='&' || current->type[i-1]==' ')) i--;
4635                                               current->type = current->type.left(i);
4636                                             }
4637                                             if ( *yytext == '{' )
4638                                             {
4639                                               if ( !insidePHP && (current_root->section & Entry::COMPOUND_MASK) )
4640                                               {
4641                                                 previous->spec |= Entry::Inline;
4642                                               }
4643                                               //addToBody(yytext);
4644                                               curlyCount=0;
4645                                               BEGIN( SkipCurly ) ;
4646                                             }
4647                                             else
4648                                             {
4649                                               if (previous->section!=Entry::VARIABLE_SEC)
4650                                                 previous->bodyLine=-1; // a function/member declaration
4651                                               BEGIN( FindMembers ) ;
4652                                             }
4653                                           }
4654                                         }
4655 <SkipInits>"{"                          { // C++11 style initializer
4656                                           //addToBody(yytext);
4657                                           //lastCurlyContext = FindMembers;
4658                                           //curlyCount=0;
4659                                           //BEGIN( SkipCurly ) ; 
4660                                           unput('{');
4661                                           BEGIN( Function );
4662                                         }
4663 <SkipCurly>"{"                          { 
4664                                           //addToBody(yytext);
4665                                           ++curlyCount ; 
4666                                         }
4667 <SkipCurly>"}"                          { 
4668                                           //addToBody(yytext);
4669                                           if( curlyCount )
4670                                           {
4671                                             --curlyCount ;
4672                                           }
4673                                           else
4674                                           {
4675 #if 0
4676                                             if (!Config_getBool("HIDE_IN_BODY_DOCS") && 
4677                                                 !current->doc.isEmpty())
4678                                             {
4679                                               // copy documentation found inside the body
4680                                               // to the previous item
4681                                               if (previous->inbodyLine==-1)
4682                                               {
4683                                                 previous->inbodyLine = current->docLine;
4684                                                 previous->inbodyFile = current->docFile;
4685                                               }
4686                                               //printf("*** inbodyDocs+=%s\n",current->doc.data());
4687                                               previous->inbodyDocs += current->doc;
4688                                               current->doc.resize(0);
4689                                             }
4690 #endif
4691                                             if (current->sli && previous) // copy special list items
4692                                             {
4693                                               QListIterator<ListItemInfo> li(*current->sli);
4694                                               ListItemInfo *lii;
4695                                               for (li.toFirst();(lii=li.current());++li)
4696                                               {
4697                                                 previous->addSpecialListItem(lii->type,lii->itemId);
4698                                               }
4699                                               delete current->sli;
4700                                               current->sli = 0;
4701                                             }
4702                                             if (previous) previous->endBodyLine=yyLineNr;
4703                                             BEGIN( lastCurlyContext ) ;
4704                                           }
4705                                         }
4706 <SkipCurly>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { 
4707                                           lineCount();
4708                                           if ( curlyCount )
4709                                           {
4710                                             //addToBody(yytext);
4711                                             --curlyCount ;
4712                                           }
4713                                           else
4714                                           {
4715                                             current->endBodyLine=yyLineNr;
4716
4717                                             tempEntry = current; // temporarily switch to the previous entry
4718                                             current = previous;
4719
4720                                             docBlockContext   = SkipCurlyEndDoc;
4721                                             docBlockInBody    = FALSE;
4722                                             docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) ||
4723                                                                 ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") );
4724                                             docBlock.resize(0);
4725                                             docBlockTerm = '}';
4726                                             if (yytext[yyleng-3]=='/')
4727                                             {
4728                                               startCommentBlock(TRUE);
4729                                               BEGIN( DocLine );
4730                                             }
4731                                             else
4732                                             {
4733                                               startCommentBlock(FALSE);
4734                                               BEGIN( DocBlock );
4735                                             }
4736                                           }
4737                                         }
4738 <SkipCurlyEndDoc>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { // desc is followed by another one
4739                                           docBlockContext   = SkipCurlyEndDoc;
4740                                           docBlockInBody    = FALSE;
4741                                           docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) ||
4742                                                               ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") );
4743                                           docBlock.resize(0);
4744                                           docBlockTerm = '}';
4745                                           if (yytext[yyleng-3]=='/')
4746                                           {
4747                                             startCommentBlock(TRUE);
4748                                             BEGIN( DocLine );
4749                                           }
4750                                           else
4751                                           {
4752                                             startCommentBlock(FALSE);
4753                                             BEGIN( DocBlock );
4754                                           }
4755                                         }
4756 <SkipCurlyEndDoc>"}"                    {
4757                                           //addToBody("}");
4758                                           current = tempEntry;
4759                                           BEGIN( lastCurlyContext );
4760                                         }
4761 <SkipCurly>\"                           { 
4762                                           //addToBody(yytext);
4763                                           lastStringContext=SkipCurly;
4764                                           BEGIN( SkipString ); 
4765                                         }
4766 <SkipCurly>^{B}*"#"                     { 
4767                                           if (insidePHP)
4768                                             REJECT;
4769                                           //addToBody(yytext);
4770                                           BEGIN( SkipCurlyCpp );
4771                                         }
4772 <SkipCurly,SkipInits>\n                 {
4773                                           lineCount();
4774                                           //addToBody(yytext);
4775                                         }
4776 <SkipCurly,SkipCurlyCpp>"<<<"           {
4777                                           if (!insidePHP) 
4778                                           {
4779                                             REJECT;
4780                                           }
4781                                           else
4782                                           {
4783                                             lastHereDocContext = YY_START;
4784                                             BEGIN(HereDoc);
4785                                           }
4786                                         }
4787 <SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<]+ {
4788                                           lineCount();  // for g_column updates
4789                                           //addToBody(yytext);
4790                                         }
4791 <SkipCurlyCpp>\n                        { 
4792                                           //addToBody(yytext);
4793                                           lineCount();
4794                                           lastCurlyContext = FindMembers;
4795                                           BEGIN( SkipCurly ); 
4796                                         }
4797 <SkipCurlyCpp>\\[\r]*"\n"[\r]*          { 
4798                                           //addToBody(yytext);
4799                                           lineCount();
4800                                         }
4801 <SkipInits,SkipCurly,SkipCurlyCpp>"/*"  {
4802                                           //addToBody(yytext);
4803                                           lastCContext = YY_START;
4804                                           BEGIN(SkipComment);
4805                                         }
4806 <SkipInits,SkipCurly,SkipCurlyCpp>"//"  {
4807                                           //addToBody(yytext);
4808                                           lastCContext = YY_START;
4809                                           BEGIN(SkipCxxComment);
4810                                         }
4811 <SkipInits>\"                           {
4812                                           lastStringContext=YY_START;
4813                                           BEGIN( SkipString ); 
4814                                         }
4815 <SkipInits>;                            {
4816                                           warn(yyFileName,yyLineNr,
4817                                               "warning: Found ';' while parsing initializer list! "
4818                                               "(doxygen could be confused by a macro call without semicolon)"
4819                                              );
4820                                           BEGIN( FindMembers );
4821                                         }
4822 <SkipInits,SkipCurly,SkipCurlyCpp>"#"   {
4823                                           if (!insidePHP)
4824                                             REJECT;
4825                                           //addToBody(yytext);
4826                                           lastCContext = YY_START;
4827                                           BEGIN(SkipCxxComment);
4828                                         }
4829 <SkipInits,SkipCurly,SkipCurlyCpp>@\"   {
4830                                           if (!insideCS) REJECT;
4831                                           // C# verbatim string
4832                                           lastSkipVerbStringContext=YY_START;
4833                                           pSkipVerbString=&current->initializer;
4834                                           BEGIN(SkipVerbString);
4835                                         }
4836 <SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT}     {
4837                                           if (insidePHP) REJECT;
4838                                         }
4839 <SkipInits,SkipCurly,SkipCurlyCpp>\'    {
4840                                           if (insidePHP)
4841                                           {
4842                                             lastStringContext=YY_START;
4843                                             BEGIN(SkipPHPString);
4844                                           }
4845                                         }
4846 <SkipInits,SkipCurly,SkipCurlyCpp>.     { }
4847 <SkipString,SkipPHPString>\\.           { }
4848 <SkipString>\"                          { 
4849                                           BEGIN( lastStringContext ); 
4850                                         }
4851 <SkipPHPString>\'                       { 
4852                                           BEGIN( lastStringContext ); 
4853                                         }
4854 <SkipString,SkipPHPString>"/*"|"*/"|"//" { }
4855 <SkipString,SkipPHPString>\n            {
4856                                           lineCount();
4857                                         }
4858 <SkipString,SkipPHPString>.             { }
4859 <CompoundName>":"                       { // for "class : public base {} var;" construct, see bug 608359
4860                                           unput(':');
4861                                           BEGIN(ClassVar);
4862                                         }
4863 <Bases,CompoundName>";"                 { 
4864                                           current->section = Entry::EMPTY_SEC ;
4865                                           current->type.resize(0) ;
4866                                           current->name.resize(0) ;
4867                                           current->args.resize(0) ;
4868                                           current->argList->clear();
4869                                           BEGIN( FindMembers ) ;
4870                                         }
4871 <CompoundName>{SCOPENAME}{BN}*/"<"      {
4872                                           sharpCount = 0;
4873                                           current->name = yytext ;
4874                                           if (current->spec & Entry::Protocol)
4875                                           {
4876                                             current->name+="-p";
4877                                           }
4878                                           lineCount();
4879                                           lastClassTemplSpecContext = ClassVar;
4880                                           if (insideObjC) // protocol list
4881                                           {
4882                                             BEGIN( ObjCProtocolList );
4883                                           }
4884                                           else if (insideCS) // C# generic class
4885                                           {
4886                                             //current->name+="-g";
4887                                             BEGIN( CSGeneric );
4888                                           }
4889                                           else // C++ template specialization
4890                                           {
4891                                             roundCount=0;
4892                                             BEGIN( ClassTemplSpec );
4893                                           }
4894                                         }
4895 <CSGeneric>"<"                          {
4896                                           if (current->tArgLists==0)
4897                                           {
4898                                             current->tArgLists = new QList<ArgumentList>;
4899                                             current->tArgLists->setAutoDelete(TRUE);
4900                                           }
4901                                           ArgumentList *al = new ArgumentList;
4902                                           // check bug 612858 before enabling the next line
4903                                           //current->spec |= Entry::Template;
4904                                           current->tArgLists->append(al);
4905                                           currentArgumentList = al;
4906                                           templateStr="<";
4907                                           current->name += "<";
4908                                           fullArgString = templateStr;
4909                                           copyArgString = &current->name;
4910                                           //copyArgString = &templateStr;
4911                                           currentArgumentContext = ClassVar;
4912                                           BEGIN( ReadTempArgs );
4913                                         }
4914 <ObjCProtocolList>"<"                   {
4915                                           insideProtocolList=TRUE;
4916                                           BEGIN( Bases );
4917                                         }
4918 <ClassTemplSpec>">"({BN}*"::"{BN}*{SCOPENAME})? {
4919                                           current->name += yytext;
4920                                           lineCount();
4921                                           if (--sharpCount<=0)
4922                                           {
4923                                             current->name = removeRedundantWhiteSpace(current->name);
4924                                             if (current->spec & Entry::Protocol)
4925                                             { // Objective-C protocol
4926                                               unput('{'); // fake start of body
4927                                               BEGIN( ClassVar );
4928                                             }
4929                                             else
4930                                             {
4931                                               BEGIN( lastClassTemplSpecContext );
4932                                             }
4933                                           }
4934                                         }
4935 <ClassTemplSpec>"<"                     {
4936                                           current->name += yytext;
4937                                           sharpCount++;
4938                                         }
4939 <ClassTemplSpec>.                       {
4940                                           current->name += yytext;
4941                                         }
4942 <CompoundName>{SCOPENAME}{BN}*";"       { // forward declaration
4943                                           if (current->tArgLists && current->tArgLists->count()>0)
4944                                           {
4945                                             // found a forward template declaration, this has
4946                                             // a purpose of its own
4947                                             current->name = yytext;
4948                                             current->name=current->name.left(current->name.length()-1).stripWhiteSpace();
4949                                             //printf("template class declaration for %s!\n",current->name.data());
4950                                             current_root->addSubEntry(current);
4951                                             current = new Entry;
4952                                           }
4953
4954                                           unput(';');
4955                                           current->reset();
4956                                           initEntry();
4957                                           if (isTypedef) // typedef of a class, put typedef keyword back
4958                                           {
4959                                             current->type.prepend("typedef");
4960                                           }
4961                                           BEGIN( FindMembers );
4962                                         }
4963 <CompoundName>{SCOPENAME}/{BN}*"("      { 
4964                                           current->name = yytext ;
4965                                           lineCount();
4966                                           if (current->spec & Entry::Protocol)
4967                                           {
4968                                             current->name += "-p";
4969                                           }
4970                                           BEGIN( ClassVar );
4971                                         }
4972 <CompoundName>{SCOPENAME}/{BN}*","      {  // multiple forward declarations on one line
4973                                            // e.g. @protocol A,B;
4974                                           current->reset();
4975                                           initEntry();
4976                                         }
4977 <CompoundName>{SCOPENAME}               { 
4978                                           current->name = yytext ;
4979                                           lineCount();
4980                                           if (current->spec & Entry::Protocol)
4981                                           {
4982                                             current->name += "-p";
4983                                           }
4984                                           if ((current->spec & Entry::Protocol) ||
4985                                               current->section == Entry::OBJCIMPL_SEC)
4986                                           {
4987                                             unput('{'); // fake start of body
4988                                           }
4989                                           BEGIN( ClassVar );
4990                                         }
4991 <CompoundName>{CSSCOPENAME}             { // C# style scope
4992                                           current->name = substitute(yytext,".","::");
4993                                           lineCount();
4994                                           BEGIN( ClassVar );
4995                                         }
4996 <ClassVar>{SCOPENAME}{BN}*/"("          {
4997                                           if (insideIDL && strncmp(yytext,"switch",6)==0 && !isId(yytext[6]))
4998                                           {
4999                                             // Corba IDL style union
5000                                             roundCount=0;
5001                                             BEGIN(SkipUnionSwitch);
5002                                           }
5003                                           else
5004                                           {
5005                                             addType(current);
5006                                             current->name = yytext;
5007                                             current->name = current->name.stripWhiteSpace();
5008                                             lineCount();
5009                                             BEGIN( FindMembers );
5010                                           }
5011                                         }
5012 <ClassVar>","                           {
5013                                           if (isTypedef)
5014                                           {
5015                                             // multiple types in one typedef
5016                                             unput(',');
5017                                             current->type.prepend("typedef ");
5018                                             BEGIN(FindMembers);
5019                                           }
5020                                           else
5021                                           { 
5022                                             // Multiple class forward declaration
5023                                           }
5024                                         }
5025 <ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
5026                                           if (insideCli)
5027                                           {
5028                                             if (yytext[0]=='s') // sealed
5029                                               current->spec |= Entry::SealedClass;
5030                                             else // abstract
5031                                               current->spec |= Entry::AbstractClass;
5032                                             BEGIN( ClassVar ); 
5033                                           }
5034                                           else
5035                                           {
5036                                             REJECT;
5037                                           }
5038                                         }
5039 <ClassVar>{ID}                          {
5040                                           if (insideIDL && strcmp(yytext,"switch")==0)
5041                                           {
5042                                             // Corba IDL style union
5043                                             roundCount=0;
5044                                             BEGIN(SkipUnionSwitch);
5045                                           }
5046                                           else if ((insideJava || insidePHP || insideJS) && (strcmp(yytext,"implements")==0 || strcmp(yytext,"extends")==0))
5047                                           {
5048                                             current->type.resize(0);
5049                                             baseProt=Public;
5050                                             baseVirt=Normal;
5051                                             baseName.resize(0);
5052                                             BEGIN( BasesProt ) ;
5053                                           }
5054                                           else if (insideCS && strcmp(yytext,"where")==0) // C# type contraint
5055                                           {
5056                                             delete current->typeConstr;
5057                                             current->typeConstr = new ArgumentList;
5058                                             current->typeConstr->append(new Argument);
5059                                             lastCSConstraint = YY_START;
5060                                             BEGIN( CSConstraintName );
5061                                           }
5062                                           else if (insideCli &&  strcmp(yytext,"abstract")==0)
5063                                           {
5064                                             current->spec|=Entry::Abstract;
5065                                           }
5066                                           else if (insideCli &&  strcmp(yytext,"sealed")==0)
5067                                           {
5068                                             current->spec|=Entry::Sealed;
5069                                           }
5070                                           else if (strcmp(yytext,"final")==0)
5071                                           {
5072                                             current->spec|=Entry::Final;
5073                                           }
5074                                           else
5075                                           {
5076                                             if (current->section == Entry::ENUM_SEC)
5077                                             { // found "enum a b" -> variable
5078                                               current->section = Entry::VARIABLE_SEC ;
5079                                             }
5080                                             current->type += ' ' ;
5081                                             current->type += current->name ;
5082                                             current->name = yytext ;
5083                                             
5084                                             if (nameIsOperator(current->name))
5085                                             {
5086                                               BEGIN( Operator );
5087                                             }
5088                                           }
5089                                         }
5090 <ClassVar>[(\[]                         {
5091                                           if (insideObjC && *yytext=='(') // class category
5092                                           {
5093                                             current->name+='(';
5094                                             //if (current->section!=Entry::OBJCIMPL_SEC)
5095                                             //{
5096                                               current->spec|=Entry::Category;
5097                                             //}
5098                                             BEGIN( ClassCategory );
5099                                           }
5100                                           else
5101                                           {
5102                                             // probably a function anyway
5103                                             unput(*yytext);
5104                                             BEGIN( FindMembers );
5105                                           }
5106                                         }
5107 <CSConstraintType,CSConstraintName>"/**/" { /* empty comment */ }
5108 <CSConstraintType,CSConstraintName>("/*"[*!]|"//"[/!])("<"?)    { // special comment
5109                                           fullArgString.resize(0);
5110                                           lastCopyArgChar='#'; // end marker
5111                                           lastCommentInArgContext=YY_START;
5112                                           if (yytext[1]=='/')
5113                                             BEGIN( CopyArgCommentLine );
5114                                           else
5115                                             BEGIN( CopyArgComment );
5116                                         }
5117 <CSConstraintType,CSConstraintName>"#"  { // artificially inserted token to signal end of comment block
5118                                           current->typeConstr->last()->docs = fullArgString;
5119                                         }
5120 <CSConstraintType>"{"                   { // end of type constraint reached
5121                                           // parse documentation of the constraints
5122                                           handleParametersCommentBlocks(current->typeConstr);
5123                                           unput('{');
5124                                           BEGIN( lastCSConstraint );
5125                                         }
5126 <CSConstraintType,CSConstraintName>";"  {
5127                                           handleParametersCommentBlocks(current->typeConstr);
5128                                           unput(';');
5129                                           BEGIN( lastCSConstraint );
5130                                         }
5131 <CSConstraintName>":"                   {
5132                                           BEGIN( CSConstraintType );
5133                                         }
5134 <CSConstraintName>{ID}                  {
5135                                           // parameter name
5136                                           current->typeConstr->last()->name=yytext;
5137                                         }
5138 <CSConstraintType>"where"               { // another constraint for a different param
5139                                           current->typeConstr->append(new Argument);
5140                                           BEGIN( CSConstraintName );
5141                                         }
5142 <CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")?  {
5143                                           if (current->typeConstr->last()->type.isEmpty())
5144                                               // first type constraint for this parameter
5145                                           {
5146                                             current->typeConstr->last()->type=yytext;
5147                                           }
5148                                           else // new type constraint for same parameter
5149                                           {
5150                                             QCString name = current->typeConstr->last()->name;
5151                                             current->typeConstr->append(new Argument);
5152                                             current->typeConstr->last()->name=name;
5153                                             current->typeConstr->last()->type=yytext;
5154                                           }
5155                                         }
5156 <CSConstraintName,CSConstraintType>\n   {
5157                                           lineCount();
5158                                         }
5159 <CSConstraintName,CSConstraintType>.    {
5160                                         }
5161 <ClassCategory>{ID}                     {
5162                                           current->name+=yytext;
5163                                         }
5164 <ClassCategory>")"/{BN}*"{"             {
5165                                           current->name+=')';
5166                                           BEGIN( ClassVar );
5167                                         }
5168 <ClassCategory>")"/{BN}*"<"             {
5169                                           current->name+=')';
5170                                           BEGIN( ObjCProtocolList );
5171                                         }
5172 <ClassCategory>")"                      {
5173                                           current->name+=')';
5174                                           if ((current->section & Entry::Protocol) ||
5175                                               current->section == Entry::OBJCIMPL_SEC)
5176                                           {
5177                                             unput('{'); // fake start of body
5178                                           }
5179                                           else // category has no variables so push back an empty body
5180                                           {
5181                                             unput('}');
5182                                             unput('{');
5183                                           }
5184                                           BEGIN( ClassVar );
5185                                         }
5186 <ClassVar>":"                           { 
5187                                           if (current->section==Entry::ENUM_SEC) // enum E:2, see bug 313527, 
5188                                                                                  // or C++11 style enum: 'E : unsigned int {...}'
5189                                           {
5190                                             current->args.resize(0);
5191                                             BEGIN(EnumBaseType);
5192                                           }
5193                                           else
5194                                           {
5195                                             current->type.resize(0);
5196                                             if ((current->spec & Entry::Interface) || 
5197                                                 (current->spec & Entry::Struct)    || 
5198                                                 (current->spec & Entry::Ref)       || 
5199                                                 (current->spec & Entry::Value)     || 
5200                                                 insidePHP || insideCS || insideD || insideObjC
5201                                                )
5202                                               baseProt=Public;
5203                                             else
5204                                               baseProt=Private;
5205                                             baseVirt=Normal;
5206                                             baseName.resize(0);
5207                                             BEGIN( BasesProt ) ;
5208                                           }
5209                                         }
5210 <ClassVar>[;=*&]                        {
5211                                           unput(*yytext);
5212                                           if (isTypedef) // typedef of a class, put typedef keyword back
5213                                           {
5214                                             current->type.prepend("typedef");
5215                                           }
5216                                           if ((yytext[0]=='*' || yytext[0]=='&') && 
5217                                               current->section == Entry::ENUM_SEC)
5218                                           { // found "enum a *b" -> variable
5219                                             current->section = Entry::VARIABLE_SEC ;
5220                                           }
5221                                           BEGIN( FindMembers );
5222                                         }
5223 <Bases,ClassVar>"///"/[^/]              {
5224                                           if (!insideObjC)
5225                                           {
5226                                             REJECT;
5227                                           }
5228                                           else
5229                                           {
5230                                             lineCount();
5231                                             current->program+=yytext;
5232                                             current->fileName = yyFileName ;
5233                                             current->startLine = yyLineNr ;
5234                                             curlyCount=0;
5235                                             BEGIN( ReadBodyIntf );
5236                                           }
5237                                         }
5238 <Bases,ClassVar>("//"{B}*)?"/**"/[^/*]  |
5239 <Bases,ClassVar>("//"{B}*)?"/*!"        |
5240 <Bases,ClassVar>"//!"                   |
5241 <Bases,ClassVar>[\-+]{BN}*              {
5242                                           if (!insideObjC)
5243                                           {
5244                                             REJECT;
5245                                           }
5246                                           else
5247                                           {
5248                                             lineCount();
5249                                             current->program+=yytext;
5250                                             current->fileName = yyFileName ;
5251                                             current->startLine = yyLineNr ;
5252                                             curlyCount=0;
5253                                             BEGIN( ReadBodyIntf );
5254                                           }
5255                                         }
5256 <CompoundName,ClassVar>{B}*"{"{B}*      { 
5257                                           current->fileName = yyFileName ;
5258                                           current->startLine = yyLineNr ;
5259                                           current->name = removeRedundantWhiteSpace(current->name);
5260                                           if (current->name.isEmpty() && !isTypedef) // anonymous compound
5261                                           {
5262                                             if (current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces
5263                                             {
5264                                               if (Config_getBool("EXTRACT_ANON_NSPACES")) // use visible name
5265                                               {
5266                                                 current->name="anonymous_namespace{"+stripPath(current->fileName)+"}";
5267                                               }
5268                                               else // use invisible name
5269                                               {
5270                                                 current->name.sprintf("@%d",anonNSCount);
5271                                               }
5272                                             }
5273                                             else
5274                                             {
5275                                               current->name.sprintf("@%d",anonCount++);
5276                                             }
5277                                           }
5278                                           curlyCount=0;
5279                                           if (current_root && // not a nested struct inside an @interface section
5280                                               !(current_root->spec & Entry::Interface) &&
5281                                               ((current->spec & (Entry::Interface | Entry::Protocol | Entry::Category) ||
5282                                                 current->section==Entry::OBJCIMPL_SEC)
5283                                               ) &&
5284                                               insideObjC
5285                                              )
5286                                           { // ObjC body that ends with @end
5287                                             BEGIN( ReadBodyIntf );
5288                                           }
5289                                           else if (current->section==Entry::NAMESPACE_SEC)
5290                                           { // namespace body
5291                                             BEGIN( ReadNSBody );
5292                                           }
5293                                           else
5294                                           { // class body
5295                                             BEGIN( ReadBody ) ;
5296                                           }
5297                                         }
5298 <BasesProt>"virtual"{BN}+               { lineCount(); baseVirt = Virtual; }
5299 <BasesProt>"public"{BN}+                { lineCount(); baseProt = Public; }
5300 <BasesProt>"protected"{BN}+             { lineCount(); baseProt = Protected; }
5301 <BasesProt>"internal"{BN}+              { lineCount(); baseProt = Package; }
5302 <BasesProt>"private"{BN}+               { lineCount(); baseProt = Private; }
5303 <BasesProt>{BN}                         { lineCount(); }
5304 <BasesProt>.                            { unput(*yytext); BEGIN(Bases); }
5305 <Bases>("\\")?({ID}"\\")*{ID}           { // PHP namespace token, not sure if interspacing is allowed but it gives problems (see bug 640847)
5306                                           if (!insidePHP)
5307                                           {
5308                                             REJECT;
5309                                           }
5310                                           else // PHP base class of the form \Ns\Cl or Ns\Cl
5311                                           {
5312                                             lineCount();
5313                                             QCString bn=yytext;
5314                                             bn = substitute(bn,"\\","::");
5315                                             baseName += bn;
5316                                             current->args += ' ';
5317                                             current->args += yytext;
5318                                           }
5319                                         }
5320 <Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID}    { 
5321                                           lineCount();
5322                                           QCString baseScope = yytext;
5323                                           if (insideCS && baseScope.stripWhiteSpace()=="where")
5324                                           { 
5325                                             // type contraint for a class
5326                                             delete current->typeConstr;
5327                                             current->typeConstr = new ArgumentList;
5328                                             current->typeConstr->append(new Argument);
5329                                             lastCSConstraint = YY_START;
5330                                             BEGIN( CSConstraintName );
5331                                           }
5332                                           else
5333                                           {
5334                                             baseName+=yytext;
5335                                             current->args += ' ';
5336                                             current->args += yytext;
5337                                           }
5338                                         }
5339 <Bases>{BN}*{ID}("."{ID})*              { // Java style class
5340                                           QCString name = substitute(yytext,".","::");
5341                                           baseName += name;
5342                                           current->args += ' ';
5343                                           current->args += name;
5344                                         }
5345 <ClassVar,Bases>\n/{BN}*[^{, \t\n]      {
5346                                           if (!insideObjC) 
5347                                           {
5348                                             REJECT;
5349                                           }
5350                                           else
5351                                           {
5352                                             lineCount();
5353                                             unput('{');
5354                                           }
5355                                         }
5356 <ClassVar,Bases>"@end"                  { // empty ObjC interface
5357                                           unput('d'); // insert fake body: {}@end
5358                                           unput('n'); 
5359                                           unput('e'); 
5360                                           unput('@'); 
5361                                           unput('}'); 
5362                                           unput('{');
5363                                         }
5364 <ClassVar>"<"                           { current->name += *yytext;
5365                                           sharpCount=1; 
5366                                           roundCount=0;
5367                                           lastSkipSharpContext = YY_START;
5368                                           specName = &current->name;
5369                                           BEGIN ( Specialization );
5370                                         }
5371 <Bases>"<"                              { 
5372                                           sharpCount=1; 
5373                                           roundCount=0;
5374                                           lastSkipSharpContext = YY_START;
5375                                           if (insideObjC) // start of protocol list
5376                                           {
5377                                             unput(',');
5378                                           }
5379                                           else // template specialization
5380                                           {
5381                                             //if (insideCS) // generic
5382                                             //{
5383                                             //  baseName+="-g";
5384                                             //}
5385                                             templateStr = yytext;
5386                                             specName = &templateStr;
5387                                             BEGIN ( Specialization );
5388                                           }
5389                                         }
5390 <Specialization>"<"                     { *specName += *yytext;
5391                                           if (roundCount==0) sharpCount++;
5392                                         }
5393 <Specialization>">"                     {
5394                                           *specName += *yytext;
5395                                           if (roundCount==0 && --sharpCount<=0)
5396                                           {
5397                                             if (1 /*!insideCS*/) 
5398                                             {
5399                                               baseName+=*specName;
5400                                             }
5401                                             else
5402                                             {
5403                                               if (current->tArgLists==0)
5404                                               {
5405                                                 current->tArgLists = new QList<ArgumentList>;
5406                                                 current->tArgLists->setAutoDelete(TRUE);
5407                                               }
5408                                               ArgumentList *al = new ArgumentList;
5409                                               current->tArgLists->append(al);
5410                                               stringToArgumentList(*specName,al);
5411                                             }
5412                                             BEGIN(lastSkipSharpContext);
5413                                           }
5414                                         }
5415 <Specialization>{BN}+                   { lineCount(); *specName +=' '; }
5416 <Specialization>"<<"                    { *specName += yytext; }
5417 <Specialization>">>"/{B}*"::"           { // M$ C++ extension to allow >> to close a template...
5418                                           unput('>');
5419                                           unput(' ');
5420                                           unput('>');
5421                                         }
5422 <Specialization>">>"                    {
5423                                           if (insideCS) // for C# >> ends a nested template
5424                                           {
5425                                             REJECT;
5426                                           }
5427                                           else // for C++ >> is a bitshift 
5428                                                // operator and > > would end 
5429                                                // a nested template.
5430                                                // We require the bitshift to be enclosed in braces.
5431                                                // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
5432                                           {
5433                                             if (roundCount>0)
5434                                             {
5435                                               *specName += yytext; 
5436                                             }
5437                                             else
5438                                             {
5439                                               unput('>');
5440                                               unput(' ');
5441                                               unput('>');
5442                                             }
5443                                           }
5444                                         }
5445 <Specialization>"typename"{BN}+         { lineCount(); }
5446 <Specialization>"("                     { *specName += *yytext; roundCount++; }
5447 <Specialization>")"                     { *specName += *yytext; roundCount--; }
5448 <Specialization>.                       {
5449                                           *specName += *yytext;
5450                                         }
5451 <SkipSharp>"<"                          { ++sharpCount; }
5452 <SkipSharp>">"                          { if (--sharpCount<=0)
5453                                             BEGIN ( lastSkipSharpContext );
5454                                         }
5455 <SkipRound>"("                          { ++roundCount; }
5456 <SkipRound>")"                          { if (--roundCount<=0)
5457                                             BEGIN ( lastSkipRoundContext );
5458                                         }
5459 <SkipRound>\"                           {
5460                                           lastStringContext=SkipRound;
5461                                           BEGIN(SkipString);
5462                                         }
5463 <Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*)    { lineCount();
5464                                           if (insideProtocolList)
5465                                           {
5466                                             baseName+="-p";
5467                                           }
5468                                           else
5469                                           {
5470                                             current->args += ',' ; 
5471                                           }
5472                                           current->name = removeRedundantWhiteSpace(current->name);
5473                                           if (!baseName.isEmpty())
5474                                           {
5475                                             current->extends->append(
5476                                               new BaseInfo(baseName,baseProt,baseVirt)
5477                                             );
5478                                           }
5479                                           if ((current->spec & (Entry::Interface|Entry::Struct)) || 
5480                                               insideJava || insidePHP || insideCS || 
5481                                               insideD || insideObjC)
5482                                           {
5483                                             baseProt=Public;
5484                                           }
5485                                           else
5486                                           {
5487                                             baseProt=Private;
5488                                           }
5489                                           baseVirt=Normal;
5490                                           baseName.resize(0);
5491                                           if (*yytext=='>')
5492                                           { // end of a ObjC protocol list
5493                                             insideProtocolList=FALSE;
5494                                             if (yyleng==1)
5495                                             {
5496                                               unput('{'); // dummy start body
5497                                             }
5498                                             else
5499                                             {
5500                                               yyless(1);
5501                                             }
5502                                           }
5503                                           else
5504                                           {
5505                                             if (*yytext==',' && insideObjC) // Begin of protocol list
5506                                             {
5507                                               insideProtocolList=TRUE;
5508                                             }
5509                                             BEGIN(BasesProt);
5510                                           }
5511                                         }
5512 <Bases>{B}*"{"{B}*                      { current->fileName = yyFileName ;
5513                                           current->startLine = yyLineNr ;
5514                                           current->name = removeRedundantWhiteSpace(current->name);
5515                                           if (!baseName.isEmpty())
5516                                             current->extends->append(
5517                                               new BaseInfo(baseName,baseProt,baseVirt)
5518                                             );
5519                                           curlyCount=0;
5520                                           if (insideObjC)
5521                                           {
5522                                             BEGIN( ReadBodyIntf );
5523                                           }
5524                                           else
5525                                           {
5526                                             BEGIN( ReadBody ) ;
5527                                           }
5528                                         }
5529 <SkipUnionSwitch>{B}*"("                {
5530                                           roundCount++;
5531                                         }
5532 <SkipUnionSwitch>")"                    {
5533                                           if (--roundCount==0)
5534                                           {
5535                                             BEGIN(ClassVar);
5536                                           }
5537                                         }
5538 <SkipUnionSwitch>\n                     { lineCount(); }
5539 <SkipUnionSwitch>.                      
5540 <Comment>{BN}+                          { current->program += yytext ;
5541                                           lineCount() ;
5542                                         }
5543 <Comment>"/*"                           { current->program += yytext ; } 
5544 <Comment>"//"                           { current->program += yytext ; }
5545 <Comment>{CMD}("code"|"verbatim")       {
5546                                           insideCode=TRUE;
5547                                           current->program += yytext ;
5548                                         }
5549 <Comment>{CMD}("endcode"|"endverbatim") {
5550                                           insideCode=FALSE;
5551                                           current->program += yytext ;
5552                                         }
5553 <Comment>[^ \.\t\r\n\/\*]+              { current->program += yytext ; }
5554 <Comment>"*/"                           { current->program += yytext ;
5555                                           if (!insideCode) BEGIN( lastContext ) ;
5556                                         }
5557 <Comment>.                              { current->program += *yytext ; }
5558
5559 <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/*!" { 
5560                                           //printf("Start doc block at %d\n",yyLineNr);
5561                                           removeSlashes=(yytext[1]=='/');
5562                                           tmpDocType=-1;
5563                                           if (!current->doc.isEmpty())
5564                                           {
5565                                             current->doc+="\n\n";
5566                                           }
5567                                           else
5568                                           {
5569                                             current->docLine = yyLineNr;
5570                                             current->docFile = yyFileName;
5571                                           }
5572
5573                                           lastDocContext = YY_START;
5574                                           if (current_root->section & Entry::SCOPE_MASK)
5575                                           {
5576                                             current->inside = current_root->name+"::";
5577                                           }
5578                                           docBlockContext   = YY_START;
5579                                           docBlockInBody    = YY_START==SkipCurly;
5580                                           docBlockAutoBrief = Config_getBool("QT_AUTOBRIEF");
5581                                           docBlock.resize(0);
5582                                           if (docBlockAutoBrief)
5583                                           {
5584                                             current->briefLine = yyLineNr;
5585                                             current->briefFile = yyFileName;
5586                                           }
5587                                           startCommentBlock(FALSE);
5588                                           BEGIN( DocBlock );
5589                                         }
5590 <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/**"/[^/*] {
5591                                           removeSlashes=(yytext[1]=='/');
5592                                           lastDocContext = YY_START;
5593
5594                                           //printf("Found comment block at %s:%d\n",yyFileName,yyLineNr);
5595                                           if (current_root->section & Entry::SCOPE_MASK)
5596                                           {
5597                                             current->inside = current_root->name+"::";
5598                                           }
5599                                           current->docLine = yyLineNr;
5600                                           current->docFile = yyFileName;
5601                                           docBlockContext = YY_START;
5602                                           docBlockInBody  = YY_START==SkipCurly;
5603                                           static bool javadocAutoBrief = Config_getBool("JAVADOC_AUTOBRIEF");
5604                                           docBlockAutoBrief = javadocAutoBrief;
5605                                           docBlock.resize(0);
5606
5607                                           QCString indent;
5608                                           indent.fill(' ',computeIndent(yytext,g_column));
5609                                           docBlock+=indent;
5610
5611                                           if (docBlockAutoBrief)
5612                                           {
5613                                             current->briefLine = yyLineNr;
5614                                             current->briefFile = yyFileName;
5615                                           }
5616                                           startCommentBlock(FALSE);
5617                                           BEGIN( DocBlock );
5618                                         }
5619 <FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"//!" { 
5620                                           tmpDocType=-1;
5621                                           lastDocContext = YY_START;
5622                                           if (current_root->section & Entry::SCOPE_MASK)
5623                                           {
5624                                             current->inside = current_root->name+"::";
5625                                           }
5626                                           docBlockContext   = YY_START;
5627                                           docBlockInBody    = YY_START==SkipCurly;
5628                                           docBlockAutoBrief = FALSE;
5629                                           docBlock.resize(0);
5630                                           startCommentBlock(current->brief.isEmpty());
5631                                           BEGIN( DocLine );
5632                                         }
5633 <FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"///"/[^/] { 
5634                                           tmpDocType=-1;
5635                                           lastDocContext = YY_START;
5636                                           if (current_root->section & Entry::SCOPE_MASK)
5637                                           {
5638                                             current->inside = current_root->name+"::";
5639                                           }
5640                                           docBlockContext   = YY_START;
5641                                           docBlockInBody    = YY_START==SkipCurly;
5642                                           docBlockAutoBrief = FALSE;
5643                                           docBlock.resize(0);
5644                                           startCommentBlock(current->brief.isEmpty());
5645                                           BEGIN( DocLine );
5646                                         }
5647 <FindMembers>"extern"{BN}*"\"C"("++")?"\""{BN}*("{")?  {
5648                                           lineCount();
5649                                           externC=TRUE;
5650                                         }
5651 <FindMembers>"{"                        {
5652                                           if (externC) 
5653                                           {
5654                                             externC=FALSE;
5655                                           }
5656                                           else if (insideCS &&    
5657                                               !current->name.isEmpty() && 
5658                                               !current->type.isEmpty())
5659                                           {
5660                                             if (containsWord(current->type,"event")) // event
5661                                             {
5662                                               current->mtype = mtype = Event;
5663                                             }
5664                                             else // property
5665                                             {                           
5666                                               current->mtype = mtype = Property;
5667                                             }
5668                                             current->bodyLine = yyLineNr;
5669                                             curlyCount=0;
5670                                             BEGIN( CSAccessorDecl );
5671                                           }
5672                                           else
5673                                           {
5674                                             if ((insideJava || insideCS || insideD) &&
5675                                                 current->name.isEmpty()
5676                                                )
5677                                             {
5678                                               // static Java initializer
5679                                               needsSemi = FALSE;
5680                                               if (current->stat)
5681                                               {
5682                                                 current->name="[static initializer]";
5683                                                 current->type.resize(0);
5684                                               }
5685                                               else
5686                                               {
5687                                                 current->name="[instance initializer]";
5688                                               }
5689                                               unput(*yytext); 
5690                                               BEGIN( Function );
5691                                             }
5692                                             else
5693                                             {
5694                                               // pre C++11 code -> ignore the initializer
5695                                               //needsSemi = TRUE;
5696                                               //current->type.resize(0);
5697                                               //current->name.resize(0);
5698                                               //current->args.resize(0);
5699                                               //current->argList->clear();
5700                                               //curlyCount=0;
5701                                               //BEGIN( SkipCurlyBlock );
5702
5703                                               // C++11 style initializer list
5704                                               current->bodyLine = yyLineNr;
5705                                               current->initializer = yytext;
5706                                               lastInitializerContext = YY_START;
5707                                               initBracketCount=1;
5708                                               BEGIN(ReadInitializer);
5709                                             }
5710                                           }
5711                                         }
5712 <CSAccessorDecl>"{"                     { curlyCount++; }
5713 <CSAccessorDecl>"}"                     { 
5714                                           if (curlyCount) 
5715                                           {
5716                                             curlyCount--; 
5717                                           }
5718                                           else
5719                                           {
5720                                             mtype = Method;
5721                                             unput(';');
5722                                             BEGIN(FindMembers);
5723                                           }
5724                                         }
5725 <CSAccessorDecl>"set"                   { if (curlyCount==0) current->spec |= Entry::Settable;  }
5726 <CSAccessorDecl>"get"                   { if (curlyCount==0) current->spec |= Entry::Gettable;  }
5727 <CSAccessorDecl>"add"                   { if (curlyCount==0) current->spec |= Entry::Addable;   }
5728 <CSAccessorDecl>"remove"                { if (curlyCount==0) current->spec |= Entry::Removable; }
5729 <CSAccessorDecl>"raise"                 { if (curlyCount==0) current->spec |= Entry::Raisable;  }
5730 <CSAccessorDecl>.                       {}
5731 <CSAccessorDecl>\n                      { lineCount(); }
5732
5733
5734
5735
5736  /**********************************************************************************/
5737  /******************** Documentation block related rules ***************************/
5738  /**********************************************************************************/
5739
5740  /* ---- Single line comments ------ */
5741 <DocLine>[^\n]*"\n"[ \t]*"//"[/!]       { // continuation of multiline C++-style comment
5742                                            docBlock+=yytext;
5743                                            docBlock.resize(docBlock.length() - 3);
5744                                            lineCount();
5745                                         }
5746 <DocLine>[^\n]*/"\n"                    { // whole line
5747                                           docBlock+=yytext;
5748                                           handleCommentBlock(docBlock.data(),current->brief.isEmpty());
5749                                           BEGIN( docBlockContext );
5750                                         }
5751
5752  /* ---- Comments blocks ------ */
5753
5754 <DocBlock>"*"*"*/"                      { // end of comment block
5755                                           handleCommentBlock(docBlock.data(),FALSE);
5756                                           BEGIN(docBlockContext);
5757                                         }
5758 <DocBlock>^{B}*("//")?{B}*"*"+/[^//a-z_A-Z0-9*] { // start of a comment line
5759                                           QCString indent;
5760                                           indent.fill(' ',computeIndent(yytext,g_column));
5761                                           docBlock+=indent;
5762                                         }
5763 <DocBlock>^{B}*("//"){B}*               { // strip embedded C++ comments if at the start of a line
5764                                         }
5765 <DocBlock>"//"                          { // slashes in the middle of a comment block
5766                                           docBlock+=yytext;
5767                                         }
5768 <DocBlock>"/*"                          { // start of a new comment in the 
5769                                           // middle of a comment block
5770                                           docBlock+=yytext;
5771                                         }
5772 <DocBlock>("@@"|"\\\\"){ID}/[^a-z_A-Z0-9] { // escaped command
5773                                           docBlock+=yytext;
5774                                         }
5775 <DocBlock>{CMD}("f$"|"f["|"f{")         {
5776                                           docBlock+=yytext;
5777                                           docBlockName=&yytext[1];
5778                                           if (docBlockName.at(1)=='{')
5779                                           {
5780                                             docBlockName.at(1)='}';
5781                                           }
5782                                           BEGIN(DocCopyBlock);
5783                                         }
5784 <DocBlock>"<"{PRE}">"                   {
5785                                           docBlock+=yytext;
5786                                           docBlockName="<pre>";
5787                                           BEGIN(DocCopyBlock);
5788                                         }
5789 <DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9]       { // verbatim command (which could contain nested comments!)
5790                                           docBlock+=yytext;
5791                                           docBlockName=&yytext[1];
5792                                           BEGIN(DocCopyBlock);
5793                                         }
5794 <DocBlock>{B}*"<code>"                  {
5795                                           if (insideCS)
5796                                           {
5797                                             docBlock+=yytext;
5798                                             docBlockName="<code>";
5799                                             BEGIN(DocCopyBlock);
5800                                           }
5801                                           else
5802                                           {
5803                                             REJECT;
5804                                           }
5805                                         }
5806 <DocBlock>[^@*\/\\\n]+                  { // any character that isn't special
5807                                           docBlock+=yytext;
5808                                         }
5809 <DocBlock>\n                            { // newline
5810                                           lineCount();
5811                                           docBlock+=*yytext;
5812                                         }
5813 <DocBlock>.                             { // command block
5814                                           docBlock+=*yytext;
5815                                         }
5816
5817  /* ---- Copy verbatim sections ------ */
5818
5819 <DocCopyBlock>"</"{PRE}">"              { // end of a <pre> block
5820                                           docBlock+=yytext;
5821                                           if (docBlockName=="<pre>")
5822                                           {
5823                                             BEGIN(DocBlock);
5824                                           }
5825                                         }
5826 <DocCopyBlock>"</"{CODE}">"             { // end of a <code> block
5827                                           docBlock+=yytext;
5828                                           if (docBlockName=="<code>")
5829                                           {
5830                                             BEGIN(DocBlock);
5831                                           }
5832                                         }
5833 <DocCopyBlock>[\\@]("f$"|"f]"|"f}")     {
5834                                           docBlock+=yytext;
5835                                           BEGIN(DocBlock);
5836                                         }
5837 <DocCopyBlock>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"endmanonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block
5838                                           docBlock+=yytext;
5839                                           if (&yytext[4]==docBlockName)
5840                                           {
5841                                             BEGIN(DocBlock);
5842                                           }
5843                                         }
5844 <DocCopyBlock>^{B}*"*"+/{BN}+           { // start of a comment line
5845                                           if (docBlockName=="verbatim")
5846                                           {
5847                                             REJECT;
5848                                           }
5849                                           else
5850                                           {
5851                                             QCString indent;
5852                                             indent.fill(' ',computeIndent(yytext,0));
5853                                             docBlock+=indent;
5854                                           }
5855                                         }
5856 <DocCopyBlock>[^\<@/*\]\$\\\n]+         { // any character that is not special
5857                                           docBlock+=yytext;
5858                                         }
5859 <DocCopyBlock>"/*"|"*/"|"//"            {
5860                                           docBlock+=yytext;
5861                                         }
5862 <DocCopyBlock>\n                        { // newline
5863                                           docBlock+=*yytext;
5864                                           lineCount();
5865                                         }
5866 <DocCopyBlock>.                         { // any other character
5867                                           docBlock+=*yytext;
5868                                         }
5869 <DocCopyBlock><<EOF>>                   {
5870                                           warn(yyFileName,yyLineNr,
5871                                               "warning: reached end of file while inside a %s block!\n"
5872                                               "The command that should end the block seems to be missing!\n",
5873                                               docBlockName.data());
5874                                           yyterminate();
5875                                         }
5876
5877
5878     /* ------------- Prototype parser -------------- */
5879
5880 <Prototype>"operator"{B}*"("{B}*")"     {
5881                                           current->name+=yytext;
5882                                         }
5883 <Prototype>"("                         {
5884                                           current->args+=*yytext;
5885                                           currentArgumentContext = PrototypeQual;
5886                                           fullArgString = current->args.copy();
5887                                           copyArgString = &current->args;
5888                                           BEGIN( ReadFuncArgType ) ;
5889                                         }
5890 <Prototype>"("({ID}"::")*({B}*[&*])+    {
5891                                           current->type+=current->name+yytext;
5892                                           current->name.resize(0);
5893                                           BEGIN( PrototypePtr );
5894                                         }
5895 <PrototypePtr>{SCOPENAME}               {
5896                                           current->name+=yytext;
5897                                         }
5898 <PrototypePtr>"("                       {
5899                                           current->args+=*yytext;
5900                                           currentArgumentContext = PrototypeQual;
5901                                           fullArgString = current->args.copy();
5902                                           copyArgString = &current->args;
5903                                           BEGIN( ReadFuncArgType ) ;
5904                                         }
5905 <PrototypePtr>")"                       {
5906                                           current->type+=')';
5907                                           BEGIN( Prototype );
5908                                         }
5909 <PrototypePtr>.                         {
5910                                           current->name+=yytext;
5911                                         }
5912 <PrototypeQual>"{"                      {
5913                                           BEGIN( PrototypeSkipLine);
5914                                         }
5915 <PrototypeQual>{B}*"const"{B}*          { 
5916                                           current->args += " const "; 
5917                                           current->argList->constSpecifier=TRUE;
5918                                         }
5919 <PrototypeQual>{B}*"volatile"{B}*       { 
5920                                           current->args += " volatile "; 
5921                                           current->argList->volatileSpecifier=TRUE;
5922                                         }
5923 <PrototypeQual>{B}*"="{B}*"0"{B}*       { 
5924                                           current->args += " = 0"; 
5925                                           current->virt = Pure; 
5926                                           current->argList->pureSpecifier=TRUE;
5927                                         }
5928 <PrototypeQual>"throw"{B}*"("           {
5929                                           current->exception = "throw(";
5930                                           BEGIN(PrototypeExc);
5931                                         }
5932 <PrototypeExc>")"                       {
5933                                           current->exception += ')';
5934                                           BEGIN(PrototypeQual);
5935                                         }
5936 <PrototypeExc>.                         {
5937                                           current->exception += *yytext;
5938                                         }
5939 <PrototypeQual>.                        {
5940                                           current->args += *yytext;
5941                                         }
5942 <Prototype>.                            {
5943                                           current->name += *yytext;
5944                                         }
5945 <PrototypeSkipLine>.                    {
5946                                         }
5947
5948
5949   /* ------------ Generic rules -------------- */
5950
5951
5952 <SkipCxxComment>.*"\\\n"                {  // line continuation
5953                                           if (insideCS) 
5954                                           {
5955                                             REJECT;
5956                                           }
5957                                           else 
5958                                           {
5959                                             lineCount();
5960                                           }
5961                                         }
5962 <SkipCxxComment>.*/\n                   { 
5963                                           BEGIN( lastCContext ) ;
5964                                         }
5965 <SkipComment>[^\*\n]+
5966 <*>\n                                   { lineCount(); }
5967 <*>\"                                   {
5968                                           if (insideIDL && insideCppQuote)
5969                                           {
5970                                             BEGIN(EndCppQuote);
5971                                           }
5972                                         }
5973 <*>"#"                                  {       
5974                                           if (!insidePHP)
5975                                             REJECT;
5976                                           lastCContext = YY_START ;
5977                                           BEGIN( SkipCxxComment ) ;
5978                                         }
5979 <*>\'                                   {
5980                                           if (insidePHP)
5981                                           {
5982                                             lastStringContext=YY_START;
5983                                             BEGIN(SkipPHPString);
5984                                           }
5985                                         }
5986 <*>\"                                   {
5987                                           if (insidePHP)
5988                                           {
5989                                             lastStringContext=YY_START;
5990                                             BEGIN(SkipString);
5991                                           }
5992                                         }
5993 <*>.
5994 <SkipComment>"//"|"/*"
5995 <*>"/*"                                 { lastCContext = YY_START ;
5996                                           BEGIN( SkipComment ) ;
5997                                         }
5998 <SkipComment>{B}*"*/"                   { BEGIN( lastCContext ) ; }
5999 <*>"//"                                 {       
6000                                           lastCContext = YY_START ;
6001                                           BEGIN( SkipCxxComment ) ;
6002                                         }
6003 %%
6004
6005 //----------------------------------------------------------------------------
6006
6007 static void startCommentBlock(bool brief)
6008 {
6009   if (brief)
6010   {
6011     current->briefFile = yyFileName;
6012     current->briefLine = yyLineNr;
6013   }
6014   else
6015   {
6016     current->docFile = yyFileName;
6017     current->docLine = yyLineNr;
6018   }
6019 }
6020   
6021 //----------------------------------------------------------------------------
6022
6023 static void newEntry()
6024 {
6025   current_root->addSubEntry(current);
6026   previous = current;
6027   current = new Entry ;
6028   initEntry();
6029 }
6030
6031 static void handleCommentBlock(const QCString &doc,bool brief)
6032 {
6033   static bool hideInBodyDocs = Config_getBool("HIDE_IN_BODY_DOCS");
6034   int position=0;
6035   bool needsEntry=FALSE;
6036   if (docBlockInBody && hideInBodyDocs) return;
6037   //printf("parseCommentBlock [%s] brief=%d\n",doc.data(),brief);
6038   int lineNr = brief ? current->briefLine : current->docLine;   // line of block start
6039   
6040   // fill in inbodyFile && inbodyLine the first time, see bug 633891
6041   Entry *docEntry = docBlockInBody && previous ? previous : current;
6042   if (docBlockInBody && docEntry && docEntry->inbodyLine==-1)
6043   {
6044     docEntry->inbodyFile = yyFileName;
6045     docEntry->inbodyLine = lineNr;
6046   }
6047
6048   while (parseCommentBlock(
6049         g_thisParser,
6050         docBlockInBody && previous ? previous : current,
6051         stripIndentation(doc),        // text
6052         yyFileName, // file
6053         lineNr,     // line of block start
6054         docBlockInBody ? FALSE : brief,               // isBrief
6055         docBlockInBody ? FALSE : docBlockAutoBrief,   // isJavaDocStyle
6056         docBlockInBody,                               // isInBody
6057         protection,
6058         position,
6059         needsEntry
6060         )
6061      ) 
6062   {
6063     //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
6064     if (needsEntry) 
6065     {
6066       QCString docFile = current->docFile;
6067       newEntry();
6068       current->docFile = docFile;
6069       current->docLine = lineNr;
6070     }
6071   }
6072   if (needsEntry)
6073   {
6074     newEntry();
6075   }
6076
6077   if (docBlockTerm)
6078   {
6079     unput(docBlockTerm);
6080     docBlockTerm=0;
6081   }
6082 }
6083
6084 static void handleParametersCommentBlocks(ArgumentList *al)
6085 {
6086   //printf(">>>>>>> handleParametersCommentBlocks()\n");
6087   ArgumentListIterator ali(*al);
6088   Argument *a;
6089   for (ali.toFirst();(a=ali.current());++ali)
6090   {
6091     //printf("    Param %s docs=%s\n",a->name.data(),a->docs.data());
6092     if (!a->docs.isEmpty())
6093     {
6094       int position=0;
6095       bool needsEntry;
6096
6097       // save context
6098       QCString orgDoc   = current->doc;
6099       QCString orgBrief = current->brief;
6100       int orgDocLine    = current->docLine;
6101       int orgBriefLine  = current->briefLine;
6102
6103       current->doc.resize(0);
6104       current->brief.resize(0);
6105
6106       //printf("handleParametersCommentBlock [%s]\n",doc.data());
6107       while (parseCommentBlock(
6108              g_thisParser,
6109              current,
6110              a->docs,            // text
6111              yyFileName,         // file
6112              current->docLine,   // line of block start
6113              FALSE, 
6114              FALSE,
6115              FALSE,
6116              protection,
6117              position,
6118              needsEntry
6119             )
6120           ) 
6121       {
6122         //printf("handleParametersCommentBlock position=%d [%s]\n",position,doc.data()+position);
6123         if (needsEntry) newEntry();
6124       }
6125       if (needsEntry)
6126       {
6127         newEntry();
6128       }
6129       a->docs = current->doc;
6130
6131       // restore context
6132       current->doc       = orgDoc;
6133       current->brief     = orgBrief;
6134       current->docLine   = orgDocLine;
6135       current->briefLine = orgBriefLine;
6136     }
6137   }
6138 }
6139
6140
6141 //----------------------------------------------------------------------------
6142
6143 static void parseCompounds(Entry *rt)
6144 {
6145   //printf("parseCompounds(%s)\n",rt->name.data());
6146   g_inputFromFile = FALSE;
6147   EntryListIterator eli(*rt->children());
6148   Entry *ce;
6149   for (;(ce=eli.current());++eli)
6150   {
6151     if (!ce->program.isEmpty())
6152     {
6153       //printf("-- %s ---------\n%s\n---------------\n",
6154       //  ce->name.data(),ce->program.data());
6155       // init scanner state
6156       padCount=0;
6157       //depthIf = 0;
6158       g_column=0;
6159       inputString = ce->program;
6160       inputPosition = 0;
6161       scanYYrestart( scanYYin ) ;
6162       if (ce->section==Entry::ENUM_SEC || (ce->spec&Entry::Enum))
6163         BEGIN( FindFields ) ;
6164       else
6165         BEGIN( FindMembers ) ;
6166       current_root = ce ;
6167       yyFileName = ce->fileName;
6168       //setContext();
6169       yyLineNr = ce->startLine ;
6170       insideObjC = ce->lang==SrcLangExt_ObjC;
6171       //printf("---> Inner block starts at line %d objC=%d\n",yyLineNr,insideObjC);
6172       //current->reset();
6173       if (current) delete current;
6174       current = new Entry;
6175       initEntry();
6176       gstat = FALSE;
6177       int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
6178       // set default protection based on the compound type
6179       if( ce->section==Entry::CLASS_SEC ) // class
6180       {
6181
6182         if (insidePHP || insideD || insideJS)
6183         {
6184           current->protection = protection = Public ; 
6185         }
6186         else if (insideJava)
6187         {
6188           current->protection = protection = (ce->spec & (Entry::Interface|Entry::Enum)) ?  Public : Package;
6189         }
6190         else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union))
6191         {
6192           if (ce->lang==SrcLangExt_ObjC)
6193           {
6194             current->protection = protection = Protected ;
6195           }
6196           else
6197           {
6198             current->protection = protection = Public ;
6199           }
6200         }
6201         else 
6202         {
6203           current->protection = protection = Private ;
6204         }
6205       }
6206       else if (ce->section == Entry::ENUM_SEC ) // enum
6207       {
6208         current->protection = protection = ce->protection;
6209       }
6210       else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
6211       {
6212         if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace
6213         {
6214           current->stat = gstat = TRUE;
6215         }
6216         current->protection = protection = ce->protection;
6217       }
6218       else // named struct, union, protocol, category
6219       {
6220         current->protection = protection = Public ;
6221       }
6222       mtype = Method;
6223       virt = Normal;
6224       //printf("name=%s current->stat=%d gstat=%d\n",ce->name.data(),current->stat,gstat);
6225
6226       //memberGroupId = DOX_NOGROUP;
6227       //memberGroupRelates.resize(0);
6228       //memberGroupInside.resize(0);
6229       groupEnterCompound(yyFileName,yyLineNr,ce->name);
6230       
6231       scanYYlex() ;
6232       g_lexInit=TRUE;
6233       //forceEndGroup();
6234
6235       groupLeaveCompound(yyFileName,yyLineNr,ce->name);
6236       
6237       delete current; current=0;
6238       ce->program.resize(0);
6239
6240
6241       //if (depthIf>0)
6242       //{
6243       //        warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!");
6244       //}
6245     }
6246     parseCompounds(ce);
6247   }
6248 }
6249
6250 //----------------------------------------------------------------------------
6251
6252 static void parseMain(const char *fileName,const char *fileBuf,Entry *rt)
6253 {
6254   initParser();
6255   //g_inputFromFile = TRUE;
6256
6257   inputString = fileBuf;
6258   inputPosition = 0;
6259   g_inputFromFile = FALSE;
6260   g_column = 0;
6261
6262   //anonCount     = 0;  // don't reset per file
6263   //depthIf       = 0;
6264   protection    = Public;
6265   mtype         = Method;
6266   gstat         = FALSE;
6267   virt          = Normal;
6268   current_root  = rt;
6269   global_root   = rt;
6270   inputFile.setName(fileName);
6271   if (inputFile.open(IO_ReadOnly))
6272   {
6273     yyLineNr= 1 ; 
6274     yyFileName = fileName;
6275     setContext();
6276     rt->lang = language;
6277     msg("Parsing file %s...\n",yyFileName.data());
6278
6279     current_root  = rt ;
6280     initParser();
6281     groupEnterFile(yyFileName,yyLineNr);
6282     current       = new Entry;
6283     //printf("current=%p current_root=%p\n",current,current_root);
6284     int sec=guessSection(yyFileName);
6285     if (sec)
6286     {
6287       current->name    = yyFileName;
6288       current->section = sec;
6289       current_root->addSubEntry(current);
6290       current          = new Entry;
6291     }
6292     current->reset();
6293     initEntry();
6294     scanYYrestart( scanYYin );
6295     if ( insidePHP )
6296     {
6297       BEGIN( FindMembersPHP );
6298     }
6299     else
6300     {
6301       BEGIN( FindMembers );
6302     }
6303
6304     scanYYlex();
6305     g_lexInit=TRUE;
6306
6307     if (YY_START==Comment)
6308     {
6309       warn(yyFileName,yyLineNr,"warning: File ended in the middle of a comment block! Perhaps a missing \\endcode?");
6310     }
6311
6312     //forceEndGroup();
6313     groupLeaveFile(yyFileName,yyLineNr);
6314
6315     //if (depthIf>0)
6316     //{
6317     //  warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!");
6318     //}
6319
6320     rt->program.resize(0);
6321     if (rt->children()->contains(current)==0) 
6322       // it could be that current is already added as a child to rt, so we
6323       // only delete it if this is not the case. See bug 635317.
6324     {
6325       delete current; current=0;
6326     }
6327
6328     parseCompounds(rt);
6329
6330     inputFile.close();
6331
6332     anonNSCount++;
6333   }
6334 }
6335
6336 //----------------------------------------------------------------------------
6337
6338 static void parsePrototype(const QCString &text)
6339 {
6340   //printf("**** parsePrototype(%s) begin\n",text.data());
6341   if (text.isEmpty()) 
6342   {
6343     warn(yyFileName,yyLineNr,"Empty prototype found!");
6344     return;
6345   }
6346
6347   const char *orgInputString;
6348   int orgInputPosition;
6349   YY_BUFFER_STATE orgState;
6350   bool orgInputFromFile;
6351   
6352   // save scanner state
6353   orgState = YY_CURRENT_BUFFER;
6354   yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE));
6355   orgInputString = inputString; 
6356   orgInputPosition = inputPosition;
6357   orgInputFromFile = g_inputFromFile;
6358
6359   // set new string
6360   inputString = text;
6361   inputPosition = 0;
6362   g_column = 0;
6363   g_inputFromFile = FALSE;
6364   scanYYrestart( scanYYin );
6365   BEGIN(Prototype);
6366   scanYYlex();
6367   g_lexInit=TRUE;
6368
6369   current->name = current->name.stripWhiteSpace();
6370   if (current->section == Entry::MEMBERDOC_SEC && current->args.isEmpty())
6371     current->section = Entry::VARIABLEDOC_SEC;
6372
6373   // restore original scanner state
6374   YY_BUFFER_STATE tmpState = YY_CURRENT_BUFFER;
6375   yy_switch_to_buffer(orgState);
6376   yy_delete_buffer(tmpState);
6377   inputString = orgInputString; 
6378   inputPosition = orgInputPosition;
6379   g_inputFromFile = orgInputFromFile;
6380
6381   //printf("**** parsePrototype end\n");
6382 }
6383
6384 void scanFreeScanner()
6385 {
6386 #if defined(YY_FLEX_SUBMINOR_VERSION)
6387   if (g_lexInit)
6388   {
6389     scanYYlex_destroy();
6390   }
6391 #endif
6392 }
6393
6394 //static void handleGroupStartCommand(const char *header)
6395 //{
6396 //  memberGroupHeader=header;
6397 //  startGroupInDoc();
6398 //}
6399 //
6400 //static void handleGroupEndCommand()
6401 //{
6402 //  endGroup();
6403 //  previous=0;
6404 //}
6405
6406 //----------------------------------------------------------------------------
6407
6408 void CLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root)
6409 {
6410   g_thisParser = this;
6411   ::parseMain(fileName,fileBuf,root);
6412 }
6413
6414 void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf,
6415                    const char * scopeName,
6416                    const QCString & input,
6417                    bool isExampleBlock,
6418                    const char * exampleName,
6419                    FileDef * fileDef,
6420                    int startLine,
6421                    int endLine,
6422                    bool inlineFragment,
6423                    MemberDef *memberDef,
6424                    bool showLineNumbers,
6425                    Definition *searchCtx
6426                   )
6427 {
6428   ::parseCCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
6429                fileDef,startLine,endLine,inlineFragment,memberDef,
6430                showLineNumbers,searchCtx);
6431 }
6432
6433 bool CLanguageScanner::needsPreprocessing(const QCString &extension)
6434 {
6435   QCString fe=extension.lower();
6436   return 
6437    !( fe==".java" || fe==".as"  || fe==".d"    || fe==".php" || 
6438       fe==".php4" || fe==".inc" || fe==".phtml" 
6439     );
6440 }
6441
6442 void CLanguageScanner::resetCodeParserState()
6443 {
6444   ::resetCCodeParserState();
6445 }
6446
6447 void CLanguageScanner::parsePrototype(const char *text)
6448 {
6449   ::parsePrototype(text);
6450 }
6451
6452 //----------------------------------------------------------------------------
6453
6454 #if !defined(YY_FLEX_SUBMINOR_VERSION) 
6455 //----------------------------------------------------------------------------
6456 extern "C" { // some bogus code to keep the compiler happy
6457   void scannerYYdummy() { yy_flex_realloc(0,0); } 
6458 }
6459 #endif
6460