157 { BEGIN(ReadFuncArgType); }
158
159<ReadFuncArgType>{B}* {
160 yyextra->curArgTypeName+=" ";
161 }
162<ReadFuncArgType>"["[^\]]*"]" {
163 if (yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
164 {
165 yyextra->curArgAttrib=yytext;
166 }
167 else
168 {
169 yyextra->curArgArray+=yytext;
170 }
171 }
172<ReadFuncArgDef>"'"\\[0-7]{1,3}"'" { yyextra->curArgDefValue+=yytext; }
173<ReadFuncArgDef>"'"\\."'" { yyextra->curArgDefValue+=yytext; }
174<ReadFuncArgDef>"'"."'" { yyextra->curArgDefValue+=yytext; }
175<ReadFuncArgDef>{RAWBEGIN} { yyextra->curArgDefValue+=yytext;
177 BEGIN( CopyRawString );
178 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
179<ReadFuncArgDef>\" {
180 yyextra->curArgDefValue+=*yytext;
181 BEGIN( CopyArgString );
182 }
183<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
184
185 yyextra->curArgTypeName+=yytext;
186
187 BEGIN( ReadFuncArgPtr );
188 }
189<ReadFuncArgPtr>{ID} {
190 yyextra->curArgName=yytext;
191 }
192<ReadFuncArgPtr>")"{B}*"(" { // function pointer
193 yyextra->curArgTypeName+=yytext;
194
195 yyextra->readArgContext = ReadFuncArgType;
196 yyextra->copyArgValue=&yyextra->curArgTypeName;
197 yyextra->argRoundCount=0;
198 BEGIN( CopyArgRound2 );
199 }
200<ReadFuncArgPtr>")"/{B}*"[" { // pointer to fixed size array
201 yyextra->curArgTypeName+=yytext;
202 yyextra->curArgTypeName+=yyextra->curArgName;
203
204 BEGIN( ReadFuncArgType );
205 }
206<ReadFuncArgPtr>")" { // redundant braces detected / remove them
207 int i=yyextra->curArgTypeName.findRev('(');
208 int l=static_cast<int>(yyextra->curArgTypeName.length());
209 if (i!=-1)
210 {
211 yyextra->curArgTypeName=yyextra->curArgTypeName.left(i)+
212 yyextra->curArgTypeName.right(l-i-1);
213 }
214 yyextra->curArgTypeName+=yyextra->curArgName;
215 BEGIN( ReadFuncArgType );
216 }
217<ReadFuncArgType>"<="|">="|"->"|">>"|"<<" { // handle operators in defargs
218 yyextra->curArgTypeName+=yytext;
219 }
220<ReadFuncArgType,ReadFuncArgDef>[({<\[] {
221 if (YY_START==ReadFuncArgType)
222 {
223 yyextra->curArgTypeName+=*yytext;
224 yyextra->copyArgValue=&yyextra->curArgTypeName;
225 }
226 else
227 {
228 yyextra->curArgDefValue+=*yytext;
229 yyextra->copyArgValue=&yyextra->curArgDefValue;
230 }
231 yyextra->readArgContext = YY_START;
232 if (*yytext=='(')
233 {
234 yyextra->argRoundCount=0;
235 BEGIN( CopyArgRound );
236 }
237 else if (*yytext=='[')
238 {
239 yyextra->argSquareCount=0;
240 BEGIN( CopyArgSquare );
241 }
242 else if (*yytext=='{')
243 {
244 yyextra->argCurlyCount=0;
245 BEGIN( CopyArgCurly );
246 }
247 else
248 {
249 yyextra->argSharpCount=0;
250 yyextra->argRoundCount=0;
251 BEGIN( CopyArgSharp );
252 }
253 }
254<CopyArgRound,CopyArgRound2>"(" {
255 yyextra->argRoundCount++;
256 *yyextra->copyArgValue += *yytext;
257 }
258<CopyArgRound,CopyArgRound2>")"({B}*{ID})* {
259 *yyextra->copyArgValue += yytext;
260 if (yyextra->argRoundCount>0)
261 {
262 yyextra->argRoundCount--;
263 }
264 else
265 {
266 if (YY_START==CopyArgRound2)
267 {
268 *yyextra->copyArgValue+=" "+yyextra->curArgName;
269 }
270 BEGIN( yyextra->readArgContext );
271 }
272 }
273<CopyArgRound>")"/{B}* {
274 *yyextra->copyArgValue += *yytext;
275 if (yyextra->argRoundCount>0) yyextra->argRoundCount--;
276 else BEGIN( yyextra->readArgContext );
277 }
278<CopyArgSquare>"[" {
279 yyextra->argSquareCount++;
280 *yyextra->copyArgValue += *yytext;
281 }
282<CopyArgSquare>"]"({B}*{ID})* {
283 *yyextra->copyArgValue += yytext;
284 if (yyextra->argSquareCount>0)
285 {
286 yyextra->argRoundCount--;
287 }
288 else
289 {
290 BEGIN( yyextra->readArgContext );
291 }
292 }
293<CopyArgSquare>"]"/{B}* {
294 *yyextra->copyArgValue += *yytext;
295 if (yyextra->argSquareCount>0) yyextra->argSquareCount--;
296 else BEGIN( yyextra->readArgContext );
297 }
298<CopyArgSharp>"<<" {
299 if (yyextra->argRoundCount>0)
300 {
301
302 *yyextra->copyArgValue += yytext;
303 }
304 else
305 {
306 REJECT;
307 }
308 }
309<CopyArgSharp>">>" {
310 if (yyextra->argRoundCount>0)
311 {
312
313 *yyextra->copyArgValue += yytext;
314 }
315 else
316 {
317 REJECT;
318 }
319 }
320<CopyArgSharp>"<" {
321
322 if (yyextra->argRoundCount==0) yyextra->argSharpCount++;
323 *yyextra->copyArgValue += *yytext;
324 }
325<CopyArgSharp>">" {
326 *yyextra->copyArgValue += *yytext;
327 if (yyextra->argRoundCount>0 && yyextra->argSharpCount==0)
328 {
329
330 }
331 else
332 {
333 if (yyextra->argSharpCount>0)
334 {
335 yyextra->argSharpCount--;
336 }
337 else
338 {
339 BEGIN( yyextra->readArgContext );
340 }
341 }
342 }
343<CopyArgSharp>"(" {
344 yyextra->argRoundCount++;
345 *yyextra->copyArgValue += *yytext;
346 }
347<CopyArgSharp>")" {
348 yyextra->argRoundCount--;
349 *yyextra->copyArgValue += *yytext;
350 }
351<CopyArgCurly>"{" {
352 yyextra->argCurlyCount++;
353 *yyextra->copyArgValue += *yytext;
354 }
355<CopyArgCurly>"}" {
356 *yyextra->copyArgValue += *yytext;
357 if (yyextra->argCurlyCount>0) yyextra->argCurlyCount--;
358 else BEGIN( yyextra->readArgContext );
359 }
360<CopyArgString>\\. {
361 yyextra->curArgDefValue+=yytext;
362 }
363<CopyRawString>{RAWEND} {
364 yyextra->curArgDefValue+=yytext;
366 {
367 BEGIN( ReadFuncArgDef );
368 }
369 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
370<CopyArgString>\" {
371 yyextra->curArgDefValue+=*yytext;
372 BEGIN( ReadFuncArgDef );
373 }
374<ReadFuncArgType>"=" {
375 BEGIN( ReadFuncArgDef );
376 }
377<ReadFuncArgType,ReadFuncArgDef>[,)>]{B}*({CCS}[*!]|{CPPC}[/!])"<" {
378 yyextra->lastDocContext=YY_START;
379 yyextra->lastDocChar=*yytext;
381 if (text.find("//")!=-1)
382 BEGIN( ReadDocLine );
383 else
384 BEGIN( ReadDocBlock );
385 }
This is an alternative implementation of QCString.
386<ReadFuncArgType,ReadFuncArgDef>[,)>] {
387 if (*yytext==')' && yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
388 {
389 yyextra->curArgTypeName+=*yytext;
390 BEGIN(FuncQual);
391 }
392 else
393 {
395 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
396
397 int l = static_cast<int>(yyextra->curArgTypeName.length());
398 if (l>0)
399 {
400 int i=l-1;
401 while (i>=0 && (isspace((uint8_t)yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)=='.')) i--;
402 while (i>=0 && (
isId(yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)==
'$')) i--;
404 a.
attrib = yyextra->curArgAttrib;
406
407
409 if (i==l-1 && yyextra->curArgTypeName.at(i)==')')
410 {
411 int bi=yyextra->curArgTypeName.find('(');
412 int fi=bi-1;
413
414 while (fi>=0 && (
isId(yyextra->curArgTypeName.at(fi)) || yyextra->curArgTypeName.at(fi)==
':')) fi--;
415 if (fi>=0)
416 {
417 a.
type = yyextra->curArgTypeName.
left(fi+1);
419 a.
array = yyextra->curArgTypeName.
right(l-bi);
420 }
421 else
422 {
423 a.
type = yyextra->curArgTypeName;
424 }
425 }
426 else if (i>=0 && yyextra->curArgTypeName.at(i)!=':')
427 {
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString right(size_t len) const
QCString left(size_t len) const
This class contains the information about the argument of a function or template.
QCString removeRedundantWhiteSpace(const QCString &s)
430
431
432
433
434 int sv=0;
bool startsWith(const char *s) const
437
438 if (a.
type.
mid(sv)==
"struct" ||
443 a.
type==
"volatile" ||
445 )
446 {
449 }
450
451 }
452 else
453 {
455 }
457 {
460 }
462
464 if (alen>2 && a.
array.
at(0)==
'(' &&
466 {
470 {
473 }
474 }
475 a.
defval = yyextra->curArgDefValue;
476
478
479 yyextra->argList->push_back(a);
480 }
481 yyextra->curArgAttrib.
clear();
482 yyextra->curArgTypeName.clear();
483 yyextra->curArgDefValue.clear();
484 yyextra->curArgArray.clear();
485 yyextra->curArgDocs.clear();
486 yyextra->curTypeConstraint.clear();
487 if (*yytext==')')
488 {
489 BEGIN(FuncQual);
490
491 }
492 else
493 {
494 BEGIN( ReadFuncArgType );
495 }
496 }
497 }
int find(char c, int index=0, bool cs=TRUE) const
char & at(size_t i)
Returns a reference to the character at index i.
static bool nameIsActuallyPartOfType(QCString &name)
498<ReadFuncArgType,ReadFuncArgPtr>"extends" {
499 if (yyextra->lang!=SrcLangExt::Java)
500 {
501 REJECT;
502 }
503 else
504 {
505 yyextra->argSharpCount=0;
506 yyextra->curTypeConstraint.clear();
507 yyextra->lastExtendsContext=YY_START;
508 BEGIN(ReadTypeConstraint);
509 }
510 }
511<ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} {
513 if (YY_START==ReadFuncArgType && yyextra->curArgArray=="[]")
514 {
515 yyextra->curArgTypeName+=" []";
516 yyextra->curArgArray.clear();
517 }
518
519 yyextra->curArgTypeName+=name;
520 }
521<ReadFuncArgType,ReadFuncArgPtr>. {
522 yyextra->curArgTypeName+=*yytext;
523 }
524
525<ReadFuncArgDef,CopyArgString>"<="|"->"|">="|">>"|"<<" {
526 yyextra->curArgDefValue+=yytext;
527 }
528<ReadFuncArgDef,CopyArgString,CopyRawString>. {
529 yyextra->curArgDefValue+=*yytext;
530 }
531<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>{ID} {
532 *yyextra->copyArgValue+=yytext;
533 }
534<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>. {
535 *yyextra->copyArgValue += *yytext;
536 }
537<ReadTypeConstraint>[,)>] {
538 if (yytext[0]!='>' || yyextra->argSharpCount==0)
539 {
540 unput(*yytext);
541 BEGIN(yyextra->lastExtendsContext);
542 }
543 else
544 {
545 yyextra->curTypeConstraint+=yytext;
546 yyextra->argSharpCount--;
547 }
548 }
549<ReadTypeConstraint>"<" {
550 yyextra->curTypeConstraint+=yytext;
551 yyextra->argSharpCount++;
552 }
553<ReadTypeConstraint>. {
554 yyextra->curTypeConstraint+=yytext;
555 }
556<ReadTypeConstraint>\n {
557 yyextra->curTypeConstraint+=' ';
558 }
559<FuncQual>"const" {
560 yyextra->argList->setConstSpecifier(
TRUE);
561 }
562<FuncQual>"volatile" {
563 yyextra->argList->setVolatileSpecifier(
TRUE);
564 }
565<FuncQual>"override" {
566 }
567<FuncQual>"&" {
569 }
570<FuncQual>"&&" {
572 }
573<FuncQual,TrailingReturn>"="{B}*"0" {
574 yyextra->argList->setPureSpecifier(
TRUE);
575 BEGIN(FuncQual);
576 }
577<FuncQual>"->" { // C++11 trailing return type
578 yyextra->argList->setTrailingReturnType(
QCString(
" -> "));
579 BEGIN(TrailingReturn);
580 }
581<TrailingReturn>{B}/("final"|"override"){B}* {
582 unput(*yytext);
583 BEGIN(FuncQual);
584 }
585<TrailingReturn>. {
586 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
587 }
588<TrailingReturn>\n {
589 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
590 }
591<FuncQual>")"{B}*"["[^]]*"]" { // for functions returning a pointer to an array,
592
593 yyextra->extraTypeChars=yytext;
594 }
595<ReadDocBlock>[^\*\n]+ {
596 yyextra->curArgDocs+=yytext;
597 }
598<ReadDocLine>[^\n]+ {
599 yyextra->curArgDocs+=yytext;
600 }
601<ReadDocBlock>{CCE} {
602 if (yyextra->lastDocChar!=0)
603 unput(yyextra->lastDocChar);
604 BEGIN(yyextra->lastDocContext);
605 }
606<ReadDocLine>\n {
607 if (yyextra->lastDocChar!=0)
608 unput(yyextra->lastDocChar);
609 BEGIN(yyextra->lastDocContext);
610 }
611<ReadDocBlock>\n {
612 yyextra->curArgDocs+=*yytext;
613 }
614<ReadDocBlock>. {
615 yyextra->curArgDocs+=*yytext;
616 }
617<*>({CCS}[*!]|{CPPC}[/!])("<"?) {
618 yyextra->lastDocContext=YY_START;
619 yyextra->lastDocChar=0;
620 if (yytext[1]=='/')
621 BEGIN( ReadDocLine );
622 else
623 BEGIN( ReadDocBlock );
624 }
625<*>\n
626<*>.
627
628%%