|
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 //printf("scanner.l: <FindMembers>[;,] name=%s, endBodyLine=%d\n", current->name.data(), current->endBodyLine); |
|
2672 QCString oldType = current->type.copy(); |
|
2673 if (current->bodyLine==-1) |
|
2674 { |
|
2675 current->bodyLine = yyLineNr; |
|
2676 } |
|
2677 if ( insidePHP && current->type.left(3) == "var" ) |
|
2678 { |
|
2679 current->type = current->type.mid(3); |
|
2680 } |
|
2681 if (isTypedef && current->type.left(8)!="typedef ") |
|
2682 { |
|
2683 current->type.prepend("typedef "); |
|
2684 } |
|
2685 bool needNewCurrent=FALSE; |
|
2686 if (!current->name.isEmpty() && current->section!=Entry::ENUM_SEC) |
|
2687 { |
|
2688 current->type=current->type.simplifyWhiteSpace(); |
|
2689 current->args=removeRedundantWhiteSpace(current->args); |
|
2690 current->name=current->name.stripWhiteSpace(); |
|
2691 if (current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" |
|
2692 { |
|
2693 current->spec = 0; |
|
2694 } |
|
2695 current->section = Entry::VARIABLE_SEC ; |
|
2696 current->fileName = yyFileName; |
|
2697 current->startLine = yyLineNr; |
|
2698 //printf("scanner.l: <FindMembers>[;,] file=%s line=%d\n", current->fileName.data(), current->startLine); |
|
2699 current_root->addSubEntry( current ) ; |
|
2700 needNewCurrent=TRUE; |
|
2701 } |
|
2702 if ( *yytext == ',') |
|
2703 { |
|
2704 if (needNewCurrent) |
|
2705 { |
|
2706 current = new Entry(*current); |
|
2707 } |
|
2708 current->name.resize(0); |
|
2709 current->args.resize(0); |
|
2710 current->brief.resize(0); |
|
2711 current->doc.resize(0); |
|
2712 current->initializer.resize(0); |
|
2713 current->bitfields.resize(0); |
|
2714 int i=oldType.length(); |
|
2715 while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--; |
|
2716 current->type = oldType.left(i); |
|
2717 } |
|
2718 else |
|
2719 { |
|
2720 if (needNewCurrent) |
|
2721 { |
|
2722 current = new Entry ; |
|
2723 } |
|
2724 else if (current->groups) |
|
2725 { |
|
2726 current->groups->clear(); |
|
2727 } |
|
2728 initEntry(); |
|
2729 } |
|
2730 BEGIN( FindMembers ) ; |
|
2731 } |
|
2732 |
|
2733 <FindMembers>"[" { |
|
2734 if (!insideCS && |
|
2735 (current->name.isEmpty() || |
|
2736 current->name=="typedef" |
|
2737 ) |
|
2738 ) // IDL function property |
|
2739 { |
|
2740 squareCount=1; |
|
2741 lastSquareContext = YY_START; |
|
2742 idlAttr.resize(0); |
|
2743 idlProp.resize(0); |
|
2744 current->mtype = mtype; |
|
2745 BEGIN( IDLAttribute ); |
|
2746 } |
|
2747 else if (insideCS && |
|
2748 current->name.isEmpty()) |
|
2749 { |
|
2750 squareCount=1; |
|
2751 lastSquareContext = YY_START; |
|
2752 // Skip the C# attribute |
|
2753 // for this member |
|
2754 current->args.resize(0); |
|
2755 BEGIN( SkipSquare ); |
|
2756 } |
|
2757 else |
|
2758 { |
|
2759 current->args += yytext ; |
|
2760 squareCount=1; |
|
2761 BEGIN( Array ) ; |
|
2762 } |
|
2763 } |
|
2764 <IDLAttribute>"]" { |
|
2765 // end of IDL function attribute |
|
2766 if (--squareCount<=0) |
|
2767 { |
|
2768 lineCount(); |
|
2769 if (current->mtype == Property) |
|
2770 BEGIN( IDLPropName ); |
|
2771 else |
|
2772 BEGIN( lastSquareContext ); |
|
2773 } |
|
2774 } |
|
2775 <IDLAttribute>"propput" { |
|
2776 if (Config_getBool("IDL_PROPERTY_SUPPORT")) |
|
2777 { |
|
2778 current->mtype = Property; |
|
2779 } |
|
2780 current->spec |= Entry::Settable; |
|
2781 } |
|
2782 <IDLAttribute>"propget" { |
|
2783 if (Config_getBool("IDL_PROPERTY_SUPPORT")) |
|
2784 { |
|
2785 current->mtype = Property; |
|
2786 } |
|
2787 current->spec |= Entry::Gettable; |
|
2788 } |
|
2789 <IDLAttribute>. { |
|
2790 } |
|
2791 <IDLPropName>{BN}*{ID}{BN}* { |
|
2792 // return type (probably HRESULT) - skip it |
|
2793 } |
|
2794 <IDLPropName>{ID}{BN}*"(" { |
|
2795 current->name = yytext; |
|
2796 current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); |
|
2797 current->startLine = yyLineNr; |
|
2798 BEGIN( IDLProp ); |
|
2799 } |
|
2800 <IDLProp>{BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter |
|
2801 idlAttr = yytext; |
|
2802 idlAttr=idlAttr.stripWhiteSpace(); |
|
2803 } |
|
2804 <IDLProp>{ID} { // property type |
|
2805 idlProp = yytext; |
|
2806 } |
|
2807 <IDLProp>{BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);) |
|
2808 if (!current->args) |
|
2809 current->args = "("; |
|
2810 else |
|
2811 current->args += ", "; |
|
2812 current->args += idlAttr; |
|
2813 current->args += " "; |
|
2814 current->args += idlProp; // prop was actually type of extra parameter |
|
2815 current->args += " "; |
|
2816 current->args += yytext; |
|
2817 current->args = current->args.left(current->args.length() - 1); // strip comma |
|
2818 idlProp.resize(0); |
|
2819 idlAttr.resize(0); |
|
2820 BEGIN( IDLProp ); |
|
2821 } |
|
2822 <IDLProp>{BN}*{ID}{BN}*")"{BN}* { |
|
2823 // the parameter name for the property - just skip. |
|
2824 } |
|
2825 <IDLProp>";" { |
|
2826 current->fileName = yyFileName; |
|
2827 current->type = idlProp; |
|
2828 current->args = current->args.simplifyWhiteSpace(); |
|
2829 if (current->args) |
|
2830 current->args += ")"; |
|
2831 current->name = current->name.stripWhiteSpace(); |
|
2832 current->section = Entry::VARIABLE_SEC; |
|
2833 current_root->addSubEntry(current); |
|
2834 current = new Entry; |
|
2835 initEntry(); |
|
2836 BEGIN( FindMembers ); |
|
2837 } |
|
2838 <IDLProp>. { // spaces, *, or other stuff |
|
2839 //idlProp+=yytext; |
|
2840 } |
|
2841 <Array>"]" { current->args += *yytext ; |
|
2842 if (--squareCount<=0) |
|
2843 BEGIN( FindMembers ) ; |
|
2844 } |
|
2845 <FuncFuncArray>"]" { current->args += *yytext ; |
|
2846 if (--squareCount<=0) |
|
2847 BEGIN( Function ) ; |
|
2848 } |
|
2849 <Array,FuncFuncArray>"[" { current->args += *yytext ; |
|
2850 squareCount++; |
|
2851 } |
|
2852 <Array,FuncFuncArray>. { current->args += *yytext ; } |
|
2853 <SkipSquare>"[" { squareCount++; } |
|
2854 <SkipSquare>"]" { |
|
2855 if (--squareCount<=0) |
|
2856 BEGIN( lastSquareContext ); |
|
2857 } |
|
2858 <SkipSquare>\" { |
|
2859 lastStringContext=YY_START; |
|
2860 BEGIN( SkipString ); |
|
2861 } |
|
2862 <SkipSquare>[^\n\[\]\"]+ |
|
2863 <FindMembers>"<" { addType( current ) ; |
|
2864 current->type += yytext ; |
|
2865 BEGIN( Sharp ) ; |
|
2866 } |
|
2867 <Sharp>">" { current->type += *yytext ; |
|
2868 if (--sharpCount<=0) |
|
2869 BEGIN( FindMembers ) ; |
|
2870 } |
|
2871 <Sharp>"<" { current->type += *yytext ; |
|
2872 sharpCount++; |
|
2873 } |
|
2874 <Sharp>{BN}+ { |
|
2875 lineCount(); |
|
2876 } |
|
2877 <Sharp>. { current->type += *yytext ; } |
|
2878 <FindFields>{ID} { |
|
2879 current->bodyLine = yyLineNr; |
|
2880 current->name = yytext; |
|
2881 } |
|
2882 <FindFields>"(" { |
|
2883 // Java enum initializer |
|
2884 unput('('); |
|
2885 lastInitializerContext = YY_START; |
|
2886 initBracketCount=0; |
|
2887 BEGIN(ReadInitializer); |
|
2888 } |
|
2889 <FindFields>"=" { |
|
2890 lastInitializerContext = YY_START; |
|
2891 initBracketCount=0; |
|
2892 BEGIN(ReadInitializer); |
|
2893 } |
|
2894 <FindFields>";" { |
|
2895 if (insideJava) // last enum field in Java class |
|
2896 { |
|
2897 if (!current->name.isEmpty()) |
|
2898 { |
|
2899 current->fileName = yyFileName; |
|
2900 current->startLine = yyLineNr; |
|
2901 current->type = "@"; // enum marker |
|
2902 current->args = current->args.simplifyWhiteSpace(); |
|
2903 current->name = current->name.stripWhiteSpace(); |
|
2904 current->section = Entry::VARIABLE_SEC; |
|
2905 current_root->addSubEntry(current); |
|
2906 current = new Entry ; |
|
2907 initEntry(); |
|
2908 } |
|
2909 |
|
2910 // TODO: skip until the end of the scope |
|
2911 BEGIN( SkipRemainder ); |
|
2912 } |
|
2913 else |
|
2914 { |
|
2915 REJECT; |
|
2916 } |
|
2917 } |
|
2918 <SkipRemainder>\n { |
|
2919 yyLineNr++; |
|
2920 } |
|
2921 <SkipRemainder>[^\n]* |
|
2922 <FindFields>"," { |
|
2923 //printf("adding `%s' `%s' `%s' to enum `%s' (mGrpId=%d)\n", |
|
2924 // current->type.data(), current->name.data(), |
|
2925 // current->args.data(), current_root->name.data(),current->mGrpId); |
|
2926 if (!current->name.isEmpty()) |
|
2927 { |
|
2928 current->fileName = yyFileName; |
|
2929 current->startLine = yyLineNr; |
|
2930 current->type = "@"; // enum marker |
|
2931 current->args = current->args.simplifyWhiteSpace(); |
|
2932 current->name = current->name.stripWhiteSpace(); |
|
2933 current->section = Entry::VARIABLE_SEC; |
|
2934 // add to the scope of the enum |
|
2935 current_root->addSubEntry(current); |
|
2936 if (!insideCS && !insideJava) // for C# and Java 1.5+ enum values always have to be explicitly qualified |
|
2937 { |
|
2938 current = new Entry(*current); |
|
2939 // add to the scope surrounding the enum (copy!) |
|
2940 current_root->parent()->addSubEntry(current); |
|
2941 } |
|
2942 current = new Entry ; |
|
2943 initEntry(); |
|
2944 } |
|
2945 else // probably a redundant , |
|
2946 { |
|
2947 current->reset(); |
|
2948 } |
|
2949 } |
|
2950 <FindFields>"[" { // attribute list in IDL |
|
2951 squareCount=1; |
|
2952 lastSquareContext = YY_START; |
|
2953 BEGIN(SkipSquare); |
|
2954 } |
|
2955 /* |
|
2956 <FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); } |
|
2957 */ |
|
2958 <ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/]* { current->program += yytext ; } |
|
2959 <ReadBody,ReadNSBody,ReadBodyIntf>"//".* { current->program += yytext ; } |
|
2960 <ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!insidePHP) |
|
2961 REJECT; |
|
2962 // append PHP comment. |
|
2963 current->program += yytext ; |
|
2964 } |
|
2965 <ReadBody,ReadNSBody,ReadBodyIntf>@\" { current->program += yytext ; |
|
2966 pSkipVerbString = ¤t->program; |
|
2967 lastSkipVerbStringContext=YY_START; |
|
2968 BEGIN( SkipVerbString ); |
|
2969 } |
|
2970 <ReadBody,ReadNSBody,ReadBodyIntf>\" { current->program += yytext ; |
|
2971 pCopyQuotedGString = ¤t->program; |
|
2972 lastStringContext=YY_START; |
|
2973 BEGIN( CopyGString ); |
|
2974 } |
|
2975 <ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}* { current->program += yytext ; |
|
2976 lastContext = YY_START ; |
|
2977 BEGIN( Comment ) ; |
|
2978 } |
|
2979 <ReadBody,ReadNSBody,ReadBodyIntf>"/*"{BL} { current->program += yytext ; |
|
2980 ++yyLineNr ; |
|
2981 lastContext = YY_START ; |
|
2982 BEGIN( Comment ) ; |
|
2983 } |
|
2984 <ReadBody,ReadNSBody,ReadBodyIntf>"'" { |
|
2985 if (!insidePHP) |
|
2986 { |
|
2987 current->program += yytext; |
|
2988 } |
|
2989 else |
|
2990 { // begin of single quoted string |
|
2991 current->program += yytext; |
|
2992 pCopyQuotedGString = ¤t->program; |
|
2993 lastStringContext=YY_START; |
|
2994 BEGIN(CopyPHPGString); |
|
2995 } |
|
2996 } |
|
2997 <ReadBody,ReadNSBody,ReadBodyIntf>{CHARLIT} { |
|
2998 if (insidePHP) |
|
2999 { |
|
3000 REJECT; // for PHP code single quotes |
|
3001 // are used for strings of arbitrary length |
|
3002 } |
|
3003 else |
|
3004 { |
|
3005 current->program += yytext; |
|
3006 } |
|
3007 } |
|
3008 <ReadBody,ReadNSBody,ReadBodyIntf>"{" { current->program += yytext ; |
|
3009 ++curlyCount ; |
|
3010 } |
|
3011 <ReadBodyIntf>"}" { |
|
3012 current->program += yytext ; |
|
3013 --curlyCount ; |
|
3014 } |
|
3015 <ReadBody,ReadNSBody>"}" { //err("ReadBody count=%d\n",curlyCount); |
|
3016 if ( curlyCount>0 ) |
|
3017 { |
|
3018 current->program += yytext ; |
|
3019 --curlyCount ; |
|
3020 } |
|
3021 else |
|
3022 { |
|
3023 current->endBodyLine = yyLineNr; |
|
3024 QCString &cn = current->name; |
|
3025 QCString rn = current_root->name.copy(); |
|
3026 //printf("cn=`%s' rn=`%s'\n",cn.data(),rn.data()); |
|
3027 if (!cn.isEmpty() && !rn.isEmpty()) |
|
3028 { |
|
3029 prependScope(); |
|
3030 } |
|
3031 if (isTypedef && cn.isEmpty()) |
|
3032 { |
|
3033 //printf("Typedef Name\n"); |
|
3034 BEGIN( TypedefName ); |
|
3035 } |
|
3036 else |
|
3037 { |
|
3038 if (current->section == Entry::ENUM_SEC) |
|
3039 { |
|
3040 current->program+=','; // add field terminator |
|
3041 } |
|
3042 // add compound definition to the tree |
|
3043 current->args=removeRedundantWhiteSpace(current->args); |
|
3044 // was: current->args.simplifyWhiteSpace(); |
|
3045 current->type = current->type.simplifyWhiteSpace(); |
|
3046 current->name = current->name.stripWhiteSpace(); |
|
3047 //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); |
|
3048 if (insideObjC && |
|
3049 ((current->spec&Entry::Interface) || (current->spec==Entry::Category)) |
|
3050 ) // method definition follows |
|
3051 { |
|
3052 BEGIN( ReadBodyIntf ) ; |
|
3053 } |
|
3054 else |
|
3055 { |
|
3056 current_root->addSubEntry( current ) ; |
|
3057 memspecEntry = current; |
|
3058 current = new Entry(*current); |
|
3059 if (current->section==Entry::NAMESPACE_SEC || |
|
3060 (current->spec==Entry::Interface) || |
|
3061 insideJava || insidePHP || insideCS || insideD || insideJS |
|
3062 ) |
|
3063 { // namespaces and interfaces and java classes ends with a closing bracket without semicolon |
|
3064 current->reset(); |
|
3065 initEntry(); |
|
3066 memspecEntry = 0; |
|
3067 BEGIN( FindMembers ) ; |
|
3068 } |
|
3069 else |
|
3070 { |
|
3071 //current->doc.resize(0); |
|
3072 //current->brief.resize(0); |
|
3073 BEGIN( MemberSpec ) ; |
|
3074 } |
|
3075 } |
|
3076 } |
|
3077 } |
|
3078 } |
|
3079 <ReadBody>"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",curlyCount); |
|
3080 lineCount(); |
|
3081 if ( curlyCount>0 ) |
|
3082 { |
|
3083 current->program += yytext ; |
|
3084 --curlyCount ; |
|
3085 } |
|
3086 else |
|
3087 { |
|
3088 isTypedef = TRUE; |
|
3089 current->endBodyLine = yyLineNr; |
|
3090 QCString &cn = current->name; |
|
3091 QCString rn = current_root->name.copy(); |
|
3092 if (!cn.isEmpty() && !rn.isEmpty()) |
|
3093 { |
|
3094 prependScope(); |
|
3095 } |
|
3096 BEGIN( TypedefName ); |
|
3097 } |
|
3098 } |
|
3099 <TypedefName>("const"|"volatile"){BN} { // late "const" or "volatile" keyword |
|
3100 lineCount(); |
|
3101 current->type.prepend(yytext); |
|
3102 } |
|
3103 <TypedefName>{ID} { |
|
3104 if (current->section == Entry::ENUM_SEC) |
|
3105 { |
|
3106 current->program+=","; // add field terminator |
|
3107 } |
|
3108 current->name=yytext; |
|
3109 prependScope(); |
|
3110 current->args = current->args.simplifyWhiteSpace(); |
|
3111 current->type = current->type.simplifyWhiteSpace(); |
|
3112 //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data()); |
|
3113 current_root->addSubEntry( current ) ; |
|
3114 if (!firstTypedefEntry) |
|
3115 { |
|
3116 firstTypedefEntry = current; |
|
3117 } |
|
3118 current = new Entry; |
|
3119 initEntry(); |
|
3120 isTypedef=TRUE; // to undo reset by initEntry() |
|
3121 BEGIN(MemberSpecSkip); |
|
3122 } |
|
3123 <TypedefName>";" { /* typedef of anonymous type */ |
|
3124 current->name.sprintf("@%d",anonCount++); |
|
3125 if (current->section == Entry::ENUM_SEC) |
|
3126 { |
|
3127 current->program+=','; // add field terminator |
|
3128 } |
|
3129 // add compound definition to the tree |
|
3130 current->args = current->args.simplifyWhiteSpace(); |
|
3131 current->type = current->type.simplifyWhiteSpace(); |
|
3132 current_root->addSubEntry( current ) ; |
|
3133 memspecEntry = current; |
|
3134 current = new Entry(*current); |
|
3135 unput(';'); |
|
3136 BEGIN( MemberSpec ) ; |
|
3137 } |
|
3138 <MemberSpec>([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part could be improved. |
|
3139 lineCount(); |
|
3140 int i=0,l=yyleng,j; |
|
3141 while (i<l && (!isId(yytext[i]))) i++; |
|
3142 msName = QCString(yytext).right(l-i).stripWhiteSpace(); |
|
3143 j=msName.find("["); |
|
3144 if (j!=-1) |
|
3145 { |
|
3146 msArgs=msName.right(msName.length()-j); |
|
3147 msName=msName.left(j); |
|
3148 } |
|
3149 msType=QCString(yytext).left(i); |
|
3150 |
|
3151 // handle *pName in: typedef { ... } name, *pName; |
|
3152 if (firstTypedefEntry) |
|
3153 { |
|
3154 if (firstTypedefEntry->spec&Entry::Struct) |
|
3155 { |
|
3156 msType.prepend("struct "+firstTypedefEntry->name); |
|
3157 } |
|
3158 else if (firstTypedefEntry->spec&Entry::Union) |
|
3159 { |
|
3160 msType.prepend("union "+firstTypedefEntry->name); |
|
3161 } |
|
3162 else if (firstTypedefEntry->section==Entry::ENUM_SEC) |
|
3163 { |
|
3164 msType.prepend("enum "+firstTypedefEntry->name); |
|
3165 } |
|
3166 else |
|
3167 { |
|
3168 msType.prepend(firstTypedefEntry->name); |
|
3169 } |
|
3170 } |
|
3171 } |
|
3172 <MemberSpec>[,;] { |
|
3173 //printf("current->name=`%s' msName=`%s'\n",current->name.data(),msName.data()); |
|
3174 if (msName.isEmpty() && !current->name.isEmpty()) |
|
3175 { |
|
3176 // see if the compound does not have a name or is inside another |
|
3177 // annonymous compound. If so we insert a |
|
3178 // special `annonymous' variable. |
|
3179 //Entry *p=current_root; |
|
3180 Entry *p=current; |
|
3181 while (p) |
|
3182 { |
|
3183 // only look for class scopes, not namespace scopes |
|
3184 if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty()) |
|
3185 { |
|
3186 //printf("Trying scope `%s'\n",p->name.data()); |
|
3187 int i=p->name.findRev("::"); |
|
3188 int pi = (i==-1) ? 0 : i+2; |
|
3189 if (p->name.at(pi)=='@') |
|
3190 { |
|
3191 // annonymous compound inside -> insert dummy variable name |
|
3192 //printf("Adding annonymous variable for scope %s\n",p->name.data()); |
|
3193 msName.sprintf("@%d",anonCount++); |
|
3194 break; |
|
3195 } |
|
3196 } |
|
3197 //p=p->parent; |
|
3198 if (p==current) p=current_root; else p=p->parent(); |
|
3199 } |
|
3200 } |
|
3201 //printf("msName=%s current->name=%s\n",msName.data(),current->name.data()); |
|
3202 if (!msName.isEmpty() && msName!=current->name) // skip typedef T {} T; |
|
3203 { |
|
3204 static bool typedefHidesStruct = Config_getBool("TYPEDEF_HIDES_STRUCT"); |
|
3205 // case 1: typedef struct _S { ... } S_t; |
|
3206 // -> omit typedef and use S_t as the struct name |
|
3207 if (typedefHidesStruct && |
|
3208 isTypedef && |
|
3209 ((current->spec&(Entry::Struct|Entry::Union)) || |
|
3210 current->section==Entry::ENUM_SEC )&& |
|
3211 msType.stripWhiteSpace().isEmpty() && |
|
3212 memspecEntry) |
|
3213 { |
|
3214 memspecEntry->name=msName; |
|
3215 } |
|
3216 else // case 2: create a typedef field |
|
3217 { |
|
3218 Entry *varEntry=new Entry; |
|
3219 varEntry->protection = current->protection ; |
|
3220 varEntry->mtype = current->mtype; |
|
3221 varEntry->virt = current->virt; |
|
3222 varEntry->stat = current->stat; |
|
3223 varEntry->section = Entry::VARIABLE_SEC; |
|
3224 varEntry->name = msName.stripWhiteSpace(); |
|
3225 varEntry->type = current->type.simplifyWhiteSpace()+" "; |
|
3226 varEntry->args = msArgs; |
|
3227 if (isTypedef) |
|
3228 { |
|
3229 varEntry->type.prepend("typedef "); |
|
3230 // //printf("current->name = %s %s\n",current->name.data(),msName.data()); |
|
3231 } |
|
3232 if (typedefHidesStruct && |
|
3233 isTypedef && |
|
3234 (current->spec&(Entry::Struct|Entry::Union)) && |
|
3235 memspecEntry |
|
3236 ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;" |
|
3237 { |
|
3238 varEntry->type+=memspecEntry->name+msType; |
|
3239 } |
|
3240 else // case 2: use _S as type for for pS_t |
|
3241 { |
|
3242 varEntry->type+=current->name+msType; |
|
3243 } |
|
3244 varEntry->fileName = yyFileName; |
|
3245 varEntry->startLine = yyLineNr; |
|
3246 varEntry->doc = current->doc.copy(); |
|
3247 varEntry->brief = current->brief.copy(); |
|
3248 varEntry->mGrpId = current->mGrpId; |
|
3249 |
|
3250 // deep copy group list |
|
3251 QListIterator<Grouping> gli(*current->groups); |
|
3252 Grouping *g; |
|
3253 for (;(g=gli.current());++gli) |
|
3254 { |
|
3255 varEntry->groups->append(new Grouping(*g)); |
|
3256 } |
|
3257 if (current->sli) // copy special list items |
|
3258 { |
|
3259 QListIterator<ListItemInfo> li(*current->sli); |
|
3260 ListItemInfo *lii; |
|
3261 for (li.toFirst();(lii=li.current());++li) |
|
3262 { |
|
3263 varEntry->addSpecialListItem(lii->type,lii->itemId); |
|
3264 } |
|
3265 } |
|
3266 |
|
3267 //printf("Add: type=`%s',name=`%s',args=`%s' brief=%s doc=%s\n", |
|
3268 // varEntry->type.data(),varEntry->name.data(), |
|
3269 // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data()); |
|
3270 current_root->addSubEntry(varEntry); |
|
3271 } |
|
3272 } |
|
3273 if (*yytext==';') |
|
3274 { |
|
3275 msType.resize(0); |
|
3276 msName.resize(0); |
|
3277 msArgs.resize(0); |
|
3278 isTypedef=FALSE; |
|
3279 firstTypedefEntry=0; |
|
3280 memspecEntry=0; |
|
3281 current->reset(); |
|
3282 initEntry(); |
|
3283 BEGIN( FindMembers ); |
|
3284 } |
|
3285 else |
|
3286 { |
|
3287 current->doc.resize(0); |
|
3288 current->brief.resize(0); |
|
3289 } |
|
3290 } |
|
3291 <MemberSpec>"=" { |
|
3292 lastInitializerContext=YY_START; |
|
3293 initBracketCount=0; |
|
3294 BEGIN(ReadInitializer); |
|
3295 /* BEGIN(MemberSpecSkip); */ |
|
3296 } |
|
3297 /* |
|
3298 <MemberSpecSkip>"{" { |
|
3299 curlyCount=0; |
|
3300 lastCurlyContext = MemberSpecSkip; |
|
3301 previous = current; |
|
3302 BEGIN(SkipCurly); |
|
3303 } |
|
3304 */ |
|
3305 <MemberSpecSkip>"," { BEGIN(MemberSpec); } |
|
3306 <MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); } |
|
3307 <ReadBody,ReadNSBody,ReadBodyIntf>{BN}+ { current->program += yytext ; |
|
3308 lineCount() ; |
|
3309 } |
|
3310 <ReadBodyIntf>"@end"/[^a-z_A-Z0-9] { // end of Objective C block |
|
3311 current_root->addSubEntry( current ) ; |
|
3312 current=new Entry; |
|
3313 initEntry(); |
|
3314 insideObjC=FALSE; |
|
3315 BEGIN( FindMembers ); |
|
3316 } |
|
3317 <ReadBody,ReadNSBody,ReadBodyIntf>. { current->program += yytext ; } |
|
3318 |
|
3319 <FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */ |
|
3320 <FindMembers>("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[] */ |
|
3321 if (insidePHP) // reference parameter |
|
3322 { |
|
3323 REJECT |
|
3324 } |
|
3325 else |
|
3326 { |
|
3327 current->bodyLine = yyLineNr; |
|
3328 lineCount(); |
|
3329 addType(current); |
|
3330 funcPtrType=yytext; |
|
3331 roundCount=0; |
|
3332 //current->type += yytext; |
|
3333 BEGIN( FuncPtr ); |
|
3334 } |
|
3335 } |
|
3336 <FuncPtr>{SCOPENAME} { |
|
3337 current->name = yytext; |
|
3338 if (nameIsOperator(current->name)) |
|
3339 { |
|
3340 BEGIN( FuncPtrOperator ); |
|
3341 } |
|
3342 else |
|
3343 { |
|
3344 if (current->name=="const" || current->name=="volatile") |
|
3345 { |
|
3346 funcPtrType += current->name; |
|
3347 } |
|
3348 else |
|
3349 { |
|
3350 BEGIN( EndFuncPtr ); |
|
3351 } |
|
3352 } |
|
3353 } |
|
3354 <FuncPtr>. { |
|
3355 //printf("Error: FuncPtr `%c' unexpected at line %d of %s\n",*yytext,yyLineNr,yyFileName); |
|
3356 } |
|
3357 <FuncPtrOperator>"("{BN}*")"{BN}*/"(" { |
|
3358 current->name += yytext; |
|
3359 current->name = current->name.simplifyWhiteSpace(); |
|
3360 lineCount(); |
|
3361 } |
|
3362 <FuncPtrOperator>\n { |
|
3363 yyLineNr++; |
|
3364 current->name += *yytext; |
|
3365 } |
|
3366 <FuncPtrOperator>"(" { |
|
3367 unput(*yytext); |
|
3368 BEGIN( EndFuncPtr ); |
|
3369 } |
|
3370 <FuncPtrOperator>. { |
|
3371 current->name += *yytext; |
|
3372 } |
|
3373 <EndFuncPtr>")"{BN}*/";" { // a variable with extra braces |
|
3374 lineCount(); |
|
3375 current->type+=funcPtrType.data()+1; |
|
3376 BEGIN(FindMembers); |
|
3377 } |
|
3378 <EndFuncPtr>")"{BN}*/"(" { // a function pointer |
|
3379 lineCount(); |
|
3380 current->type+=funcPtrType+")"; |
|
3381 BEGIN(FindMembers); |
|
3382 } |
|
3383 <EndFuncPtr>")"{BN}*/"[" { // an array of variables |
|
3384 lineCount(); |
|
3385 current->type+=funcPtrType.data(); |
|
3386 current->args += ")"; |
|
3387 BEGIN(FindMembers); |
|
3388 } |
|
3389 <EndFuncPtr>"(" { // a function returning a function or |
|
3390 // a function returning a pointer to an array |
|
3391 current->args += *yytext ; |
|
3392 //roundCount=0; |
|
3393 //BEGIN( FuncFunc ); |
|
3394 current->bodyLine = yyLineNr; |
|
3395 currentArgumentContext = FuncFuncEnd; |
|
3396 fullArgString=current->args.copy(); |
|
3397 copyArgString=¤t->args; |
|
3398 BEGIN( ReadFuncArgType ) ; |
|
3399 } |
|
3400 <EndFuncPtr>"["[^\n\]]*"]" { |
|
3401 funcPtrType+=yytext; |
|
3402 } |
|
3403 <EndFuncPtr>")" { |
|
3404 BEGIN(FindMembers); |
|
3405 } |
|
3406 <FuncFunc>"(" { |
|
3407 current->args += *yytext ; |
|
3408 ++roundCount; |
|
3409 } |
|
3410 <FuncFunc>")" { |
|
3411 current->args += *yytext ; |
|
3412 if ( roundCount ) |
|
3413 --roundCount; |
|
3414 else |
|
3415 { |
|
3416 BEGIN(FuncFuncEnd); |
|
3417 } |
|
3418 } |
|
3419 <FuncFuncEnd>")"{BN}*"(" { |
|
3420 lineCount(); |
|
3421 current->type+=funcPtrType+")("; |
|
3422 BEGIN(FuncFuncType); |
|
3423 } |
|
3424 <FuncFuncEnd>")"{BN}*/[;{] { |
|
3425 lineCount(); |
|
3426 current->type+=funcPtrType.data()+1; |
|
3427 BEGIN(Function); |
|
3428 } |
|
3429 <FuncFuncEnd>")"{BN}*/"[" { // function returning a pointer to an array |
|
3430 lineCount(); |
|
3431 current->type+=funcPtrType; |
|
3432 current->args+=")"; |
|
3433 BEGIN(FuncFuncArray); |
|
3434 } |
|
3435 <FuncFuncEnd>. { |
|
3436 current->args += *yytext; |
|
3437 } |
|
3438 <FuncFuncType>"(" { |
|
3439 current->type += *yytext; |
|
3440 roundCount++; |
|
3441 } |
|
3442 <FuncFuncType>")" { |
|
3443 current->type += *yytext; |
|
3444 if (roundCount) |
|
3445 --roundCount; |
|
3446 else |
|
3447 BEGIN(Function); |
|
3448 } |
|
3449 <FuncFuncType>{BN}*","{BN}* { lineCount() ; current->type += ", " ; } |
|
3450 <FuncFuncType>{BN}+ { lineCount() ; current->type += ' ' ; } |
|
3451 <FuncFuncType>. { |
|
3452 current->type += *yytext; |
|
3453 } |
|
3454 <FindMembers>"("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")(" { // for catching typedef void (__stdcall *f)() like definitions |
|
3455 if (current->type.left(7)=="typedef" && current->bodyLine==-1) |
|
3456 // the bodyLine check is to prevent this guard to be true more than once |
|
3457 { |
|
3458 current->bodyLine = yyLineNr; |
|
3459 BEGIN( GetCallType ); |
|
3460 } |
|
3461 else if (!current->name.isEmpty()) // normal function |
|
3462 { |
|
3463 current->args = yytext; |
|
3464 current->bodyLine = yyLineNr; |
|
3465 currentArgumentContext = FuncQual; |
|
3466 fullArgString=current->args.copy(); |
|
3467 copyArgString=¤t->args; |
|
3468 BEGIN( ReadFuncArgType ) ; |
|
3469 //printf(">>> Read function arguments!\n"); |
|
3470 } |
|
3471 } |
|
3472 <GetCallType>{BN}*{ID}{BN}*"*" { |
|
3473 lineCount(); |
|
3474 addType(current); |
|
3475 funcPtrType="("; |
|
3476 funcPtrType+=yytext; |
|
3477 roundCount=0; |
|
3478 BEGIN( FuncPtr ); |
|
3479 } |
|
3480 <FindMembers>"(" { |
|
3481 if (!current->name.isEmpty()) |
|
3482 { |
|
3483 current->args = yytext; |
|
3484 current->bodyLine = yyLineNr; |
|
3485 currentArgumentContext = FuncQual; |
|
3486 fullArgString=current->args.copy(); |
|
3487 copyArgString=¤t->args; |
|
3488 BEGIN( ReadFuncArgType ) ; |
|
3489 //printf(">>> Read function arguments current->argList->count()=%d\n",current->argList->count()); |
|
3490 } |
|
3491 } |
|
3492 /* |
|
3493 <FindMembers>"("{BN}*("void"{BN}*)?")" { |
|
3494 lineCount(); |
|
3495 current->args = "()"; |
|
3496 BEGIN( FuncQual ); |
|
3497 } |
|
3498 */ |
|
3499 |
|
3500 /*- Function argument reading rules ---------------------------------------*/ |
|
3501 |
|
3502 <ReadFuncArgType>[^ \/\r\t\n\)\(\"\'#]+ { *copyArgString+=yytext; |
|
3503 fullArgString+=yytext; |
|
3504 } |
|
3505 <CopyArgString,CopyArgPHPString>[^\n\\\"\']+ { *copyArgString+=yytext; |
|
3506 fullArgString+=yytext; |
|
3507 } |
|
3508 <CopyArgRound>[^\/\n\)\(\"\']+ { |
|
3509 *copyArgString+=yytext; |
|
3510 fullArgString+=yytext; |
|
3511 } |
|
3512 <ReadFuncArgType,ReadTempArgs>{BN}* { |
|
3513 *copyArgString+=" "; |
|
3514 fullArgString+=" "; |
|
3515 lineCount(); |
|
3516 } |
|
3517 <ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>\" { |
|
3518 *copyArgString+=*yytext; |
|
3519 fullArgString+=*yytext; |
|
3520 lastCopyArgStringContext = YY_START; |
|
3521 BEGIN( CopyArgString ); |
|
3522 } |
|
3523 <ReadFuncArgType,ReadTempArgs>"(" { |
|
3524 *copyArgString+=*yytext; |
|
3525 fullArgString+=*yytext; |
|
3526 argRoundCount=0; |
|
3527 lastCopyArgContext = YY_START; |
|
3528 BEGIN( CopyArgRound ); |
|
3529 } |
|
3530 <ReadFuncArgType>")" { |
|
3531 *copyArgString+=*yytext; |
|
3532 fullArgString+=*yytext; |
|
3533 stringToArgumentList(fullArgString,current->argList); |
|
3534 if (insideJS) |
|
3535 { |
|
3536 fixArgumentListForJavaScript(current->argList); |
|
3537 } |
|
3538 handleParametersCommentBlocks(current->argList); |
|
3539 |
|
3540 /* remember the current documentation block, since |
|
3541 we could overwrite it with the documentation of |
|
3542 a function argument, which we then have to correct later |
|
3543 on |
|
3544 */ |
|
3545 docBackup = current->doc; |
|
3546 briefBackup = current->brief; |
|
3547 |
|
3548 BEGIN( currentArgumentContext ); |
|
3549 } |
|
3550 /* a special comment */ |
|
3551 <ReadFuncArgType,ReadTempArgs>("/*"[*!]|"//"[/!])("<"?) { |
|
3552 if (currentArgumentContext==DefineEnd) |
|
3553 { |
|
3554 // for defines we interpret a comment |
|
3555 // as documentation for the define |
|
3556 int i;for (i=yyleng-1;i>=0;i--) |
|
3557 { |
|
3558 unput(yytext[i]); |
|
3559 } |
|
3560 stringToArgumentList(fullArgString,current->argList); |
|
3561 handleParametersCommentBlocks(current->argList); |
|
3562 BEGIN( currentArgumentContext ); |
|
3563 } |
|
3564 else // not a define |
|
3565 { |
|
3566 // for functions we interpret a comment |
|
3567 // as documentation for the argument |
|
3568 fullArgString+=yytext; |
|
3569 lastCopyArgChar=0; |
|
3570 lastCommentInArgContext=YY_START; |
|
3571 if (yytext[1]=='/') |
|
3572 BEGIN( CopyArgCommentLine ); |
|
3573 else |
|
3574 BEGIN( CopyArgComment ); |
|
3575 } |
|
3576 } |
|
3577 /* a non-special comment */ |
|
3578 <ReadFuncArgType,ReadTempArgs>"/**/" { /* empty comment */ } |
|
3579 <ReadFuncArgType,ReadTempArgs>"/*" { |
|
3580 lastCContext = YY_START; |
|
3581 BEGIN( SkipComment ); |
|
3582 } |
|
3583 <ReadFuncArgType,ReadTempArgs>"//" { |
|
3584 lastCContext = YY_START; |
|
3585 BEGIN( SkipCxxComment ); |
|
3586 } |
|
3587 /* |
|
3588 <ReadFuncArgType,ReadTempArgs>"'#" { if (insidePHP) |
|
3589 REJECT; |
|
3590 *copyArgString+=yytext; |
|
3591 fullArgString+=yytext; |
|
3592 } |
|
3593 <ReadFuncArgType,ReadTempArgs>"#" { |
|
3594 if (!insidePHP) |
|
3595 REJECT; |
|
3596 lastCContext = YY_START; |
|
3597 BEGIN( SkipCxxComment ); |
|
3598 } |
|
3599 */ |
|
3600 /* `)' followed by a special comment */ |
|
3601 <ReadFuncArgType>")"{BN}*("/*"[*!]|"//"[/!])"<" { |
|
3602 lineCount(); |
|
3603 if (currentArgumentContext==DefineEnd) |
|
3604 { |
|
3605 // for defines we interpret a comment |
|
3606 // as documentation for the define |
|
3607 int i;for (i=yyleng-1;i>0;i--) |
|
3608 { |
|
3609 unput(yytext[i]); |
|
3610 } |
|
3611 *copyArgString+=*yytext; |
|
3612 fullArgString+=*yytext; |
|
3613 stringToArgumentList(fullArgString,current->argList); |
|
3614 handleParametersCommentBlocks(current->argList); |
|
3615 BEGIN( currentArgumentContext ); |
|
3616 } |
|
3617 else |
|
3618 { |
|
3619 // for functions we interpret a comment |
|
3620 // as documentation for the last argument |
|
3621 lastCopyArgChar=*yytext; |
|
3622 QCString text=&yytext[1]; |
|
3623 text=text.stripWhiteSpace(); |
|
3624 lastCommentInArgContext=YY_START; |
|
3625 fullArgString+=text; |
|
3626 if (text.find("//")!=-1) |
|
3627 BEGIN( CopyArgCommentLine ); |
|
3628 else |
|
3629 BEGIN( CopyArgComment ); |
|
3630 } |
|
3631 } |
|
3632 <CopyArgComment>^{B}*"*"+/{BN}+ |
|
3633 <CopyArgComment>[^\n\\\@\*]+ { fullArgString+=yytext; } |
|
3634 <CopyArgComment>"*/" { fullArgString+=yytext; |
|
3635 if (lastCopyArgChar!=0) |
|
3636 unput(lastCopyArgChar); |
|
3637 BEGIN( lastCommentInArgContext ); |
|
3638 } |
|
3639 <CopyArgCommentLine>\n { fullArgString+=yytext; |
|
3640 yyLineNr++; |
|
3641 if (lastCopyArgChar!=0) |
|
3642 unput(lastCopyArgChar); |
|
3643 BEGIN( lastCommentInArgContext ); |
|
3644 } |
|
3645 <CopyArgCommentLine>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9] { // verbatim command (which could contain nested comments!) |
|
3646 docBlockName=&yytext[1]; |
|
3647 fullArgString+=yytext; |
|
3648 BEGIN(CopyArgVerbatim); |
|
3649 } |
|
3650 <CopyArgCommentLine>{CMD}("f$"|"f["|"f{") { |
|
3651 docBlockName=&yytext[1]; |
|
3652 if (docBlockName.at(1)=='[') |
|
3653 { |
|
3654 docBlockName.at(1)='}'; |
|
3655 } |
|
3656 if (docBlockName.at(1)=='{') |
|
3657 { |
|
3658 docBlockName.at(1)='}'; |
|
3659 } |
|
3660 fullArgString+=yytext; |
|
3661 BEGIN(CopyArgVerbatim); |
|
3662 } |
|
3663 <CopyArgVerbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9] { // end of verbatim block |
|
3664 fullArgString+=yytext; |
|
3665 if (yytext[1]=='f') // end of formula |
|
3666 { |
|
3667 BEGIN(CopyArgCommentLine); |
|
3668 } |
|
3669 if (&yytext[4]==docBlockName) |
|
3670 { |
|
3671 BEGIN(CopyArgCommentLine); |
|
3672 } |
|
3673 } |
|
3674 <CopyArgCommentLine>[^\\\@\n]+ { fullArgString+=yytext; } |
|
3675 <CopyArgCommentLine>. { fullArgString+=*yytext; } |
|
3676 <CopyArgComment,CopyArgVerbatim>\n { fullArgString+=*yytext; yyLineNr++; } |
|
3677 <CopyArgComment,CopyArgVerbatim>. { fullArgString+=*yytext; } |
|
3678 <CopyArgComment>{CMD}("brief"|"short"){B}+ { |
|
3679 warn(yyFileName,yyLineNr, |
|
3680 "Warning: Ignoring %cbrief command inside argument documentation",*yytext |
|
3681 ); |
|
3682 fullArgString+=' '; |
|
3683 } |
|
3684 <ReadTempArgs>"<" { |
|
3685 *copyArgString+=*yytext; |
|
3686 fullArgString+=*yytext; |
|
3687 argSharpCount=1; |
|
3688 BEGIN( CopyArgSharp ); |
|
3689 } |
|
3690 <ReadTempArgs>">" { |
|
3691 *copyArgString+=*yytext; |
|
3692 fullArgString+=*yytext; |
|
3693 //printf("end template list %s\n",copyArgString->data()); |
|
3694 stringToArgumentList(fullArgString,currentArgumentList); |
|
3695 BEGIN( currentArgumentContext ); |
|
3696 } |
|
3697 <CopyArgRound>"(" { |
|
3698 argRoundCount++; |
|
3699 *copyArgString+=*yytext; |
|
3700 fullArgString+=*yytext; |
|
3701 } |
|
3702 <CopyArgRound>")" { |
|
3703 *copyArgString+=*yytext; |
|
3704 fullArgString+=*yytext; |
|
3705 if (argRoundCount>0) |
|
3706 argRoundCount--; |
|
3707 else |
|
3708 BEGIN( lastCopyArgContext ); |
|
3709 } |
|
3710 <CopyArgSharp>"<" { |
|
3711 argSharpCount++; |
|
3712 //printf("argSharpCount++=%d copy\n",argSharpCount); |
|
3713 *copyArgString+=*yytext; |
|
3714 fullArgString+=*yytext; |
|
3715 } |
|
3716 <CopyArgSharp>">" { |
|
3717 *copyArgString+=*yytext; |
|
3718 fullArgString+=*yytext; |
|
3719 argSharpCount--; |
|
3720 if (argSharpCount>0) |
|
3721 { |
|
3722 //printf("argSharpCount--=%d copy\n",argSharpCount); |
|
3723 } |
|
3724 else |
|
3725 { |
|
3726 BEGIN( ReadTempArgs ); |
|
3727 //printf("end of argSharpCount\n"); |
|
3728 } |
|
3729 } |
|
3730 <CopyArgString,CopyArgPHPString>\\. { |
|
3731 *copyArgString+=yytext; |
|
3732 fullArgString+=yytext; |
|
3733 } |
|
3734 <CopyArgString>\" { |
|
3735 *copyArgString+=*yytext; |
|
3736 fullArgString+=*yytext; |
|
3737 BEGIN( lastCopyArgStringContext ); |
|
3738 } |
|
3739 <CopyArgPHPString>\' { |
|
3740 *copyArgString+=*yytext; |
|
3741 fullArgString+=*yytext; |
|
3742 BEGIN( lastCopyArgStringContext ); |
|
3743 } |
|
3744 <ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>{CHARLIT} { |
|
3745 if (insidePHP) |
|
3746 { |
|
3747 REJECT; |
|
3748 } |
|
3749 else |
|
3750 { |
|
3751 *copyArgString+=yytext; |
|
3752 fullArgString+=yytext; |
|
3753 } |
|
3754 } |
|
3755 <ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>\' { |
|
3756 *copyArgString+=yytext; |
|
3757 fullArgString+=yytext; |
|
3758 if (insidePHP) |
|
3759 { |
|
3760 lastCopyArgStringContext=YY_START; |
|
3761 BEGIN(CopyArgPHPString); |
|
3762 } |
|
3763 } |
|
3764 <ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>\n { |
|
3765 yyLineNr++; |
|
3766 *copyArgString+=*yytext; |
|
3767 fullArgString+=*yytext; |
|
3768 } |
|
3769 <ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>. { |
|
3770 *copyArgString+=*yytext; |
|
3771 fullArgString+=*yytext; |
|
3772 } |
|
3773 |
|
3774 |
|
3775 |
|
3776 /*------------------------------------------------------------------------*/ |
|
3777 |
|
3778 |
|
3779 <FuncRound>"(" { current->args += *yytext ; |
|
3780 ++roundCount ; |
|
3781 } |
|
3782 <FuncRound>")" { current->args += *yytext ; |
|
3783 if ( roundCount ) |
|
3784 --roundCount ; |
|
3785 else |
|
3786 BEGIN( FuncQual ) ; |
|
3787 } |
|
3788 /* |
|
3789 <FuncQual>"#" { if (insidePHP) |
|
3790 REJECT; |
|
3791 lastCPPContext = YY_START; |
|
3792 BEGIN(SkipCPP); |
|
3793 } |
|
3794 */ |
|
3795 <FuncQual>[{:;,] { |
|
3796 if ( strcmp(yytext,";")==0 && |
|
3797 insidePHP && |
|
3798 !containsWord(current->type,"function") ) |
|
3799 { |
|
3800 current->reset(); |
|
3801 initEntry(); |
|
3802 BEGIN( FindMembers ); |
|
3803 } |
|
3804 else |
|
3805 { |
|
3806 unput(*yytext); BEGIN( Function ); |
|
3807 } |
|
3808 } |
|
3809 <FuncQual>{BN}*"abstract"{BN}* { // pure virtual member function |
|
3810 lineCount() ; |
|
3811 current->virt = Pure; |
|
3812 current->args += " override "; |
|
3813 } |
|
3814 <FuncQual>{BN}*"override"{BN}* { // overridden virtual member function |
|
3815 lineCount() ; |
|
3816 current->spec |= Entry::Override; |
|
3817 current->args += " override "; |
|
3818 } |
|
3819 <FuncQual>{BN}*"sealed"{BN}* { // sealed member function |
|
3820 lineCount() ; |
|
3821 current->spec |= Entry::Sealed; |
|
3822 current->args += " sealed "; |
|
3823 } |
|
3824 <FuncQual>{BN}*"new"{BN}* { // new member function |
|
3825 lineCount() ; |
|
3826 current->spec |= Entry::New; |
|
3827 current->args += " new "; |
|
3828 } |
|
3829 <FuncQual>{BN}*"const"{BN}* { // const member function |
|
3830 lineCount() ; |
|
3831 current->args += " const "; |
|
3832 current->argList->constSpecifier=TRUE; |
|
3833 } |
|
3834 <FuncQual>{BN}*"volatile"{BN}* { // volatile member function |
|
3835 lineCount() ; |
|
3836 current->args += " volatile "; |
|
3837 current->argList->volatileSpecifier=TRUE; |
|
3838 } |
|
3839 <FuncQual>{BN}*"="{BN}*"0"{BN}* { // pure virtual member function |
|
3840 lineCount() ; |
|
3841 current->args += " = 0"; |
|
3842 current->virt = Pure; |
|
3843 current->argList->pureSpecifier=TRUE; |
|
3844 } |
|
3845 <FuncRound,FuncFunc>{BN}*","{BN}* { |
|
3846 lineCount() ; |
|
3847 current->args += ", " ; |
|
3848 } |
|
3849 <FuncQual,FuncRound,FuncFunc>{BN}+ { |
|
3850 lineCount() ; |
|
3851 current->args += ' ' ; |
|
3852 } |
|
3853 <Function,FuncQual,FuncRound,FuncFunc>"#" { if (insidePHP) |
|
3854 REJECT; |
|
3855 lastCPPContext = YY_START; |
|
3856 BEGIN(SkipCPP); |
|
3857 } |
|
3858 <FuncQual>"=" { |
|
3859 if (insideCli && |
|
3860 (current_root->section&Entry::COMPOUND_MASK) |
|
3861 ) |
|
3862 { |
|
3863 BEGIN(CliOverride); |
|
3864 } |
|
3865 else |
|
3866 { |
|
3867 // typically an initialized function pointer |
|
3868 lastInitializerContext=YY_START; |
|
3869 initBracketCount=0; |
|
3870 BEGIN(ReadInitializer); |
|
3871 } |
|
3872 } |
|
3873 <CliOverride>{ID} { |
|
3874 } |
|
3875 <CliOverride>"{" { |
|
3876 unput(*yytext); |
|
3877 BEGIN(FuncQual); |
|
3878 } |
|
3879 <CliOverride>\n { |
|
3880 yyLineNr++; |
|
3881 } |
|
3882 <CliOverride>. { |
|
3883 } |
|
3884 <FuncPtrInit>[{;] { |
|
3885 unput(*yytext); |
|
3886 BEGIN(FuncQual); |
|
3887 } |
|
3888 <FuncPtrInit>\" { |
|
3889 current->args += *yytext; |
|
3890 pCopyQuotedString=¤t->args; |
|
3891 lastStringContext=FuncPtrInit; |
|
3892 BEGIN(CopyString); |
|
3893 } |
|
3894 <FuncPtrInit>\' { |
|
3895 current->args += *yytext; |
|
3896 if (insidePHP) |
|
3897 { |
|
3898 pCopyQuotedString=¤t->args; |
|
3899 lastStringContext=FuncPtrInit; |
|
3900 BEGIN(CopyPHPString); |
|
3901 } |
|
3902 } |
|
3903 <FuncPtrInit>{CHARLIT} { |
|
3904 if (insidePHP) |
|
3905 { |
|
3906 REJECT; |
|
3907 } |
|
3908 else |
|
3909 { |
|
3910 current->args += yytext; |
|
3911 } |
|
3912 } |
|
3913 <FuncPtrInit>{ID} { |
|
3914 current->args += yytext; |
|
3915 } |
|
3916 <FuncPtrInit>. { |
|
3917 current->args += *yytext; |
|
3918 } |
|
3919 <FuncPtrInit>\n { |
|
3920 current->args += *yytext; |
|
3921 yyLineNr++; |
|
3922 } |
|
3923 <FuncQual>{ID} { // typically a K&R style C function |
|
3924 if (insideCS && strcmp(yytext,"where")==0) |
|
3925 { |
|
3926 // type contraint for a method |
|
3927 delete current->typeConstr; |
|
3928 current->typeConstr = new ArgumentList; |
|
3929 current->typeConstr->append(new Argument); |
|
3930 lastCSConstraint = YY_START; |
|
3931 BEGIN( CSConstraintName ); |
|
3932 } |
|
3933 else if (checkForKnRstyleC()) |
|
3934 { |
|
3935 //fprintf(stderr,"===> got a K&R style function\n"); |
|
3936 current->args = yytext; |
|
3937 oldStyleArgType.resize(0); |
|
3938 BEGIN(OldStyleArgs); |
|
3939 } |
|
3940 else |
|
3941 { |
|
3942 current->args += yytext; |
|
3943 } |
|
3944 } |
|
3945 <OldStyleArgs>[,;] { |
|
3946 QCString oldStyleArgPtr; |
|
3947 QCString oldStyleArgName; |
|
3948 splitKnRArg(oldStyleArgPtr,oldStyleArgName); |
|
3949 QCString doc,brief; |
|
3950 if (current->doc!=docBackup) |
|
3951 { |
|
3952 doc=current->doc.copy(); |
|
3953 current->doc=docBackup; |
|
3954 } |
|
3955 if (current->brief!=briefBackup) |
|
3956 { |
|
3957 brief=current->brief.copy(); |
|
3958 current->brief=briefBackup; |
|
3959 } |
|
3960 addKnRArgInfo(oldStyleArgType+oldStyleArgPtr, |
|
3961 oldStyleArgName,brief,doc); |
|
3962 current->args.resize(0); |
|
3963 if (*yytext==';') oldStyleArgType.resize(0); |
|
3964 } |
|
3965 <OldStyleArgs>{ID} { current->args += yytext; } |
|
3966 <OldStyleArgs>"{" { |
|
3967 current->args = argListToString(current->argList); |
|
3968 unput('{'); |
|
3969 BEGIN(FuncQual); |
|
3970 } |
|
3971 <OldStyleArgs>. { current->args += *yytext; } |
|
3972 <FuncQual,FuncRound,FuncFunc>. { current->args += *yytext; } |
|
3973 <FuncQual>{BN}*"try"{BN}+ { /* try-function-block */ |
|
3974 insideTryBlock=TRUE; |
|
3975 lineCount(); |
|
3976 } |
|
3977 <FuncQual>{BN}*"throw"{BN}*"(" { // C++ style throw clause |
|
3978 current->exception = " throw (" ; |
|
3979 roundCount=0; |
|
3980 lineCount() ; |
|
3981 BEGIN( ExcpRound ) ; |
|
3982 } |
|
3983 <FuncQual>{BN}*"raises"{BN}*"(" { |
|
3984 current->exception = " raises (" ; |
|
3985 lineCount() ; |
|
3986 roundCount=0; |
|
3987 BEGIN( ExcpRound ) ; |
|
3988 } |
|
3989 <FuncQual>{BN}*"throws"{BN}+ { // Java style throw clause |
|
3990 current->exception = " throws " ; |
|
3991 lineCount() ; |
|
3992 BEGIN( ExcpList ); |
|
3993 } |
|
3994 <ExcpRound>"(" { current->exception += *yytext ; |
|
3995 ++roundCount ; |
|
3996 } |
|
3997 <ExcpRound>")" { current->exception += *yytext ; |
|
3998 if ( roundCount ) |
|
3999 --roundCount ; |
|
4000 else |
|
4001 BEGIN( FuncQual ) ; |
|
4002 } |
|
4003 <ExcpRound>. { |
|
4004 current->exception += *yytext; |
|
4005 } |
|
4006 <ExcpList>"{" { |
|
4007 unput('{'); BEGIN( FuncQual ); |
|
4008 } |
|
4009 <ExcpList>";" { |
|
4010 unput(';'); BEGIN( FuncQual ); |
|
4011 } |
|
4012 <ExcpList>"\n" { |
|
4013 current->exception += ' '; |
|
4014 yyLineNr++; |
|
4015 } |
|
4016 <ExcpList>. { |
|
4017 current->exception += *yytext; |
|
4018 } |
|
4019 <Function>"(" { current->type += current->name ; |
|
4020 current->name = current->args ; |
|
4021 current->args = yytext ; |
|
4022 roundCount=0; |
|
4023 BEGIN( FuncRound ) ; |
|
4024 } |
|
4025 <Function>":" { |
|
4026 if (!insidePHP) BEGIN(SkipInits); |
|
4027 } |
|
4028 <Function>[;{,] { |
|
4029 current->name=current->name.simplifyWhiteSpace(); |
|
4030 current->type=current->type.simplifyWhiteSpace(); |
|
4031 current->args=removeRedundantWhiteSpace(current->args); |
|
4032 // was: current->args.simplifyWhiteSpace(); |
|
4033 current->fileName = yyFileName; |
|
4034 current->startLine = yyLineNr; |
|
4035 static QRegExp re("([^)]*\\[*&][^)]*)"); // (...*...) |
|
4036 if (*yytext!=';' || (current_root->section&Entry::COMPOUND_MASK) ) |
|
4037 { |
|
4038 int tempArg=current->name.find('<'); |
|
4039 QCString tempName; |
|
4040 if (tempArg==-1) tempName=current->name; else tempName=current->name.left(tempArg); |
|
4041 if (!current->type.isEmpty() && |
|
4042 (current->type.find(re,0)!=-1 || current->type.left(8)=="typedef ")) |
|
4043 { |
|
4044 //printf("Scanner.l: found in class variable: `%s' `%s' `%s'\n", current->type.data(),current->name.data(),current->args.data()); |
|
4045 current->section = Entry::VARIABLE_SEC ; |
|
4046 } |
|
4047 else |
|
4048 { |
|
4049 //printf("Scanner.l: found in class function: `%s' `%s' `%s'\n", current->type.data(),current->name.data(),current->args.data()); |
|
4050 current->section = Entry::FUNCTION_SEC ; |
|
4051 current->proto = *yytext==';'; |
|
4052 } |
|
4053 } |
|
4054 else // a global function prototype or function variable |
|
4055 { |
|
4056 //printf("Scanner.l: prototype? type=`%s' name=`%s' args=`%s'\n",current->type.data(),current->name.data(),current->args.data()); |
|
4057 if (!current->type.isEmpty() && |
|
4058 (current->type.find(re,0)!=-1 || current->type.left(8)=="typedef ")) |
|
4059 { |
|
4060 //printf("Scanner.l: found function variable!\n"); |
|
4061 current->section = Entry::VARIABLE_SEC; |
|
4062 } |
|
4063 else |
|
4064 { |
|
4065 //printf("Scanner.l: found prototype\n"); |
|
4066 current->section = Entry::FUNCTION_SEC; |
|
4067 current->proto = TRUE; |
|
4068 } |
|
4069 } |
|
4070 //printf("Adding entry `%s'\n",current->name.data()); |
|
4071 if ( insidePHP) |
|
4072 { |
|
4073 if (findAndRemoveWord(current->type,"final")) |
|
4074 { |
|
4075 current->spec |= Entry::Final; |
|
4076 } |
|
4077 if (findAndRemoveWord(current->type,"abstract")) |
|
4078 { |
|
4079 current->spec |= Entry::Abstract; |
|
4080 } |
|
4081 } |
|
4082 if ( insidePHP && !containsWord(current->type,"function")) |
|
4083 { |
|
4084 initEntry(); |
|
4085 if ( *yytext == '{' ) |
|
4086 { |
|
4087 lastCurlyContext = FindMembers; |
|
4088 curlyCount=0; |
|
4089 BEGIN( SkipCurly ); |
|
4090 } |
|
4091 else |
|
4092 { |
|
4093 BEGIN( FindMembers ); |
|
4094 } |
|
4095 } |
|
4096 else |
|
4097 { |
|
4098 if ( insidePHP) |
|
4099 { |
|
4100 findAndRemoveWord(current->type,"function"); |
|
4101 } |
|
4102 previous = current; |
|
4103 current_root->addSubEntry(current); |
|
4104 current = new Entry ; |
|
4105 initEntry(); |
|
4106 // Objective C 2.0: Required/Optional section |
|
4107 if (previous->spec & (Entry::Optional | Entry::Required)) |
|
4108 { |
|
4109 current->spec |= previous->spec & (Entry::Optional|Entry::Required); |
|
4110 } |
|
4111 lastCurlyContext = FindMembers; |
|
4112 if ( *yytext == ',' ) |
|
4113 { |
|
4114 current->type = previous->type.data(); |
|
4115 } |
|
4116 if ( *yytext == '{' ) |
|
4117 { |
|
4118 if ( !insidePHP && (current_root->section & Entry::COMPOUND_MASK) ) |
|
4119 { |
|
4120 previous->spec |= Entry::Inline; |
|
4121 } |
|
4122 //addToBody(yytext); |
|
4123 curlyCount=0; |
|
4124 BEGIN( SkipCurly ) ; |
|
4125 } |
|
4126 else |
|
4127 { |
|
4128 if (previous->section!=Entry::VARIABLE_SEC) |
|
4129 previous->bodyLine=-1; // a function/member declaration |
|
4130 BEGIN( FindMembers ) ; |
|
4131 } |
|
4132 } |
|
4133 } |
|
4134 <SkipInits>"{" { |
|
4135 //addToBody(yytext); |
|
4136 //lastCurlyContext = FindMembers; |
|
4137 //curlyCount=0; |
|
4138 //BEGIN( SkipCurly ) ; |
|
4139 unput('{'); |
|
4140 BEGIN( Function ); |
|
4141 } |
|
4142 <SkipCurly>"{" { |
|
4143 //addToBody(yytext); |
|
4144 ++curlyCount ; |
|
4145 } |
|
4146 <SkipCurly>"}" { |
|
4147 //addToBody(yytext); |
|
4148 if( curlyCount ) |
|
4149 { |
|
4150 --curlyCount ; |
|
4151 } |
|
4152 else |
|
4153 { |
|
4154 #if 0 |
|
4155 if (!Config_getBool("HIDE_IN_BODY_DOCS") && |
|
4156 !current->doc.isEmpty()) |
|
4157 { |
|
4158 // copy documentation found inside the body |
|
4159 // to the previous item |
|
4160 if (previous->inbodyLine==-1) |
|
4161 { |
|
4162 previous->inbodyLine = current->docLine; |
|
4163 previous->inbodyFile = current->docFile; |
|
4164 } |
|
4165 //printf("*** inbodyDocs+=%s\n",current->doc.data()); |
|
4166 previous->inbodyDocs += current->doc; |
|
4167 current->doc.resize(0); |
|
4168 } |
|
4169 #endif |
|
4170 if (current->sli && previous) // copy special list items |
|
4171 { |
|
4172 QListIterator<ListItemInfo> li(*current->sli); |
|
4173 ListItemInfo *lii; |
|
4174 for (li.toFirst();(lii=li.current());++li) |
|
4175 { |
|
4176 previous->addSpecialListItem(lii->type,lii->itemId); |
|
4177 } |
|
4178 delete current->sli; |
|
4179 current->sli = 0; |
|
4180 } |
|
4181 if (previous) previous->endBodyLine=yyLineNr; |
|
4182 BEGIN( lastCurlyContext ) ; |
|
4183 } |
|
4184 } |
|
4185 <SkipCurly>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { |
|
4186 lineCount(); |
|
4187 if ( curlyCount ) |
|
4188 { |
|
4189 //addToBody(yytext); |
|
4190 --curlyCount ; |
|
4191 } |
|
4192 else |
|
4193 { |
|
4194 current->endBodyLine=yyLineNr; |
|
4195 |
|
4196 tempEntry = current; // temporarily switch to the previous entry |
|
4197 current = previous; |
|
4198 |
|
4199 docBlockContext = SkipCurlyEndDoc; |
|
4200 docBlockInBody = FALSE; |
|
4201 docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) || |
|
4202 ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") ); |
|
4203 docBlock.resize(0); |
|
4204 docBlockTerm = '}'; |
|
4205 if (yytext[yyleng-3]=='/') |
|
4206 { |
|
4207 startCommentBlock(TRUE); |
|
4208 BEGIN( DocLine ); |
|
4209 } |
|
4210 else |
|
4211 { |
|
4212 startCommentBlock(FALSE); |
|
4213 BEGIN( DocBlock ); |
|
4214 } |
|
4215 } |
|
4216 } |
|
4217 <SkipCurlyEndDoc>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { // desc is followed by another one |
|
4218 docBlockContext = SkipCurlyEndDoc; |
|
4219 docBlockInBody = FALSE; |
|
4220 docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool("JAVADOC_AUTOBRIEF") ) || |
|
4221 ( yytext[yyleng-2]=='!' && Config_getBool("QT_AUTOBRIEF") ); |
|
4222 docBlock.resize(0); |
|
4223 docBlockTerm = '}'; |
|
4224 if (yytext[yyleng-3]=='/') |
|
4225 { |
|
4226 startCommentBlock(TRUE); |
|
4227 BEGIN( DocLine ); |
|
4228 } |
|
4229 else |
|
4230 { |
|
4231 startCommentBlock(FALSE); |
|
4232 BEGIN( DocBlock ); |
|
4233 } |
|
4234 } |
|
4235 <SkipCurlyEndDoc>"}" { |
|
4236 //addToBody("}"); |
|
4237 current = tempEntry; |
|
4238 BEGIN( lastCurlyContext ); |
|
4239 } |
|
4240 <SkipCurly>\" { |
|
4241 //addToBody(yytext); |
|
4242 lastStringContext=SkipCurly; |
|
4243 BEGIN( SkipString ); |
|
4244 } |
|
4245 <SkipCurly>^{B}*"#" { |
|
4246 if (insidePHP) |
|
4247 REJECT; |
|
4248 //addToBody(yytext); |
|
4249 BEGIN( SkipCurlyCpp ); |
|
4250 } |
|
4251 <SkipCurly,SkipInits>\n { |
|
4252 yyLineNr++; |
|
4253 //addToBody(yytext); |
|
4254 } |
|
4255 <SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}]+ { |
|
4256 //addToBody(yytext); |
|
4257 } |
|
4258 <SkipCurlyCpp>\n { |
|
4259 //addToBody(yytext); |
|
4260 yyLineNr++; |
|
4261 lastCurlyContext = FindMembers; |
|
4262 BEGIN( SkipCurly ); |
|
4263 } |
|
4264 <SkipCurlyCpp>\\[\r]*"\n"[\r]* { |
|
4265 //addToBody(yytext); |
|
4266 yyLineNr++; |
|
4267 } |
|
4268 <SkipInits,SkipCurly,SkipCurlyCpp>"/*" { |
|
4269 //addToBody(yytext); |
|
4270 lastCContext = YY_START; |
|
4271 BEGIN(SkipComment); |
|
4272 } |
|
4273 <SkipInits,SkipCurly,SkipCurlyCpp>"//" { |
|
4274 //addToBody(yytext); |
|
4275 lastCContext = YY_START; |
|
4276 BEGIN(SkipCxxComment); |
|
4277 } |
|
4278 <SkipInits>\" { |
|
4279 lastStringContext=YY_START; |
|
4280 BEGIN( SkipString ); |
|
4281 } |
|
4282 <SkipInits>; { |
|
4283 warn(yyFileName,yyLineNr, |
|
4284 "Warning: Found ';' while parsing initializer list! " |
|
4285 "(doxygen could be confused by a macro call without semicolon)" |
|
4286 ); |
|
4287 BEGIN( FindMembers ); |
|
4288 } |
|
4289 <SkipInits,SkipCurly,SkipCurlyCpp>"#" { |
|
4290 if (!insidePHP) |
|
4291 REJECT; |
|
4292 //addToBody(yytext); |
|
4293 lastCContext = YY_START; |
|
4294 BEGIN(SkipCxxComment); |
|
4295 } |
|
4296 <SkipInits,SkipCurly,SkipCurlyCpp>@\" { |
|
4297 if (!insideCS) REJECT; |
|
4298 // C# verbatim string |
|
4299 lastSkipVerbStringContext=YY_START; |
|
4300 pSkipVerbString=¤t->initializer; |
|
4301 BEGIN(SkipVerbString); |
|
4302 } |
|
4303 <SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT} { |
|
4304 if (insidePHP) REJECT; |
|
4305 } |
|
4306 <SkipInits,SkipCurly,SkipCurlyCpp>\' { |
|
4307 if (insidePHP) |
|
4308 { |
|
4309 lastStringContext=YY_START; |
|
4310 BEGIN(SkipPHPString); |
|
4311 } |
|
4312 } |
|
4313 <SkipInits,SkipCurly,SkipCurlyCpp>. { } |
|
4314 <SkipString,SkipPHPString>\\. { } |
|
4315 <SkipString>\" { |
|
4316 BEGIN( lastStringContext ); |
|
4317 } |
|
4318 <SkipPHPString>\' { |
|
4319 BEGIN( lastStringContext ); |
|
4320 } |
|
4321 <SkipString,SkipPHPString>"/*"|"*/"|"//" { } |
|
4322 <SkipString,SkipPHPString>\n { |
|
4323 yyLineNr++; |
|
4324 } |
|
4325 <SkipString,SkipPHPString>. { } |
|
4326 <Bases,CompoundName>";" { |
|
4327 current->section = Entry::EMPTY_SEC ; |
|
4328 current->type.resize(0) ; |
|
4329 current->name.resize(0) ; |
|
4330 current->args.resize(0) ; |
|
4331 current->argList->clear(); |
|
4332 BEGIN( FindMembers ) ; |
|
4333 } |
|
4334 <CompoundName>{SCOPENAME}{BN}*/"<" { |
|
4335 sharpCount = 0; |
|
4336 current->name = yytext ; |
|
4337 if (current->spec & Entry::Protocol) |
|
4338 { |
|
4339 current->name+="-p"; |
|
4340 } |
|
4341 lineCount(); |
|
4342 lastClassTemplSpecContext = ClassVar; |
|
4343 if (insideObjC) // protocol list |
|
4344 { |
|
4345 BEGIN( ObjCProtocolList ); |
|
4346 } |
|
4347 else if (insideCS) // C# generic class |
|
4348 { |
|
4349 BEGIN( CSGeneric ); |
|
4350 } |
|
4351 else // C++ template specialization |
|
4352 { |
|
4353 roundCount=0; |
|
4354 BEGIN( ClassTemplSpec ); |
|
4355 } |
|
4356 } |
|
4357 <CSGeneric>"<" { |
|
4358 if (current->tArgLists==0) |
|
4359 { |
|
4360 current->tArgLists = new QList<ArgumentList>; |
|
4361 current->tArgLists->setAutoDelete(TRUE); |
|
4362 } |
|
4363 ArgumentList *al = new ArgumentList; |
|
4364 current->spec |= Entry::Template; |
|
4365 current->tArgLists->append(al); |
|
4366 currentArgumentList = al; |
|
4367 templateStr="<"; |
|
4368 current->name += "<"; |
|
4369 fullArgString = templateStr; |
|
4370 copyArgString = ¤t->name; |
|
4371 currentArgumentContext = ClassVar; |
|
4372 BEGIN( ReadTempArgs ); |
|
4373 } |
|
4374 <ObjCProtocolList>"<" { |
|
4375 insideProtocolList=TRUE; |
|
4376 BEGIN( Bases ); |
|
4377 } |
|
4378 <ClassTemplSpec>">"({BN}*"::"{BN}*{SCOPENAME})? { |
|
4379 current->name += yytext; |
|
4380 lineCount(); |
|
4381 if (--sharpCount<=0) |
|
4382 { |
|
4383 current->name = removeRedundantWhiteSpace(current->name); |
|
4384 if (current->spec & Entry::Protocol) |
|
4385 { // Objective-C protocol |
|
4386 unput('{'); // fake start of body |
|
4387 BEGIN( ClassVar ); |
|
4388 } |
|
4389 else |
|
4390 { |
|
4391 BEGIN( lastClassTemplSpecContext ); |
|
4392 } |
|
4393 } |
|
4394 } |
|
4395 <ClassTemplSpec>"<" { |
|
4396 current->name += yytext; |
|
4397 sharpCount++; |
|
4398 } |
|
4399 <ClassTemplSpec>. { |
|
4400 current->name += yytext; |
|
4401 } |
|
4402 <CompoundName>{SCOPENAME}{BN}*";" { // forward declaration |
|
4403 unput(';'); |
|
4404 current->reset(); |
|
4405 if (isTypedef) // typedef of a class, put typedef keyword back |
|
4406 { |
|
4407 current->type.prepend("typedef"); |
|
4408 } |
|
4409 BEGIN( FindMembers ); |
|
4410 } |
|
4411 <CompoundName>{SCOPENAME}/"(" { |
|
4412 current->name = yytext ; |
|
4413 lineCount(); |
|
4414 if (current->spec & Entry::Protocol) |
|
4415 { |
|
4416 current->name += "-p"; |
|
4417 } |
|
4418 BEGIN( ClassVar ); |
|
4419 } |
|
4420 <CompoundName>{SCOPENAME}/{BN}*"," { // multiple forward declarations on one line |
|
4421 // e.g. @protocol A,B; |
|
4422 current->reset(); |
|
4423 } |
|
4424 <CompoundName>{SCOPENAME} { |
|
4425 current->name = yytext ; |
|
4426 lineCount(); |
|
4427 if (current->spec & Entry::Protocol) |
|
4428 { |
|
4429 current->name += "-p"; |
|
4430 } |
|
4431 if ((current->spec & Entry::Protocol) || |
|
4432 current->section == Entry::OBJCIMPL_SEC) |
|
4433 { |
|
4434 unput('{'); // fake start of body |
|
4435 } |
|
4436 BEGIN( ClassVar ); |
|
4437 } |
|
4438 <CompoundName>{CSSCOPENAME} { // C# style scope |
|
4439 current->name = substitute(yytext,".","::"); |
|
4440 lineCount(); |
|
4441 BEGIN( ClassVar ); |
|
4442 } |
|
4443 <ClassVar>{SCOPENAME}{BN}*/"(" { |
|
4444 if (insideIDL && strncmp(yytext,"switch",6)==0 && !isId(yytext[6])) |
|
4445 { |
|
4446 // Corba IDL style union |
|
4447 roundCount=0; |
|
4448 BEGIN(SkipUnionSwitch); |
|
4449 } |
|
4450 else |
|
4451 { |
|
4452 addType(current); |
|
4453 current->name = yytext; |
|
4454 current->name = current->name.stripWhiteSpace(); |
|
4455 lineCount(); |
|
4456 BEGIN( FindMembers ); |
|
4457 } |
|
4458 } |
|
4459 <ClassVar>"," { |
|
4460 if (isTypedef) |
|
4461 { |
|
4462 // multiple types in one typedef |
|
4463 unput(','); |
|
4464 current->type.prepend("typedef "); |
|
4465 BEGIN(FindMembers); |
|
4466 } |
|
4467 else |
|
4468 { |
|
4469 // Multiple class forward declaration |
|
4470 } |
|
4471 } |
|
4472 <ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") { |
|
4473 if (insideCli) |
|
4474 { |
|
4475 if (yytext[0]=='s') // sealed |
|
4476 current->spec |= Entry::SealedClass; |
|
4477 else // abstract |
|
4478 current->spec |= Entry::AbstractClass; |
|
4479 BEGIN( ClassVar ); |
|
4480 } |
|
4481 else |
|
4482 { |
|
4483 REJECT; |
|
4484 } |
|
4485 } |
|
4486 <ClassVar>{ID} { |
|
4487 if (insideIDL && strcmp(yytext,"switch")==0) |
|
4488 { |
|
4489 // Corba IDL style union |
|
4490 roundCount=0; |
|
4491 BEGIN(SkipUnionSwitch); |
|
4492 } |
|
4493 else if ((insideJava || insidePHP || insideJS) && (strcmp(yytext,"implements")==0 || strcmp(yytext,"extends")==0)) |
|
4494 { |
|
4495 current->type.resize(0); |
|
4496 baseProt=Public; |
|
4497 baseVirt=Normal; |
|
4498 baseName.resize(0); |
|
4499 BEGIN( BasesProt ) ; |
|
4500 } |
|
4501 else if (insideCS && strcmp(yytext,"where")==0) // C# type contraint |
|
4502 { |
|
4503 delete current->typeConstr; |
|
4504 current->typeConstr = new ArgumentList; |
|
4505 current->typeConstr->append(new Argument); |
|
4506 lastCSConstraint = YY_START; |
|
4507 BEGIN( CSConstraintName ); |
|
4508 } |
|
4509 else if (insideCli && strcmp(yytext,"abstract")) |
|
4510 { |
|
4511 current->spec|=Entry::Abstract; |
|
4512 } |
|
4513 else if (insideCli && strcmp(yytext,"sealed")) |
|
4514 { |
|
4515 current->spec|=Entry::Sealed; |
|
4516 } |
|
4517 else |
|
4518 { |
|
4519 if (current->section == Entry::ENUM_SEC) |
|
4520 { // found "enum a b" -> variable |
|
4521 current->section = Entry::VARIABLE_SEC ; |
|
4522 } |
|
4523 current->type += ' ' ; |
|
4524 current->type += current->name ; |
|
4525 current->name = yytext ; |
|
4526 |
|
4527 if (nameIsOperator(current->name)) |
|
4528 { |
|
4529 BEGIN( Operator ); |
|
4530 } |
|
4531 } |
|
4532 } |
|
4533 <ClassVar>[(\[] { |
|
4534 if (insideObjC && *yytext=='(') // class category |
|
4535 { |
|
4536 current->name+='('; |
|
4537 if (current->section!=Entry::OBJCIMPL_SEC) |
|
4538 { |
|
4539 current->spec|=Entry::Category; |
|
4540 } |
|
4541 BEGIN( ClassCategory ); |
|
4542 } |
|
4543 else |
|
4544 { |
|
4545 // probably a function anyway |
|
4546 unput(*yytext); |
|
4547 BEGIN( FindMembers ); |
|
4548 } |
|
4549 } |
|
4550 <CSConstraintType,CSConstraintName>"/**/" { /* empty comment */ } |
|
4551 <CSConstraintType,CSConstraintName>("/*"[*!]|"//"[/!])("<"?) { // special comment |
|
4552 fullArgString.resize(0); |
|
4553 lastCopyArgChar='#'; // end marker |
|
4554 lastCommentInArgContext=YY_START; |
|
4555 if (yytext[1]=='/') |
|
4556 BEGIN( CopyArgCommentLine ); |
|
4557 else |
|
4558 BEGIN( CopyArgComment ); |
|
4559 } |
|
4560 <CSConstraintType,CSConstraintName>"#" { // artifically inserted token to signal end of comment block |
|
4561 current->typeConstr->last()->docs = fullArgString; |
|
4562 } |
|
4563 <CSConstraintType>"{" { // end of type constraint reached |
|
4564 // parse documentation of the constraints |
|
4565 handleParametersCommentBlocks(current->typeConstr); |
|
4566 unput('{'); |
|
4567 BEGIN( lastCSConstraint ); |
|
4568 } |
|
4569 <CSConstraintType,CSConstraintName>";" { |
|
4570 handleParametersCommentBlocks(current->typeConstr); |
|
4571 unput(';'); |
|
4572 BEGIN( lastCSConstraint ); |
|
4573 } |
|
4574 <CSConstraintName>":" { |
|
4575 BEGIN( CSConstraintType ); |
|
4576 } |
|
4577 <CSConstraintName>{ID} { |
|
4578 // parameter name |
|
4579 current->typeConstr->last()->name=yytext; |
|
4580 } |
|
4581 <CSConstraintType>"where" { // another constraint for a different param |
|
4582 current->typeConstr->append(new Argument); |
|
4583 BEGIN( CSConstraintName ); |
|
4584 } |
|
4585 <CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")? { |
|
4586 if (current->typeConstr->last()->type.isEmpty()) |
|
4587 // first type constraint for this parameter |
|
4588 { |
|
4589 current->typeConstr->last()->type=yytext; |
|
4590 } |
|
4591 else // new type constraint for same parameter |
|
4592 { |
|
4593 QCString name = current->typeConstr->last()->name; |
|
4594 current->typeConstr->append(new Argument); |
|
4595 current->typeConstr->last()->name=name; |
|
4596 current->typeConstr->last()->type=yytext; |
|
4597 } |
|
4598 } |
|
4599 <CSConstraintName,CSConstraintType>\n { |
|
4600 yyLineNr++; |
|
4601 } |
|
4602 <CSConstraintName,CSConstraintType>. { |
|
4603 } |
|
4604 <ClassCategory>{ID} { |
|
4605 current->name+=yytext; |
|
4606 } |
|
4607 <ClassCategory>")" { |
|
4608 current->name+=')'; |
|
4609 if ((current->section & Entry::Protocol) || |
|
4610 current->section == Entry::OBJCIMPL_SEC) |
|
4611 { |
|
4612 unput('{'); // fake start of body |
|
4613 } |
|
4614 else // category has no variables so push back an empty body |
|
4615 { |
|
4616 unput('}'); |
|
4617 unput('{'); |
|
4618 } |
|
4619 BEGIN( ClassVar ); |
|
4620 } |
|
4621 <ClassVar>":" { |
|
4622 current->type.resize(0); |
|
4623 if ((current->spec & Entry::Interface) || |
|
4624 (current->spec & Entry::Struct) || |
|
4625 (current->spec & Entry::Ref) || |
|
4626 (current->spec & Entry::Value) || |
|
4627 insidePHP || insideCS || insideD || insideObjC |
|
4628 ) |
|
4629 baseProt=Public; |
|
4630 else |
|
4631 baseProt=Private; |
|
4632 baseVirt=Normal; |
|
4633 baseName.resize(0); |
|
4634 BEGIN( BasesProt ) ; |
|
4635 } |
|
4636 <ClassVar>[;=*&] { |
|
4637 unput(*yytext); |
|
4638 if (isTypedef) // typedef of a class, put typedef keyword back |
|
4639 { |
|
4640 current->type.prepend("typedef"); |
|
4641 } |
|
4642 BEGIN( FindMembers ); |
|
4643 } |
|
4644 <Bases,ClassVar>"///"/[^/] { |
|
4645 if (!insideObjC) |
|
4646 { |
|
4647 REJECT; |
|
4648 } |
|
4649 else |
|
4650 { |
|
4651 lineCount(); |
|
4652 current->program+=yytext; |
|
4653 current->fileName = yyFileName ; |
|
4654 current->startLine = yyLineNr ; |
|
4655 curlyCount=0; |
|
4656 BEGIN( ReadBodyIntf ); |
|
4657 } |
|
4658 } |
|
4659 <Bases,ClassVar>("//"{B}*)?"/**"/[^/*] | |
|
4660 <Bases,ClassVar>("//"{B}*)?"/*!" | |
|
4661 <Bases,ClassVar>"//!" | |
|
4662 <Bases,ClassVar>[\-+]{BN}* { |
|
4663 if (!insideObjC) |
|
4664 { |
|
4665 REJECT; |
|
4666 } |
|
4667 else |
|
4668 { |
|
4669 lineCount(); |
|
4670 current->program+=yytext; |
|
4671 current->fileName = yyFileName ; |
|
4672 current->startLine = yyLineNr ; |
|
4673 curlyCount=0; |
|
4674 BEGIN( ReadBodyIntf ); |
|
4675 } |
|
4676 } |
|
4677 <CompoundName,ClassVar>{B}*"{"{B}* { |
|
4678 current->fileName = yyFileName ; |
|
4679 current->startLine = yyLineNr ; |
|
4680 current->name = removeRedundantWhiteSpace(current->name); |
|
4681 if (current->name.isEmpty() && !isTypedef) // anonymous compound |
|
4682 { |
|
4683 if (current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces |
|
4684 { |
|
4685 if (Config_getBool("EXTRACT_ANON_NSPACES")) // use visible name |
|
4686 { |
|
4687 current->name="anonymous_namespace{"+stripPath(current->fileName)+"}"; |
|
4688 } |
|
4689 else // use invisible name |
|
4690 { |
|
4691 current->name.sprintf("@%d",anonNSCount); |
|
4692 } |
|
4693 } |
|
4694 else |
|
4695 { |
|
4696 current->name.sprintf("@%d",anonCount++); |
|
4697 } |
|
4698 } |
|
4699 curlyCount=0; |
|
4700 if (current_root && // not a nested struct inside an @interface section |
|
4701 !(current_root->spec & Entry::Interface) && |
|
4702 ((current->spec & (Entry::Interface | Entry::Protocol | Entry::Category) || |
|
4703 current->section==Entry::OBJCIMPL_SEC) |
|
4704 ) && |
|
4705 insideObjC |
|
4706 ) |
|
4707 { // ObjC body that ends with @end |
|
4708 BEGIN( ReadBodyIntf ); |
|
4709 } |
|
4710 else if (current->section==Entry::NAMESPACE_SEC) |
|
4711 { // namespace body |
|
4712 BEGIN( ReadNSBody ); |
|
4713 } |
|
4714 else |
|
4715 { // class body |
|
4716 BEGIN( ReadBody ) ; |
|
4717 } |
|
4718 } |
|
4719 <BasesProt>"virtual"{BN}+ { lineCount(); baseVirt = Virtual; } |
|
4720 <BasesProt>"public"{BN}+ { lineCount(); baseProt = Public; } |
|
4721 <BasesProt>"protected"{BN}+ { lineCount(); baseProt = Protected; } |
|
4722 <BasesProt>"private"{BN}+ { lineCount(); baseProt = Private; } |
|
4723 <BasesProt>{BN} { lineCount(); } |
|
4724 <BasesProt>. { unput(*yytext); BEGIN(Bases); } |
|
4725 <Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID} { |
|
4726 QCString baseScope = yytext; |
|
4727 if (insideCS && baseScope.stripWhiteSpace()=="where") |
|
4728 { |
|
4729 // type contraint for a class |
|
4730 delete current->typeConstr; |
|
4731 current->typeConstr = new ArgumentList; |
|
4732 current->typeConstr->append(new Argument); |
|
4733 lastCSConstraint = YY_START; |
|
4734 BEGIN( CSConstraintName ); |
|
4735 } |
|
4736 else |
|
4737 { |
|
4738 baseName+=yytext; |
|
4739 current->args += ' '; |
|
4740 current->args += yytext; |
|
4741 } |
|
4742 } |
|
4743 <Bases>{BN}*{ID}("."{ID})* { // Java style class |
|
4744 QCString name = substitute(yytext,".","::"); |
|
4745 baseName += name; |
|
4746 current->args += ' '; |
|
4747 current->args += name; |
|
4748 } |
|
4749 <ClassVar,Bases>\n/{BN}*[^{, \t\n] { |
|
4750 if (!insideObjC) |
|
4751 { |
|
4752 REJECT; |
|
4753 } |
|
4754 else |
|
4755 { |
|
4756 yyLineNr++; |
|
4757 unput('{'); |
|
4758 } |
|
4759 } |
|
4760 <ClassVar,Bases>"@end" { // empty ObjC interface |
|
4761 unput('d'); // insert fake body: {}@end |
|
4762 unput('n'); |
|
4763 unput('e'); |
|
4764 unput('@'); |
|
4765 unput('}'); |
|
4766 unput('{'); |
|
4767 } |
|
4768 <ClassVar>"<" { current->name += *yytext; |
|
4769 sharpCount=1; |
|
4770 roundCount=0; |
|
4771 lastSkipSharpContext = YY_START; |
|
4772 specName = ¤t->name; |
|
4773 BEGIN ( Specialization ); |
|
4774 } |
|
4775 <Bases>"<" { |
|
4776 sharpCount=1; |
|
4777 roundCount=0; |
|
4778 lastSkipSharpContext = YY_START; |
|
4779 if (insideObjC) // start of protocol list |
|
4780 { |
|
4781 unput(','); |
|
4782 } |
|
4783 else // template specialization |
|
4784 { |
|
4785 baseName += *yytext; |
|
4786 specName = &baseName; |
|
4787 BEGIN ( Specialization ); |
|
4788 } |
|
4789 } |
|
4790 <Specialization>"<" { *specName += *yytext; |
|
4791 if (roundCount==0) sharpCount++; |
|
4792 } |
|
4793 <Specialization>">" { |
|
4794 *specName += *yytext; |
|
4795 if (roundCount==0 && --sharpCount<=0) |
|
4796 BEGIN(lastSkipSharpContext); |
|
4797 } |
|
4798 <Specialization>{BN}+ { lineCount(); *specName +=' '; } |
|
4799 <Specialization>"<<" { *specName += yytext; } |
|
4800 <Specialization>">>"/{B}*"::" { // M$ C++ extension to allow >> to close a template... |
|
4801 unput('>'); |
|
4802 unput(' '); |
|
4803 unput('>'); |
|
4804 } |
|
4805 <Specialization>">>" { |
|
4806 if (insideCS) // for C# >> ends a nested template |
|
4807 { |
|
4808 REJECT; |
|
4809 } |
|
4810 else // for C++ >> is a bitshift |
|
4811 // operator and > > would end |
|
4812 // a nested template. |
|
4813 // We require the bitshift to be enclosed in braces. |
|
4814 // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html |
|
4815 { |
|
4816 if (roundCount>0) |
|
4817 { |
|
4818 *specName += yytext; |
|
4819 } |
|
4820 else |
|
4821 { |
|
4822 unput('>'); |
|
4823 unput(' '); |
|
4824 unput('>'); |
|
4825 } |
|
4826 } |
|
4827 } |
|
4828 <Specialization>"typename"{BN}+ { lineCount(); } |
|
4829 <Specialization>"(" { *specName += *yytext; roundCount++; } |
|
4830 <Specialization>")" { *specName += *yytext; roundCount--; } |
|
4831 <Specialization>. { |
|
4832 *specName += *yytext; |
|
4833 } |
|
4834 <SkipSharp>"<" { ++sharpCount; } |
|
4835 <SkipSharp>">" { if (--sharpCount<=0) |
|
4836 BEGIN ( lastSkipSharpContext ); |
|
4837 } |
|
4838 <SkipRound>"(" { ++roundCount; } |
|
4839 <SkipRound>")" { if (--roundCount<=0) |
|
4840 BEGIN ( lastSkipRoundContext ); |
|
4841 } |
|
4842 <Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*) { lineCount(); |
|
4843 if (insideProtocolList) |
|
4844 { |
|
4845 baseName+="-p"; |
|
4846 } |
|
4847 else |
|
4848 { |
|
4849 current->args += ',' ; |
|
4850 } |
|
4851 current->name = removeRedundantWhiteSpace(current->name); |
|
4852 if (!baseName.isEmpty()) |
|
4853 { |
|
4854 current->extends->append( |
|
4855 new BaseInfo(baseName,baseProt,baseVirt) |
|
4856 ); |
|
4857 } |
|
4858 if ((current->spec & Entry::Interface) || |
|
4859 insideJava || insidePHP || insideCS || |
|
4860 insideD || insideObjC) |
|
4861 { |
|
4862 baseProt=Public; |
|
4863 } |
|
4864 else |
|
4865 { |
|
4866 baseProt=Private; |
|
4867 } |
|
4868 baseVirt=Normal; |
|
4869 baseName.resize(0); |
|
4870 if (*yytext=='>') |
|
4871 { // end of a ObjC protocol list |
|
4872 insideProtocolList=FALSE; |
|
4873 if (yyleng==1) |
|
4874 { |
|
4875 unput('{'); // dummy start body |
|
4876 } |
|
4877 else |
|
4878 { |
|
4879 yyless(1); |
|
4880 } |
|
4881 } |
|
4882 else |
|
4883 { |
|
4884 if (*yytext==',' && insideObjC) // Begin of protocol list |
|
4885 { |
|
4886 insideProtocolList=TRUE; |
|
4887 } |
|
4888 BEGIN(BasesProt); |
|
4889 } |
|
4890 } |
|
4891 <Bases>{B}*"{"{B}* { current->fileName = yyFileName ; |
|
4892 current->startLine = yyLineNr ; |
|
4893 current->name = removeRedundantWhiteSpace(current->name); |
|
4894 if (!baseName.isEmpty()) |
|
4895 current->extends->append( |
|
4896 new BaseInfo(baseName,baseProt,baseVirt) |
|
4897 ); |
|
4898 curlyCount=0; |
|
4899 if (insideObjC) |
|
4900 { |
|
4901 BEGIN( ReadBodyIntf ); |
|
4902 } |
|
4903 else |
|
4904 { |
|
4905 BEGIN( ReadBody ) ; |
|
4906 } |
|
4907 } |
|
4908 <SkipUnionSwitch>{B}*"(" { |
|
4909 roundCount++; |
|
4910 } |
|
4911 <SkipUnionSwitch>")" { |
|
4912 if (--roundCount==0) |
|
4913 { |
|
4914 BEGIN(ClassVar); |
|
4915 } |
|
4916 } |
|
4917 <SkipUnionSwitch>\n { yyLineNr++; } |
|
4918 <SkipUnionSwitch>. |
|
4919 <Comment>{BN}+ { current->program += yytext ; |
|
4920 lineCount() ; |
|
4921 } |
|
4922 <Comment>"/*" { current->program += yytext ; } |
|
4923 <Comment>"//" { current->program += yytext ; } |
|
4924 <Comment>{CMD}("code"|"verbatim") { |
|
4925 insideCode=TRUE; |
|
4926 current->program += yytext ; |
|
4927 } |
|
4928 <Comment>{CMD}("endcode"|"endverbatim") { |
|
4929 insideCode=FALSE; |
|
4930 current->program += yytext ; |
|
4931 } |
|
4932 <Comment>[^ \.\t\r\n\/\*]+ { current->program += yytext ; } |
|
4933 <Comment>"*/" { current->program += yytext ; |
|
4934 if (!insideCode) BEGIN( lastContext ) ; |
|
4935 } |
|
4936 <Comment>. { current->program += *yytext ; } |
|
4937 |
|
4938 <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/*!" { |
|
4939 //printf("Start doc block at %d\n",yyLineNr); |
|
4940 removeSlashes=(yytext[1]=='/'); |
|
4941 tmpDocType=-1; |
|
4942 if (!current->doc.isEmpty()) |
|
4943 { |
|
4944 current->doc+="\n\n"; |
|
4945 } |
|
4946 else |
|
4947 { |
|
4948 current->docLine = yyLineNr; |
|
4949 current->docFile = yyFileName; |
|
4950 } |
|
4951 |
|
4952 lastDocContext = YY_START; |
|
4953 if (current_root->section & Entry::SCOPE_MASK) |
|
4954 { |
|
4955 current->inside = current_root->name+"::"; |
|
4956 } |
|
4957 docBlockContext = YY_START; |
|
4958 docBlockInBody = YY_START==SkipCurly; |
|
4959 docBlockAutoBrief = Config_getBool("QT_AUTOBRIEF"); |
|
4960 docBlock.resize(0); |
|
4961 if (docBlockAutoBrief) |
|
4962 { |
|
4963 current->briefLine = yyLineNr; |
|
4964 current->briefFile = yyFileName; |
|
4965 } |
|
4966 startCommentBlock(FALSE); |
|
4967 BEGIN( DocBlock ); |
|
4968 } |
|
4969 <FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/**"/[^/*] { |
|
4970 removeSlashes=(yytext[1]=='/'); |
|
4971 lastDocContext = YY_START; |
|
4972 |
|
4973 //printf("Found comment block at %s:%d\n",yyFileName,yyLineNr); |
|
4974 if (current_root->section & Entry::SCOPE_MASK) |
|
4975 { |
|
4976 current->inside = current_root->name+"::"; |
|
4977 } |
|
4978 current->docLine = yyLineNr; |
|
4979 current->docFile = yyFileName; |
|
4980 docBlockContext = YY_START; |
|
4981 docBlockInBody = YY_START==SkipCurly; |
|
4982 docBlockAutoBrief = Config_getBool("JAVADOC_AUTOBRIEF"); |
|
4983 docBlock.resize(0); |
|
4984 if (docBlockAutoBrief) |
|
4985 { |
|
4986 current->briefLine = yyLineNr; |
|
4987 current->briefFile = yyFileName; |
|
4988 } |
|
4989 startCommentBlock(FALSE); |
|
4990 BEGIN( DocBlock ); |
|
4991 } |
|
4992 <FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"//!" { |
|
4993 tmpDocType=-1; |
|
4994 lastDocContext = YY_START; |
|
4995 if (current_root->section & Entry::SCOPE_MASK) |
|
4996 { |
|
4997 current->inside = current_root->name+"::"; |
|
4998 } |
|
4999 docBlockContext = YY_START; |
|
5000 docBlockInBody = YY_START==SkipCurly; |
|
5001 docBlockAutoBrief = FALSE; |
|
5002 docBlock.resize(0); |
|
5003 startCommentBlock(current->brief.isEmpty()); |
|
5004 BEGIN( DocLine ); |
|
5005 } |
|
5006 <FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"///"/[^/] { |
|
5007 tmpDocType=-1; |
|
5008 lastDocContext = YY_START; |
|
5009 if (current_root->section & Entry::SCOPE_MASK) |
|
5010 { |
|
5011 current->inside = current_root->name+"::"; |
|
5012 } |
|
5013 docBlockContext = YY_START; |
|
5014 docBlockInBody = YY_START==SkipCurly; |
|
5015 docBlockAutoBrief = FALSE; |
|
5016 docBlock.resize(0); |
|
5017 startCommentBlock(current->brief.isEmpty()); |
|
5018 BEGIN( DocLine ); |
|
5019 } |
|
5020 <FindMembers>"extern"{BN}*"\"C"("++")?"\""{BN}*("{")? { |
|
5021 lineCount(); |
|
5022 externC=TRUE; |
|
5023 } |
|
5024 <FindMembers>"{" { |
|
5025 if (externC) |
|
5026 { |
|
5027 externC=FALSE; |
|
5028 } |
|
5029 else if (insideCS && |
|
5030 !current->name.isEmpty() && |
|
5031 !current->type.isEmpty()) |
|
5032 { |
|
5033 if (containsWord(current->type,"event")) // event |
|
5034 { |
|
5035 current->mtype = mtype = Event; |
|
5036 } |
|
5037 else // property |
|
5038 { |
|
5039 current->mtype = mtype = Property; |
|
5040 } |
|
5041 current->bodyLine = yyLineNr; |
|
5042 curlyCount=0; |
|
5043 BEGIN( CSAccessorDecl ); |
|
5044 } |
|
5045 else |
|
5046 { |
|
5047 if ((insideJava || insideCS || insideD) && |
|
5048 current->name.isEmpty() |
|
5049 ) |
|
5050 { |
|
5051 // static Java initializer |
|
5052 needsSemi = FALSE; |
|
5053 if (current->stat) |
|
5054 { |
|
5055 current->name="[static initializer]"; |
|
5056 current->type.resize(0); |
|
5057 } |
|
5058 else |
|
5059 { |
|
5060 current->name="[instance initializer]"; |
|
5061 } |
|
5062 unput(*yytext); |
|
5063 BEGIN( Function ); |
|
5064 } |
|
5065 else |
|
5066 { |
|
5067 needsSemi = TRUE; |
|
5068 current->type.resize(0); |
|
5069 current->name.resize(0); |
|
5070 current->args.resize(0); |
|
5071 current->argList->clear(); |
|
5072 curlyCount=0; |
|
5073 BEGIN( SkipCurlyBlock ); |
|
5074 } |
|
5075 } |
|
5076 } |
|
5077 <CSAccessorDecl>"{" { curlyCount++; } |
|
5078 <CSAccessorDecl>"}" { |
|
5079 if (curlyCount) |
|
5080 { |
|
5081 curlyCount--; |
|
5082 } |
|
5083 else |
|
5084 { |
|
5085 mtype = Method; |
|
5086 unput(';'); |
|
5087 BEGIN(FindMembers); |
|
5088 } |
|
5089 } |
|
5090 <CSAccessorDecl>"set" { if (curlyCount==0) current->spec |= Entry::Settable; } |
|
5091 <CSAccessorDecl>"get" { if (curlyCount==0) current->spec |= Entry::Gettable; } |
|
5092 <CSAccessorDecl>"add" { if (curlyCount==0) current->spec |= Entry::Addable; } |
|
5093 <CSAccessorDecl>"remove" { if (curlyCount==0) current->spec |= Entry::Removable; } |
|
5094 <CSAccessorDecl>"raise" { if (curlyCount==0) current->spec |= Entry::Raisable; } |
|
5095 <CSAccessorDecl>. {} |
|
5096 <CSAccessorDecl>\n { yyLineNr++; } |
|
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 /**********************************************************************************/ |
|
5102 /******************** Documentation block related rules ***************************/ |
|
5103 /**********************************************************************************/ |
|
5104 |
|
5105 /* ---- Single line comments ------ */ |
|
5106 <DocLine>[^\n]*"\n"[ \t]*"//"[/!] { // continuation of multiline C++-style comment |
|
5107 docBlock+=yytext; |
|
5108 docBlock.resize(docBlock.size() - 3); |
|
5109 yyLineNr++; |
|
5110 } |
|
5111 <DocLine>[^\n]*/"\n" { // whole line |
|
5112 docBlock+=yytext; |
|
5113 handleCommentBlock(docBlock,current->brief.isEmpty()); |
|
5114 BEGIN( docBlockContext ); |
|
5115 } |
|
5116 |
|
5117 /* ---- Comments blocks ------ */ |
|
5118 |
|
5119 <DocBlock>"*"*"*/" { // end of comment block |
|
5120 handleCommentBlock(docBlock,FALSE); |
|
5121 BEGIN(docBlockContext); |
|
5122 } |
|
5123 <DocBlock>^{B}*("//")?{B}*"*"+/[^//] { // start of a comment line |
|
5124 } |
|
5125 <DocBlock>^{B}*("//"){B}* { // strip embedded C++ comments if at the start of a line |
|
5126 } |
|
5127 <DocBlock>"//" { // slashes in the middle of a comment block |
|
5128 docBlock+=yytext; |
|
5129 } |
|
5130 <DocBlock>"/*" { // start of a new comment in the |
|
5131 // middle of a comment block |
|
5132 docBlock+=yytext; |
|
5133 } |
|
5134 <DocBlock>("@@"|"\\\\"){ID}/[^a-z_A-Z0-9] { // escaped command |
|
5135 docBlock+=yytext; |
|
5136 } |
|
5137 <DocBlock>{CMD}("f$"|"f["|"f{") { |
|
5138 docBlock+=yytext; |
|
5139 docBlockName=&yytext[1]; |
|
5140 if (docBlockName.at(1)=='{') |
|
5141 { |
|
5142 docBlockName.at(1)='}'; |
|
5143 } |
|
5144 BEGIN(DocCopyBlock); |
|
5145 } |
|
5146 <DocBlock>"<"{PRE}">" { |
|
5147 docBlock+=yytext; |
|
5148 docBlockName="<pre>"; |
|
5149 BEGIN(DocCopyBlock); |
|
5150 } |
|
5151 <DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9] { // verbatim command (which could contain nested comments!) |
|
5152 docBlock+=yytext; |
|
5153 docBlockName=&yytext[1]; |
|
5154 BEGIN(DocCopyBlock); |
|
5155 } |
|
5156 <DocBlock>{B}*"<code>" { |
|
5157 if (insideCS) |
|
5158 { |
|
5159 docBlock+=yytext; |
|
5160 docBlockName="<code>"; |
|
5161 BEGIN(DocCopyBlock); |
|
5162 } |
|
5163 else |
|
5164 { |
|
5165 REJECT; |
|
5166 } |
|
5167 } |
|
5168 <DocBlock>[^@*\/\\\n]+ { // any character that isn't special |
|
5169 docBlock+=yytext; |
|
5170 } |
|
5171 <DocBlock>\n { // newline |
|
5172 yyLineNr++; |
|
5173 docBlock+=*yytext; |
|
5174 } |
|
5175 <DocBlock>. { // command block |
|
5176 docBlock+=*yytext; |
|
5177 } |
|
5178 |
|
5179 /* ---- Copy verbatim sections ------ */ |
|
5180 |
|
5181 <DocCopyBlock>"</"{PRE}">" { // end of a <pre> block |
|
5182 docBlock+=yytext; |
|
5183 if (docBlockName=="<pre>") |
|
5184 { |
|
5185 BEGIN(DocBlock); |
|
5186 } |
|
5187 } |
|
5188 <DocCopyBlock>"</"{CODE}">" { // end of a <code> block |
|
5189 docBlock+=yytext; |
|
5190 if (docBlockName=="<code>") |
|
5191 { |
|
5192 BEGIN(DocBlock); |
|
5193 } |
|
5194 } |
|
5195 <DocCopyBlock>[\\@]("f$"|"f]"|"f}") { |
|
5196 docBlock+=yytext; |
|
5197 BEGIN(DocBlock); |
|
5198 } |
|
5199 <DocCopyBlock>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"endmanonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block |
|
5200 docBlock+=yytext; |
|
5201 if (&yytext[4]==docBlockName) |
|
5202 { |
|
5203 BEGIN(DocBlock); |
|
5204 } |
|
5205 } |
|
5206 <DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line |
|
5207 if (docBlockName=="verbatim") |
|
5208 { |
|
5209 REJECT; |
|
5210 } |
|
5211 } |
|
5212 <DocCopyBlock>[^\<@/*\]\$\\\n]+ { // any character that is not special |
|
5213 docBlock+=yytext; |
|
5214 } |
|
5215 <DocCopyBlock>"/*"|"*/"|"//" { |
|
5216 docBlock+=yytext; |
|
5217 } |
|
5218 <DocCopyBlock>\n { // newline |
|
5219 docBlock+=*yytext; |
|
5220 yyLineNr++; |
|
5221 } |
|
5222 <DocCopyBlock>. { // any other character |
|
5223 docBlock+=*yytext; |
|
5224 } |
|
5225 <DocCopyBlock><<EOF>> { |
|
5226 warn(yyFileName,yyLineNr, |
|
5227 "Warning: reached end of file while inside a %s block!\n" |
|
5228 "The command that should end the block seems to be missing!\n", |
|
5229 docBlockName.data()); |
|
5230 yyterminate(); |
|
5231 } |
|
5232 |
|
5233 |
|
5234 /* ------------- Prototype parser -------------- */ |
|
5235 |
|
5236 <Prototype>"operator"{B}*"("{B}*")" { |
|
5237 current->name+=yytext; |
|
5238 } |
|
5239 <Prototype>"(" { |
|
5240 current->args+=*yytext; |
|
5241 currentArgumentContext = PrototypeQual; |
|
5242 fullArgString = current->args.copy(); |
|
5243 copyArgString = ¤t->args; |
|
5244 BEGIN( ReadFuncArgType ) ; |
|
5245 } |
|
5246 <Prototype>"("({ID}"::")*({B}*[&*])+ { |
|
5247 current->type+=current->name+yytext; |
|
5248 current->name.resize(0); |
|
5249 BEGIN( PrototypePtr ); |
|
5250 } |
|
5251 <PrototypePtr>{SCOPENAME} { |
|
5252 current->name+=yytext; |
|
5253 } |
|
5254 <PrototypePtr>"(" { |
|
5255 current->args+=*yytext; |
|
5256 currentArgumentContext = PrototypeQual; |
|
5257 fullArgString = current->args.copy(); |
|
5258 copyArgString = ¤t->args; |
|
5259 BEGIN( ReadFuncArgType ) ; |
|
5260 } |
|
5261 <PrototypePtr>")" { |
|
5262 current->type+=')'; |
|
5263 BEGIN( Prototype ); |
|
5264 } |
|
5265 <PrototypePtr>. { |
|
5266 current->name+=yytext; |
|
5267 } |
|
5268 <PrototypeQual>"{" { |
|
5269 BEGIN( PrototypeSkipLine); |
|
5270 } |
|
5271 <PrototypeQual>{B}*"const"{B}* { |
|
5272 current->args += " const "; |
|
5273 current->argList->constSpecifier=TRUE; |
|
5274 } |
|
5275 <PrototypeQual>{B}*"volatile"{B}* { |
|
5276 current->args += " volatile "; |
|
5277 current->argList->volatileSpecifier=TRUE; |
|
5278 } |
|
5279 <PrototypeQual>{B}*"="{B}*"0"{B}* { |
|
5280 current->args += " = 0"; |
|
5281 current->virt = Pure; |
|
5282 current->argList->pureSpecifier=TRUE; |
|
5283 } |
|
5284 <PrototypeQual>"throw"{B}*"(" { |
|
5285 current->exception = "throw("; |
|
5286 BEGIN(PrototypeExc); |
|
5287 } |
|
5288 <PrototypeExc>")" { |
|
5289 current->exception += ')'; |
|
5290 BEGIN(PrototypeQual); |
|
5291 } |
|
5292 <PrototypeExc>. { |
|
5293 current->exception += *yytext; |
|
5294 } |
|
5295 <PrototypeQual>. { |
|
5296 current->args += *yytext; |
|
5297 } |
|
5298 <Prototype>. { |
|
5299 current->name += *yytext; |
|
5300 } |
|
5301 <PrototypeSkipLine>. { |
|
5302 } |
|
5303 |
|
5304 |
|
5305 /* ------------ Generic rules -------------- */ |
|
5306 |
|
5307 |
|
5308 <SkipCxxComment>.*"\\\n" { // line continuation |
|
5309 yyLineNr++; |
|
5310 } |
|
5311 <SkipCxxComment>.*/\n { |
|
5312 BEGIN( lastCContext ) ; |
|
5313 } |
|
5314 <SkipComment>[^\*\n]+ |
|
5315 <*>\n { yyLineNr++ ; } |
|
5316 <*>\" { |
|
5317 if (insideIDL && insideCppQuote) |
|
5318 { |
|
5319 BEGIN(EndCppQuote); |
|
5320 } |
|
5321 } |
|
5322 <*>"#" { |
|
5323 if (!insidePHP) |
|
5324 REJECT; |
|
5325 lastCContext = YY_START ; |
|
5326 BEGIN( SkipCxxComment ) ; |
|
5327 } |
|
5328 <*>\' { |
|
5329 if (insidePHP) |
|
5330 { |
|
5331 lastStringContext=YY_START; |
|
5332 BEGIN(SkipPHPString); |
|
5333 } |
|
5334 } |
|
5335 <*>\" { |
|
5336 if (insidePHP) |
|
5337 { |
|
5338 lastStringContext=YY_START; |
|
5339 BEGIN(SkipString); |
|
5340 } |
|
5341 } |
|
5342 <*>. |
|
5343 <SkipComment>"//"|"/*" |
|
5344 <*>"/*" { lastCContext = YY_START ; |
|
5345 BEGIN( SkipComment ) ; |
|
5346 } |
|
5347 <SkipComment>{B}*"*/" { BEGIN( lastCContext ) ; } |
|
5348 <*>"//" { |
|
5349 lastCContext = YY_START ; |
|
5350 BEGIN( SkipCxxComment ) ; |
|
5351 } |
|
5352 %% |
|
5353 |
|
5354 //---------------------------------------------------------------------------- |
|
5355 |
|
5356 static void startCommentBlock(bool brief) |
|
5357 { |
|
5358 if (brief) |
|
5359 { |
|
5360 current->briefFile = yyFileName; |
|
5361 current->briefLine = yyLineNr; |
|
5362 } |
|
5363 else |
|
5364 { |
|
5365 current->docFile = yyFileName; |
|
5366 current->docLine = yyLineNr; |
|
5367 } |
|
5368 } |
|
5369 |
|
5370 //---------------------------------------------------------------------------- |
|
5371 |
|
5372 static void newEntry() |
|
5373 { |
|
5374 current_root->addSubEntry(current); |
|
5375 previous = current; |
|
5376 current = new Entry ; |
|
5377 initEntry(); |
|
5378 } |
|
5379 |
|
5380 static void handleCommentBlock(const QCString &doc,bool brief) |
|
5381 { |
|
5382 static bool hideInBodyDocs = Config_getBool("HIDE_IN_BODY_DOCS"); |
|
5383 int position=0; |
|
5384 bool needsEntry=FALSE; |
|
5385 if (docBlockInBody && hideInBodyDocs) return; |
|
5386 //printf("parseCommentBlock [%s]\n",doc.data()); |
|
5387 int lineNr = brief ? current->briefLine : current->docLine; // line of block start |
|
5388 while (parseCommentBlock( |
|
5389 g_thisParser, |
|
5390 docBlockInBody && previous ? previous : current, |
|
5391 doc, // text |
|
5392 yyFileName, // file |
|
5393 lineNr, // line of block start |
|
5394 docBlockInBody ? FALSE : brief, |
|
5395 docBlockInBody ? FALSE : docBlockAutoBrief, |
|
5396 docBlockInBody, |
|
5397 protection, |
|
5398 position, |
|
5399 needsEntry |
|
5400 ) |
|
5401 ) |
|
5402 { |
|
5403 //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position); |
|
5404 if (needsEntry) newEntry(); |
|
5405 } |
|
5406 if (needsEntry) |
|
5407 { |
|
5408 newEntry(); |
|
5409 } |
|
5410 |
|
5411 if (docBlockTerm) |
|
5412 { |
|
5413 unput(docBlockTerm); |
|
5414 docBlockTerm=0; |
|
5415 } |
|
5416 } |
|
5417 |
|
5418 static void handleParametersCommentBlocks(ArgumentList *al) |
|
5419 { |
|
5420 //printf(">>>>>>> handleParametersCommentBlocks()\n"); |
|
5421 ArgumentListIterator ali(*al); |
|
5422 Argument *a; |
|
5423 for (ali.toFirst();(a=ali.current());++ali) |
|
5424 { |
|
5425 //printf(" Param %s docs=%s\n",a->name.data(),a->docs.data()); |
|
5426 if (!a->docs.isEmpty()) |
|
5427 { |
|
5428 int position=0; |
|
5429 bool needsEntry; |
|
5430 |
|
5431 // save context |
|
5432 QCString orgDoc = current->doc; |
|
5433 QCString orgBrief = current->brief; |
|
5434 int orgDocLine = current->docLine; |
|
5435 int orgBriefLine = current->briefLine; |
|
5436 |
|
5437 current->doc.resize(0); |
|
5438 current->brief.resize(0); |
|
5439 |
|
5440 //printf("handleParametersCommentBlock [%s]\n",doc.data()); |
|
5441 while (parseCommentBlock( |
|
5442 g_thisParser, |
|
5443 current, |
|
5444 a->docs, // text |
|
5445 yyFileName, // file |
|
5446 current->docLine, // line of block start |
|
5447 FALSE, |
|
5448 FALSE, |
|
5449 FALSE, |
|
5450 protection, |
|
5451 position, |
|
5452 needsEntry |
|
5453 ) |
|
5454 ) |
|
5455 { |
|
5456 //printf("handleParametersCommentBlock position=%d [%s]\n",position,doc.data()+position); |
|
5457 if (needsEntry) newEntry(); |
|
5458 } |
|
5459 if (needsEntry) |
|
5460 { |
|
5461 newEntry(); |
|
5462 } |
|
5463 a->docs = current->doc; |
|
5464 |
|
5465 // restore context |
|
5466 current->doc = orgDoc; |
|
5467 current->brief = orgBrief; |
|
5468 current->docLine = orgDocLine; |
|
5469 current->briefLine = orgBriefLine; |
|
5470 } |
|
5471 } |
|
5472 } |
|
5473 |
|
5474 |
|
5475 //---------------------------------------------------------------------------- |
|
5476 |
|
5477 static void parseCompounds(Entry *rt) |
|
5478 { |
|
5479 //printf("parseCompounds(%s)\n",rt->name.data()); |
|
5480 g_inputFromFile = FALSE; |
|
5481 EntryListIterator eli(*rt->children()); |
|
5482 Entry *ce; |
|
5483 for (;(ce=eli.current());++eli) |
|
5484 { |
|
5485 if (!ce->program.isEmpty()) |
|
5486 { |
|
5487 //printf("-- %s ---------\n%s\n---------------\n", |
|
5488 // ce->name.data(),ce->program.data()); |
|
5489 // init scanner state |
|
5490 padCount=0; |
|
5491 depthIf = 0; |
|
5492 inputString = ce->program; |
|
5493 inputPosition = 0; |
|
5494 scanYYrestart( scanYYin ) ; |
|
5495 if (ce->section==Entry::ENUM_SEC) |
|
5496 BEGIN( FindFields ) ; |
|
5497 else |
|
5498 BEGIN( FindMembers ) ; |
|
5499 current_root = ce ; |
|
5500 yyFileName = ce->fileName; |
|
5501 //setContext(); |
|
5502 yyLineNr = ce->startLine ; |
|
5503 insideObjC = ce->objc; |
|
5504 //printf("---> Inner block starts at line %d objC=%d\n",yyLineNr,insideObjC); |
|
5505 //current->reset(); |
|
5506 if (current) delete current; |
|
5507 current = new Entry; |
|
5508 gstat = FALSE; |
|
5509 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2; |
|
5510 // set default protection based on the compound type |
|
5511 if( ce->section==Entry::CLASS_SEC ) // class |
|
5512 { |
|
5513 |
|
5514 if (insidePHP || insideD || insideJS) |
|
5515 { |
|
5516 current->protection = protection = Public ; |
|
5517 } |
|
5518 else if (insideJava) |
|
5519 { |
|
5520 current->protection = protection = Package ; |
|
5521 } |
|
5522 else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union)) |
|
5523 { |
|
5524 if (ce->objc) |
|
5525 { |
|
5526 current->protection = protection = Protected ; |
|
5527 } |
|
5528 else |
|
5529 { |
|
5530 current->protection = protection = Public ; |
|
5531 } |
|
5532 } |
|
5533 else |
|
5534 { |
|
5535 current->protection = protection = Private ; |
|
5536 } |
|
5537 } |
|
5538 else if (ce->section == Entry::ENUM_SEC ) // enum |
|
5539 { |
|
5540 current->protection = protection = ce->protection; |
|
5541 } |
|
5542 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace |
|
5543 { |
|
5544 if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace |
|
5545 { |
|
5546 current->stat = gstat = TRUE; |
|
5547 } |
|
5548 current->protection = protection = ce->protection; |
|
5549 } |
|
5550 else // named struct, union, protocol, category |
|
5551 { |
|
5552 current->protection = protection = Public ; |
|
5553 } |
|
5554 mtype = Method; |
|
5555 virt = Normal; |
|
5556 //printf("name=%s current->stat=%d gstat=%d\n",ce->name.data(),current->stat,gstat); |
|
5557 |
|
5558 //memberGroupId = DOX_NOGROUP; |
|
5559 //memberGroupRelates.resize(0); |
|
5560 //memberGroupInside.resize(0); |
|
5561 groupEnterCompound(yyFileName,yyLineNr,ce->name); |
|
5562 |
|
5563 scanYYlex() ; |
|
5564 g_lexInit=TRUE; |
|
5565 //forceEndGroup(); |
|
5566 |
|
5567 groupLeaveCompound(yyFileName,yyLineNr,ce->name); |
|
5568 |
|
5569 delete current; current=0; |
|
5570 ce->program.resize(0); |
|
5571 |
|
5572 |
|
5573 if (depthIf>0) |
|
5574 { |
|
5575 warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); |
|
5576 } |
|
5577 } |
|
5578 parseCompounds(ce); |
|
5579 } |
|
5580 } |
|
5581 |
|
5582 //---------------------------------------------------------------------------- |
|
5583 |
|
5584 static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) |
|
5585 { |
|
5586 initParser(); |
|
5587 //g_inputFromFile = TRUE; |
|
5588 |
|
5589 inputString = fileBuf; |
|
5590 inputPosition = 0; |
|
5591 g_inputFromFile = FALSE; |
|
5592 |
|
5593 //anonCount = 0; // don't reset per file |
|
5594 depthIf = 0; |
|
5595 protection = Public; |
|
5596 mtype = Method; |
|
5597 gstat = FALSE; |
|
5598 virt = Normal; |
|
5599 current_root = rt; |
|
5600 global_root = rt; |
|
5601 inputFile.setName(fileName); |
|
5602 if (inputFile.open(IO_ReadOnly)) |
|
5603 { |
|
5604 yyLineNr= 1 ; |
|
5605 yyFileName = fileName; |
|
5606 setContext(); |
|
5607 msg("Parsing file %s...\n",yyFileName.data()); |
|
5608 |
|
5609 current_root = rt ; |
|
5610 initParser(); |
|
5611 groupEnterFile(yyFileName,yyLineNr); |
|
5612 current = new Entry; |
|
5613 //printf("current=%p current_root=%p\n",current,current_root); |
|
5614 int sec=guessSection(yyFileName); |
|
5615 if (sec) |
|
5616 { |
|
5617 current->name = yyFileName; |
|
5618 current->section = sec; |
|
5619 current_root->addSubEntry(current); |
|
5620 current = new Entry; |
|
5621 } |
|
5622 current->reset(); |
|
5623 scanYYrestart( scanYYin ); |
|
5624 if ( insidePHP ) |
|
5625 { |
|
5626 BEGIN( FindMembersPHP ); |
|
5627 } |
|
5628 else |
|
5629 { |
|
5630 BEGIN( FindMembers ); |
|
5631 } |
|
5632 |
|
5633 scanYYlex(); |
|
5634 g_lexInit=TRUE; |
|
5635 |
|
5636 if (YY_START==Comment) |
|
5637 { |
|
5638 warn(yyFileName,yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); |
|
5639 } |
|
5640 |
|
5641 //forceEndGroup(); |
|
5642 groupLeaveFile(yyFileName,yyLineNr); |
|
5643 |
|
5644 if (depthIf>0) |
|
5645 { |
|
5646 warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); |
|
5647 } |
|
5648 |
|
5649 rt->program.resize(0); |
|
5650 delete current; current=0; |
|
5651 |
|
5652 parseCompounds(rt); |
|
5653 |
|
5654 inputFile.close(); |
|
5655 |
|
5656 anonNSCount++; |
|
5657 } |
|
5658 } |
|
5659 |
|
5660 //---------------------------------------------------------------------------- |
|
5661 |
|
5662 static void parsePrototype(const QCString &text) |
|
5663 { |
|
5664 //printf("**** parsePrototype(%s) begin\n",text.data()); |
|
5665 if (text.isEmpty()) |
|
5666 { |
|
5667 warn(yyFileName,yyLineNr,"Empty prototype found!"); |
|
5668 return; |
|
5669 } |
|
5670 |
|
5671 const char *orgInputString; |
|
5672 int orgInputPosition; |
|
5673 YY_BUFFER_STATE orgState; |
|
5674 bool orgInputFromFile; |
|
5675 |
|
5676 // save scanner state |
|
5677 orgState = YY_CURRENT_BUFFER; |
|
5678 yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE)); |
|
5679 orgInputString = inputString; |
|
5680 orgInputPosition = inputPosition; |
|
5681 orgInputFromFile = g_inputFromFile; |
|
5682 |
|
5683 // set new string |
|
5684 inputString = text; |
|
5685 inputPosition = 0; |
|
5686 g_inputFromFile = FALSE; |
|
5687 scanYYrestart( scanYYin ); |
|
5688 BEGIN(Prototype); |
|
5689 scanYYlex(); |
|
5690 g_lexInit=TRUE; |
|
5691 |
|
5692 current->name = current->name.stripWhiteSpace(); |
|
5693 if (current->section == Entry::MEMBERDOC_SEC && current->args.isEmpty()) |
|
5694 current->section = Entry::VARIABLEDOC_SEC; |
|
5695 |
|
5696 // restore original scanner state |
|
5697 YY_BUFFER_STATE tmpState = YY_CURRENT_BUFFER; |
|
5698 yy_switch_to_buffer(orgState); |
|
5699 yy_delete_buffer(tmpState); |
|
5700 inputString = orgInputString; |
|
5701 inputPosition = orgInputPosition; |
|
5702 g_inputFromFile = orgInputFromFile; |
|
5703 |
|
5704 //printf("**** parsePrototype end\n"); |
|
5705 } |
|
5706 |
|
5707 void scanFreeScanner() |
|
5708 { |
|
5709 #if defined(YY_FLEX_SUBMINOR_VERSION) |
|
5710 if (g_lexInit) |
|
5711 { |
|
5712 scanYYlex_destroy(); |
|
5713 } |
|
5714 #endif |
|
5715 } |
|
5716 |
|
5717 //static void handleGroupStartCommand(const char *header) |
|
5718 //{ |
|
5719 // memberGroupHeader=header; |
|
5720 // startGroupInDoc(); |
|
5721 //} |
|
5722 // |
|
5723 //static void handleGroupEndCommand() |
|
5724 //{ |
|
5725 // endGroup(); |
|
5726 // previous=0; |
|
5727 //} |
|
5728 |
|
5729 //---------------------------------------------------------------------------- |
|
5730 |
|
5731 void CLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root) |
|
5732 { |
|
5733 g_thisParser = this; |
|
5734 ::parseMain(fileName,fileBuf,root); |
|
5735 } |
|
5736 |
|
5737 void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, |
|
5738 const char * scopeName, |
|
5739 const QCString & input, |
|
5740 bool isExampleBlock, |
|
5741 const char * exampleName, |
|
5742 FileDef * fileDef, |
|
5743 int startLine, |
|
5744 int endLine, |
|
5745 bool inlineFragment, |
|
5746 MemberDef *memberDef |
|
5747 ) |
|
5748 { |
|
5749 ::parseCCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName, |
|
5750 fileDef,startLine,endLine,inlineFragment,memberDef); |
|
5751 } |
|
5752 |
|
5753 bool CLanguageScanner::needsPreprocessing(const QCString &extension) |
|
5754 { |
|
5755 QCString fe=extension.lower(); |
|
5756 return |
|
5757 !( fe==".java" || fe==".as" || fe==".d" || fe==".php" || |
|
5758 fe==".php4" || fe==".inc" || fe==".phtml" |
|
5759 ); |
|
5760 } |
|
5761 |
|
5762 void CLanguageScanner::resetCodeParserState() |
|
5763 { |
|
5764 ::resetCCodeParserState(); |
|
5765 } |
|
5766 |
|
5767 void CLanguageScanner::parsePrototype(const char *text) |
|
5768 { |
|
5769 ::parsePrototype(text); |
|
5770 } |
|
5771 |
|
5772 //---------------------------------------------------------------------------- |
|
5773 |
|
5774 #if !defined(YY_FLEX_SUBMINOR_VERSION) |
|
5775 //---------------------------------------------------------------------------- |
|
5776 extern "C" { // some bogus code to keep the compiler happy |
|
5777 void scannerYYdummy() { yy_flex_realloc(0,0); } |
|
5778 } |
|
5779 #endif |
|
5780 |