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