Doxygen
Loading...
Searching...
No Matches
defargs.l File Reference
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include "defargs.h"
#include "entry.h"
#include "util.h"
#include "arguments.h"
#include "message.h"
#include "debug.h"
#include "doxygen_lex.h"
#include "defargs.l.h"
Include dependency graph for defargs.l:

Go to the source code of this file.

Classes

struct  defargsYY_state
class  KeywordHash

Macros

#define YY_TYPEDEF_YY_SCANNER_T
#define YY_NO_INPUT   1
#define YY_NO_UNISTD_H   1
#define YY_INPUT(buf, result, max_size)
#define LEX_NO_INPUT_FILENAME
#define TOTAL_KEYWORDS   28
#define MIN_WORD_LENGTH   3
#define MAX_WORD_LENGTH   9
#define MIN_HASH_VALUE   3
#define MAX_HASH_VALUE   48

Typedefs

typedef yyguts_t * yyscan_t

Functions

static const char * stateToString (int state)
static int yyread (yyscan_t yyscanner, char *buf, int max_size)
static bool nameIsActuallyPartOfType (QCString &name)
static const char * getLexerFILE ()
int yylex (yyscan_t yyscanner)
std::unique_ptr< ArgumentListstringToArgumentList (SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars)

Detailed Description

This scanner is used to convert a string into a list of function or template arguments. Each parsed argument results in a Argument struct, that is put into an ArgumentList in declaration order. Comment blocks for arguments can also be included in the string. The argument string does not contain new-lines (except inside any comment blocks). An Argument consists of the string fields: type,name,default value, and documentation The Argument list as a whole can be pure, constant or volatile.

Examples of input strings are:

*    "(int a,int b) const"
*    "(const char *s="hello world",int=5) = 0"
*    "<class T,class N>"
*    "(char c,const char)"
*  

Note: It is not always possible to distinguish between the name and type of an argument. In case of doubt the name is added to the type, and the matchArgumentList in util.cpp is be used to further determine the correct separation.

Definition in file defargs.l.

Macro Definition Documentation

◆ LEX_NO_INPUT_FILENAME

#define LEX_NO_INPUT_FILENAME

Definition at line 117 of file defargs.l.

◆ MAX_HASH_VALUE

#define MAX_HASH_VALUE   48

Definition at line 696 of file defargs.l.

Referenced by KeywordHash::find().

◆ MAX_WORD_LENGTH

#define MAX_WORD_LENGTH   9

Definition at line 694 of file defargs.l.

◆ MIN_HASH_VALUE

#define MIN_HASH_VALUE   3

Definition at line 695 of file defargs.l.

◆ MIN_WORD_LENGTH

#define MIN_WORD_LENGTH   3

Definition at line 693 of file defargs.l.

Referenced by KeywordHash::find().

◆ TOTAL_KEYWORDS

#define TOTAL_KEYWORDS   28

Definition at line 692 of file defargs.l.

◆ YY_INPUT

#define YY_INPUT ( buf,
result,
max_size )
Value:
result=yyread(yyscanner,buf,max_size);
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
Definition code.l:3982

Definition at line 113 of file defargs.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 71 of file defargs.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 72 of file defargs.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 49 of file defargs.l.

Typedef Documentation

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 51 of file defargs.l.

Function Documentation

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 116 of file defargs.l.

116{return __FILE__;}

◆ nameIsActuallyPartOfType()

bool nameIsActuallyPartOfType ( QCString & name)
static

Definition at line 814 of file defargs.l.

815{
816 return KeywordHash::find(name.data(),name.length())!=nullptr;
static const char * find(const char *str, size_t len)
Definition defargs.l:754
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:170
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:176
817}

References QCString::data(), KeywordHash::find(), and QCString::length().

◆ stateToString()

const char * stateToString ( int state)
static

◆ stringToArgumentList()

std::unique_ptr< ArgumentList > stringToArgumentList ( SrcLangExt lang,
const QCString & argsString,
QCString * extraTypeChars )

Converts an argument string into an ArgumentList.

Parameters
[in]langlanguage of the current argument list
[in]argsStringthe list of Arguments.
[out]extraTypeCharspoint to string to which trailing characters for complex types are written to

Definition at line 826 of file defargs.l.

