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