151 { BEGIN(ReadFuncArgType); }
152
153<ReadFuncArgType>{B}* {
154 yyextra->curArgTypeName+=" ";
155 }
156<ReadFuncArgType,ReadFuncArgPtr>"["[^\]]*"]" {
157 if (YY_START==ReadFuncArgPtr)
158 {
159 yyextra->curArgTypeName+=yytext;
160 }
161 else if (yyextra->curArgTypeName.stripWhiteSpace().empty())
162 {
163 yyextra->curArgAttrib=yytext;
164 }
165 else
166 {
167 yyextra->curArgArray+=yytext;
168 }
169 }
170<ReadFuncArgDef>"'"\\[0-7]{1,3}"'" { yyextra->curArgDefValue+=yytext; }
171<ReadFuncArgDef>"'"\\."'" { yyextra->curArgDefValue+=yytext; }
172<ReadFuncArgDef>"'"."'" { yyextra->curArgDefValue+=yytext; }
173<ReadFuncArgDef>{RAWBEGIN} { yyextra->curArgDefValue+=yytext;
175 BEGIN( CopyRawString );
176 }
DString extractBeginRawStringDelimiter(const char *rawStart)
177<ReadFuncArgDef>\" {
178 yyextra->curArgDefValue+=*yytext;
179 BEGIN( CopyArgString );
180 }
181<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
182
183 yyextra->curArgTypeName+=yytext;
184
185 BEGIN( ReadFuncArgPtr );
186 }
187<ReadFuncArgPtr>{ID} {
188 yyextra->curArgName=yytext;
189 }
190<ReadFuncArgPtr>")"{B}*"(" { // function pointer
191 yyextra->curArgTypeName+=yytext;
192
193 yyextra->readArgContext = ReadFuncArgType;
194 yyextra->copyArgValue=&yyextra->curArgTypeName;
195 yyextra->argRoundCount=0;
196 BEGIN( CopyArgRound2 );
197 }
198<ReadFuncArgPtr>")"/{B}*"[" { // pointer to fixed size array
199 yyextra->curArgTypeName+=yytext;
200 yyextra->curArgTypeName+=yyextra->curArgName;
201
202 BEGIN( ReadFuncArgType );
203 }
204<ReadFuncArgPtr>")" { // redundant braces detected / remove them
205 size_t i=yyextra->curArgTypeName.rfind('(');
206 size_t l=yyextra->curArgTypeName.length();
208 {
209 yyextra->curArgTypeName=yyextra->curArgTypeName.left(i)+
210 yyextra->curArgTypeName.right(l-i-1);
211 }
212 yyextra->curArgTypeName+=yyextra->curArgName;
213 BEGIN( ReadFuncArgType );
214 }
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
215<ReadFuncArgType>"<="|">="|"->"|">>"|"<<" { // handle operators in defargs
216 yyextra->curArgTypeName+=yytext;
217 }
218<ReadFuncArgType,ReadFuncArgDef>[({<\[] {
219 if (YY_START==ReadFuncArgType)
220 {
221 yyextra->curArgTypeName+=*yytext;
222 yyextra->copyArgValue=&yyextra->curArgTypeName;
223 }
224 else
225 {
226 yyextra->curArgDefValue+=*yytext;
227 yyextra->copyArgValue=&yyextra->curArgDefValue;
228 }
229 yyextra->readArgContext = YY_START;
230 if (*yytext=='(')
231 {
232 yyextra->argRoundCount=0;
233 BEGIN( CopyArgRound );
234 }
235 else if (*yytext=='[')
236 {
237 yyextra->argSquareCount=0;
238 BEGIN( CopyArgSquare );
239 }
240 else if (*yytext=='{')
241 {
242 yyextra->argCurlyCount=0;
243 BEGIN( CopyArgCurly );
244 }
245 else
246 {
247 yyextra->argSharpCount=0;
248 yyextra->argRoundCount=0;
249 BEGIN( CopyArgSharp );
250 }
251 }
252<CopyArgRound,CopyArgRound2>"(" {
253 yyextra->argRoundCount++;
254 *yyextra->copyArgValue += *yytext;
255 }
256<CopyArgRound,CopyArgRound2>")"({B}*{ID})* {
257 *yyextra->copyArgValue += yytext;
258 if (yyextra->argRoundCount>0)
259 {
260 yyextra->argRoundCount--;
261 }
262 else
263 {
264 if (YY_START==CopyArgRound2)
265 {
266 *yyextra->copyArgValue+=" "+yyextra->curArgName;
267 }
268 BEGIN( yyextra->readArgContext );
269 }
270 }
271<CopyArgRound>")"/{B}* {
272 *yyextra->copyArgValue += *yytext;
273 if (yyextra->argRoundCount>0) yyextra->argRoundCount--;
274 else BEGIN( yyextra->readArgContext );
275 }
276<CopyArgSquare>"[" {
277 yyextra->argSquareCount++;
278 *yyextra->copyArgValue += *yytext;
279 }
280<CopyArgSquare>"]"({B}*{ID})* {
281 *yyextra->copyArgValue += yytext;
282 if (yyextra->argSquareCount>0)
283 {
284 yyextra->argRoundCount--;
285 }
286 else
287 {
288 BEGIN( yyextra->readArgContext );
289 }
290 }
291<CopyArgSquare>"]"/{B}* {
292 *yyextra->copyArgValue += *yytext;
293 if (yyextra->argSquareCount>0) yyextra->argSquareCount--;
294 else BEGIN( yyextra->readArgContext );
295 }
296<CopyArgSharp>"<<" {
297 if (yyextra->argRoundCount>0)
298 {
299
300 *yyextra->copyArgValue += yytext;
301 }
302 else
303 {
304 REJECT;
305 }
306 }
307<CopyArgSharp>">>" {
308 if (yyextra->argRoundCount>0)
309 {
310
311 *yyextra->copyArgValue += yytext;
312 }
313 else
314 {
315 REJECT;
316 }
317 }
318<CopyArgSharp>"<" {
319
320 if (yyextra->argRoundCount==0) yyextra->argSharpCount++;
321 *yyextra->copyArgValue += *yytext;
322 }
323<CopyArgSharp>">" {
324 *yyextra->copyArgValue += *yytext;
325 if (yyextra->argRoundCount>0 && yyextra->argSharpCount==0)
326 {
327
328 }
329 else
330 {
331 if (yyextra->argSharpCount>0)
332 {
333 yyextra->argSharpCount--;
334 }
335 else
336 {
337 BEGIN( yyextra->readArgContext );
338 }
339 }
340 }
341<CopyArgSharp>"(" {
342 yyextra->argRoundCount++;
343 *yyextra->copyArgValue += *yytext;
344 }
345<CopyArgSharp>")" {
346 yyextra->argRoundCount--;
347 *yyextra->copyArgValue += *yytext;
348 }
349<CopyArgCurly>"{" {
350 yyextra->argCurlyCount++;
351 *yyextra->copyArgValue += *yytext;
352 }
353<CopyArgCurly>"}" {
354 *yyextra->copyArgValue += *yytext;
355 if (yyextra->argCurlyCount>0) yyextra->argCurlyCount--;
356 else BEGIN( yyextra->readArgContext );
357 }
358<CopyArgString>\\. {
359 yyextra->curArgDefValue+=yytext;
360 }
361<CopyRawString>{RAWEND} {
362 yyextra->curArgDefValue+=yytext;
364 {
365 BEGIN( ReadFuncArgDef );
366 }
367 }
DString extractEndRawStringDelimiter(const char *rawEnd)
368<CopyArgString>\" {
369 yyextra->curArgDefValue+=*yytext;
370 BEGIN( ReadFuncArgDef );
371 }
372<ReadFuncArgType>"=" {
373 BEGIN( ReadFuncArgDef );
374 }
375<ReadFuncArgType,ReadFuncArgDef>[,)>]{B}*({CCS}[*!]|{CPPC}[/!])"<" {
376 yyextra->lastDocContext=YY_START;
377 yyextra->lastDocChar=*yytext;
380 BEGIN( ReadDocLine );
381 else
382 BEGIN( ReadDocBlock );
383 }
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
384<ReadFuncArgType,ReadFuncArgDef>[,)>] {
385 if (*yytext==')' && yyextra->curArgTypeName.stripWhiteSpace().empty())
386 {
387 yyextra->curArgTypeName+=*yytext;
388 BEGIN(FuncQual);
389 }
390 else
391 {
393 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
394
395 int l = static_cast<int>(yyextra->curArgTypeName.length());
396 if (l>0)
397 {
398 int i=l-1;
399 while (i>=0 && (isspace((uint8_t)yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)=='.')) i--;
400 while (i>=0 && (
isId(yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)==
'$')) i--;
402 a.
attrib = yyextra->curArgAttrib;
404
405
407 if (i==l-1 && yyextra->curArgTypeName.at(i)==')')
408 {
409 size_t bis=yyextra->curArgTypeName.find('(');
411 int fi = bi-1;
412
413 while (fi>=0 && (
isId(yyextra->curArgTypeName.at(fi)) || yyextra->curArgTypeName.at(fi)==
':')) fi--;
414 if (fi>=0)
415 {
416 a.
type = yyextra->curArgTypeName.
left(fi+1);
418 a.
array = yyextra->curArgTypeName.
right(l-bi);
419 }
420 else
421 {
422 a.
type = yyextra->curArgTypeName;
423 }
424 }
425 else if (i>=0 && yyextra->curArgTypeName.at(i)!=':')
426 {
This class contains the information about the argument of a function or template.
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
bool isId(char c)
Returns true if c is a valid character for an identifier.
DString removeRedundantWhiteSpace(const DString &s)
429
430
431
432
433 int sv=0;
bool startsWith(const char *s) const
436
437 if (a.
type.
mid(sv)==
"struct" ||
442 a.
type==
"volatile" ||
444 )
445 {
448 }
449
450 }
451 else
452 {
454 }
456 {
459 }
461
463 if (alen>2 && a.
array.
at(0)==
'(' &&
465 {
470 {
473 }
474 }
475 a.
defval = yyextra->curArgDefValue;
476
478
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 }
char & at(size_t i)
Returns a reference to the character at index i.
size_t find(char c, size_t pos=0) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
static bool nameIsActuallyPartOfType(DString &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(
DString(
" -> "));
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%%