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