827{
828 std::unique_ptr<ArgumentList> al = std::make_unique<ArgumentList>();
829 if (argsString.isEmpty()) return al;
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:167
830
831 yyscan_t yyscanner;
832 defargsYY_state extra(argsString.data(),al,lang);
833 defargsYYlex_init_extra(&extra,&yyscanner);
yyguts_t * yyscan_t
Definition code.l:24
834#ifdef FLEX_DEBUG
835 defargsYYset_debug(Debug::isFlagSet(Debug::Lex_defargs)?1:0,yyscanner);
@ Lex_defargs
Definition debug.h:59
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:133
836#endif
837 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
838 DebugLex debugLex(Debug::Lex_defargs, __FILE__, nullptr);
839
840 defargsYYrestart( nullptr, yyscanner );
841 BEGIN( Start );
842 defargsYYlex(yyscanner);
843 if (yyextra->argList->empty())
844 {
845 yyextra->argList->setNoParameters(TRUE);
846 }
847 if (extraTypeChars) *extraTypeChars=yyextra->extraTypeChars;
848 //printf("stringToArgumentList(%s) result=%s\n",argsString,qPrint(argListToString(*al)));
849 defargsYYlex_destroy(yyscanner);
850 return al;
#define TRUE
Definition qcstring.h:37
851}

References QCString::data(), QCString::isEmpty(), Debug::isFlagSet(), Debug::Lex_defargs, and TRUE.

Referenced by addClassToContext(), ClassDefImpl::addMemberToTemplateInstance(), buildDefineList(), buildFunctionList(), anonymous_namespace{tagreader.cpp}::TagFileParser::buildMemberList(), combineDeclarationAndDefinition(), computeTemplateClassRelations(), findTemplateInstanceRelation(), generateDEFForMember(), SymbolResolver::Private::getResolvedSymbol(), SymbolResolver::Private::getResolvedSymbolRec(), SymbolResolver::Private::getResolvedTypeRec(), MemberDefImpl::init(), ClassDefImpl::insertTemplateInstance(), and matchCanonicalTypes().

◆ yylex()

int yylex ( yyscan_t yyscanner)

