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