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