Definition at line 155 of file defargs.l.

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().isEmpty())
168 {
169 yyextra->curArgAttrib=yytext; // for M$-IDL
170 }
171 else // array type
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;
180 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
181 BEGIN( CopyRawString );
182 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
Definition util.cpp:6952
183<ReadFuncArgDef>\" {
184 yyextra->curArgDefValue+=*yytext;
185 BEGIN( CopyArgString );
186 }
187<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
188 // function pointer as argument
189 yyextra->curArgTypeName+=yytext;
190 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
191 BEGIN( ReadFuncArgPtr );
192 }
193<ReadFuncArgPtr>{ID} {
194 yyextra->curArgName=yytext;
195 }
196<ReadFuncArgPtr>")"{B}*"(" { // function pointer
197 yyextra->curArgTypeName+=yytext;
198 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
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 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
208 BEGIN( ReadFuncArgType );
209 }
210<ReadFuncArgPtr>")" { // redundant braces detected / remove them
211 int i=yyextra->curArgTypeName.findRev('(');
212 int l=static_cast<int>(yyextra->curArgTypeName.length());
213 if (i!=-1)
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 }
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 // YY_START==ReadFuncArgDef
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 // yytext=='<'
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 // for e.g. < typename A = (i<<3) >
306 *yyextra->copyArgValue += yytext;
307 }
308 else
309 {
310 REJECT;
311 }
312 }
313<CopyArgSharp>">>" {
314 if (yyextra->argRoundCount>0)
315 {
316 // for e.g. < typename A = (i>>3) >
317 *yyextra->copyArgValue += yytext;
318 }
319 else
320 {
321 REJECT;
322 }
323 }
324<CopyArgSharp>"<" {
325 // don't count < inside (, e.g. for things like: < typename A=(i<6) >
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 // don't count > inside )
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;
369 if (extractEndRawStringDelimiter(yytext)==yyextra->delimiter)
370 {
371 BEGIN( ReadFuncArgDef );
372 }
373 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
Definition util.cpp:6960
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;
384 QCString text(yytext);
385 if (text.find("//")!=-1)
386 BEGIN( ReadDocLine );
387 else
388 BEGIN( ReadDocBlock );
389 }
This is an alternative implementation of QCString.
Definition qcstring.h:103
390<ReadFuncArgType,ReadFuncArgDef>[,)>] {
391 if (*yytext==')' && yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
392 {
393 yyextra->curArgTypeName+=*yytext;
394 BEGIN(FuncQual);
395 }
396 else
397 {
398 yyextra->curArgTypeName=removeRedundantWhiteSpace(yyextra->curArgTypeName);
399 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
400 //printf("curArgType='%s' curArgDefVal='%s'\n",qPrint(yyextra->curArgTypeName),qPrint(yyextra->curArgDefValue));
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--;
407 Argument a;
408 a.attrib = yyextra->curArgAttrib;
409 a.typeConstraint = yyextra->curTypeConstraint.stripWhiteSpace();
410 //printf("a->type=%s a->name=%s i=%d l=%d\n",
411 // qPrint(a->type),qPrint(a->name),i,l);
412 a.array.clear();
413 if (i==l-1 && yyextra->curArgTypeName.at(i)==')') // function argument
414 {
415 int bi=yyextra->curArgTypeName.find('(');
416 int fi=bi-1;
417 //printf("func arg fi=%d\n",fi);
418 while (fi>=0 && (isId(yyextra->curArgTypeName.at(fi)) || yyextra->curArgTypeName.at(fi)==':')) fi--;
419 if (fi>=0)
420 {
421 a.type = yyextra->curArgTypeName.left(fi+1);
422 a.name = yyextra->curArgTypeName.mid(fi+1,bi-fi-1).stripWhiteSpace();
423 a.array = yyextra->curArgTypeName.right(l-bi);
424 }
425 else
426 {
427 a.type = yyextra->curArgTypeName;
428 }
429 }
430 else if (i>=0 && yyextra->curArgTypeName.at(i)!=':')
431 { // type contains a name
432 a.type = removeRedundantWhiteSpace(yyextra->curArgTypeName.left(i+1)).stripWhiteSpace();
433 a.name = yyextra->curArgTypeName.right(l-i-1).stripWhiteSpace();
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:245
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:264
QCString right(size_t len) const
Definition qcstring.h:238
QCString left(size_t len) const
Definition qcstring.h:233
void clear()
Definition qcstring.h:186
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString type
Definition arguments.h:42
QCString name
Definition arguments.h:44
QCString array
Definition arguments.h:45
QCString typeConstraint
Definition arguments.h:48
QCString attrib
Definition arguments.h:41
QCString removeRedundantWhiteSpace(const QCString &s)
Definition util.cpp:567
bool isId(int c)
Definition util.h:256
434
435 // if the type becomes a type specifier only then we make a mistake
436 // and need to correct it to avoid seeing a nameless parameter
437 // "struct A" as a parameter with type "struct" and name "A".
438 int sv=0;
439 if (a.type.startsWith("const ")) sv=6;
440 else if (a.type.startsWith("volatile ")) sv=9;
bool startsWith(const char *s) const
Definition qcstring.h:511
441
442 if (a.type.mid(sv)=="struct" ||
443 a.type.mid(sv)=="union" ||
444 a.type.mid(sv)=="class" ||
445 a.type.mid(sv)=="typename" ||
446 a.type=="const" ||
447 a.type=="volatile" ||
449 )
450 {
451 a.type = a.type + " " + a.name;
452 a.name.clear();
453 }
454 //printf(" --> a->type='%s' a->name='%s'\n",qPrint(a->type),qPrint(a->name));
455 }
456 else // assume only the type was specified, try to determine name later
457 {
458 a.type = removeRedundantWhiteSpace(yyextra->curArgTypeName);
459 }
460 if (!a.type.isEmpty() && a.type.at(0)=='$') // typeless PHP name?
461 {
462 a.name = a.type;
463 a.type = "";
464 }
465 a.array += removeRedundantWhiteSpace(yyextra->curArgArray);
466 //printf("array=%s\n",qPrint(a->array));
467 size_t alen = a.array.length();
468 if (alen>2 && a.array.at(0)=='(' &&
469 a.array.at(alen-1)==')') // fix-up for int *(a[10])
470 {
471 i=a.array.find('[')-1;
472 a.array = a.array.mid(1,alen-2);
473 if (i>0 && a.name.isEmpty())
474 {
475 a.name = a.array.left(i).stripWhiteSpace();
476 a.array = a.array.mid(i);
477 }
478 }
479 a.defval = yyextra->curArgDefValue;
480 //printf("a->type=%s a->name=%s a->defval=\"%s\"\n",qPrint(a->type),qPrint(a->name),qPrint(a->defval));
481 a.docs = yyextra->curArgDocs.stripWhiteSpace();
482 //printf("Argument '%s' '%s' adding docs='%s'\n",qPrint(a->type),qPrint(a->name),qPrint(a->docs));
483 yyextra->argList->push_back(a);
484 }
485 yyextra->curArgAttrib.clear();
486 yyextra->curArgTypeName.clear();
487 yyextra->curArgDefValue.clear();
488 yyextra->curArgArray.clear();
489 yyextra->curArgDocs.clear();
490 yyextra->curTypeConstraint.clear();
491 if (*yytext==')')
492 {
493 BEGIN(FuncQual);
494 //printf(">>> end of argument list\n");
495 }
496 else
497 {
498 BEGIN( ReadFuncArgType );
499 }
500 }
501 }
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:597
static bool nameIsActuallyPartOfType(QCString &name)
Definition defargs.l:814
QCString defval
Definition arguments.h:46
QCString docs
Definition arguments.h:47
502<ReadFuncArgType,ReadFuncArgPtr>"extends" {
503 if (yyextra->lang!=SrcLangExt::Java)
504 {
505 REJECT;
506 }
507 else
508 {
509 yyextra->argSharpCount=0;
510 yyextra->curTypeConstraint.clear();
511 yyextra->lastExtendsContext=YY_START;
512 BEGIN(ReadTypeConstraint);
513 }
514 }
515<ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} {
516 QCString name(yytext);
517 if (YY_START==ReadFuncArgType && yyextra->curArgArray=="[]") // Java style array
518 {
519 yyextra->curArgTypeName+=" []";
520 yyextra->curArgArray.clear();
521 }
522 //printf("resolveName '%s'->'%s'\n",yytext,qPrint(name));
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 if (yytext[0]!='>' || yyextra->argSharpCount==0)
543 {
544 unput(*yytext);
545 BEGIN(yyextra->lastExtendsContext);
546 }
547 else
548 {
549 yyextra->curTypeConstraint+=yytext;
550 yyextra->argSharpCount--;
551 }
552 }
553<ReadTypeConstraint>"<" {
554 yyextra->curTypeConstraint+=yytext;
555 yyextra->argSharpCount++;
556 }
557<ReadTypeConstraint>. {
558 yyextra->curTypeConstraint+=yytext;
559 }
560<ReadTypeConstraint>\n {
561 yyextra->curTypeConstraint+=' ';
562 }
563<FuncQual>"const" {
564 yyextra->argList->setConstSpecifier(TRUE);
565 }
566<FuncQual>"volatile" {
567 yyextra->argList->setVolatileSpecifier(TRUE);
568 }
569<FuncQual>"override" {
570 }
571<FuncQual>"&" {
572 yyextra->argList->setRefQualifier(RefQualifierType::LValue);
573 }
574<FuncQual>"&&" {
575 yyextra->argList->setRefQualifier(RefQualifierType::RValue);
576 }
577<FuncQual,TrailingReturn>"="{B}*"0" {
578 yyextra->argList->setPureSpecifier(TRUE);
579 BEGIN(FuncQual);
580 }
581<FuncQual>"->" { // C++11 trailing return type
582 yyextra->argList->setTrailingReturnType(QCString(" -> "));
583 BEGIN(TrailingReturn);
584 }
585<TrailingReturn>{B}/("final"|"override"){B}* {
586 unput(*yytext);
587 BEGIN(FuncQual);
588 }
589<TrailingReturn>. {
590 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
591 }
592<TrailingReturn>\n {
593 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
594 }
595<FuncQual>")"{B}*"["[^]]*"]" { // for functions returning a pointer to an array,
596 // i.e. ")[]" in "int (*f(int))[4]" with argsString="(int))[4]"
597 yyextra->extraTypeChars=yytext;
598 }
599<ReadDocBlock>[^\*\n]+ {
600 yyextra->curArgDocs+=yytext;
601 }
602<ReadDocLine>[^\n]+ {
603 yyextra->curArgDocs+=yytext;
604 }
605<ReadDocBlock>{CCE} {
606 if (yyextra->lastDocChar!=0)
607 unput(yyextra->lastDocChar);
608 BEGIN(yyextra->lastDocContext);
609 }
610<ReadDocLine>\n {
611 if (yyextra->lastDocChar!=0)
612 unput(yyextra->lastDocChar);
613 BEGIN(yyextra->lastDocContext);
614 }
615<ReadDocBlock>\n {
616 yyextra->curArgDocs+=*yytext;
617 }
618<ReadDocBlock>. {
619 yyextra->curArgDocs+=*yytext;
620 }
621<*>({CCS}[*!]|{CPPC}[/!])("<"?) {
622 yyextra->lastDocContext=YY_START;
623 yyextra->lastDocChar=0;
624 if (yytext[1]=='/')
625 BEGIN( ReadDocLine );
626 else
627 BEGIN( ReadDocBlock );
628 }
629<*>\n
630<*>.
631
632%%

◆ yyread()

int yyread ( yyscan_t yyscanner,
char * buf,
int max_size )
static

Definition at line 637 of file defargs.l.

638{
639 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
640 int c=0;
641 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
642 {
643 *buf = yyextra->inputString[yyextra->inputPosition++] ;
644 c++; buf++;
645 }
646 return c;
647}