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 684 of file defargs.l.

Referenced by KeywordHash::find().

◆ MAX_WORD_LENGTH

#define MAX_WORD_LENGTH   9

Definition at line 682 of file defargs.l.

◆ MIN_HASH_VALUE

#define MIN_HASH_VALUE   3

Definition at line 683 of file defargs.l.

◆ MIN_WORD_LENGTH

#define MIN_WORD_LENGTH   3

Definition at line 681 of file defargs.l.

Referenced by KeywordHash::find().

◆ TOTAL_KEYWORDS

#define TOTAL_KEYWORDS   28

Definition at line 680 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 defargs.l:625

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()

static const char * getLexerFILE ( )
inlinestatic

Definition at line 116 of file defargs.l.

116{return __FILE__;}

◆ nameIsActuallyPartOfType()

static bool nameIsActuallyPartOfType ( QCString & name)
static

Definition at line 802 of file defargs.l.

803{
804 return KeywordHash::find(name.data(),name.length())!=nullptr;
static const char * find(const char *str, size_t len)
Definition defargs.l:742
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
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:159
805}

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

◆ stateToString()

static 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 814 of file defargs.l.

815{
816 std::unique_ptr<ArgumentList> al = std::make_unique<ArgumentList>();
817 if (argsString.isEmpty()) return al;
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
818
819 yyscan_t yyscanner;
820 defargsYY_state extra(argsString.data(),al,lang);
821 defargsYYlex_init_extra(&extra,&yyscanner);
yyguts_t * yyscan_t
Definition code.l:24
822#ifdef FLEX_DEBUG
823 defargsYYset_debug(Debug::isFlagSet(Debug::Lex_defargs)?1:0,yyscanner);
@ Lex_defargs
Definition debug.h:57
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:135
824#endif
825 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
826 DebugLex debugLex(Debug::Lex_defargs, __FILE__, nullptr);
827
828 defargsYYrestart( nullptr, yyscanner );
829 BEGIN( Start );
830 defargsYYlex(yyscanner);
831 if (yyextra->argList->empty())
832 {
833 yyextra->argList->setNoParameters(TRUE);
834 }
835 if (extraTypeChars) *extraTypeChars=yyextra->extraTypeChars;
836 //printf("stringToArgumentList(%s) result=%s\n",argsString,qPrint(argListToString(*al)));
837 defargsYYlex_destroy(yyscanner);
838 return al;
#define TRUE
Definition qcstring.h:37
839}

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

Referenced by addClassToContext(), ClassDefImpl::addMembersToTemplateInstance(), buildDefineList(), buildFunctionList(), anonymous_namespace{tagreader.cpp}::TagFileParser::buildMemberList(), combineDeclarationAndDefinition(), computeTemplateClassRelations(), findMembersWithSpecificName(), findTemplateInstanceRelation(), generateDEFForMember(), getDefsOld(), SymbolResolver::Private::getResolvedSymbol(), SymbolResolver::Private::getResolvedSymbolRec(), SymbolResolver::Private::getResolvedTypeRec(), MemberDefImpl::init(), 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>"["[^\]]*"]" {
163 if (yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
164 {
165 yyextra->curArgAttrib=yytext; // for M$-IDL
166 }
167 else // array type
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;
176 QCString text(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.
Definition qcstring.h:101
182<ReadFuncArgDef>\" {
183 yyextra->curArgDefValue+=*yytext;
184 BEGIN( CopyArgString );
185 }
186<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
187 // function pointer as argument
188 yyextra->curArgTypeName+=yytext;
189 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
190 BEGIN( ReadFuncArgPtr );
191 }
192<ReadFuncArgPtr>{ID} {
193 yyextra->curArgName=yytext;
194 }
195<ReadFuncArgPtr>")"{B}*"(" { // function pointer
196 yyextra->curArgTypeName+=yytext;
197 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
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 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
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 // YY_START==ReadFuncArgDef
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 // yytext=='<'
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 // for e.g. < typename A = (i<<3) >
305 *yyextra->copyArgValue += yytext;
306 }
307 else
308 {
309 REJECT;
310 }
311 }
312<CopyArgSharp>">>" {
313 if (yyextra->argRoundCount>0)
314 {
315 // for e.g. < typename A = (i>>3) >
316 *yyextra->copyArgValue += yytext;
317 }
318 else
319 {
320 REJECT;
321 }
322 }
323<CopyArgSharp>"<" {
324 // don't count < inside (, e.g. for things like: < typename A=(i<6) >
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 // don't count > inside )
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;
368 QCString delimiter(yytext+1);
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;
385 QCString text(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 {
399 yyextra->curArgTypeName=removeRedundantWhiteSpace(yyextra->curArgTypeName);
400 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
401 //printf("curArgType='%s' curArgDefVal='%s'\n",qPrint(yyextra->curArgTypeName),qPrint(yyextra->curArgDefValue));
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--;
408 Argument a;
409 a.attrib = yyextra->curArgAttrib;
410 a.typeConstraint = yyextra->curTypeConstraint.stripWhiteSpace();
411 //printf("a->type=%s a->name=%s i=%d l=%d\n",
412 // qPrint(a->type),qPrint(a->name),i,l);
413 a.array.clear();
414 if (i==l-1 && yyextra->curArgTypeName.at(i)==')') // function argument
415 {
416 int bi=yyextra->curArgTypeName.find('(');
417 int fi=bi-1;
418 //printf("func arg fi=%d\n",fi);
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);
423 a.name = yyextra->curArgTypeName.mid(fi+1,bi-fi-1).stripWhiteSpace();
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 { // type contains a name
433 a.type = removeRedundantWhiteSpace(yyextra->curArgTypeName.left(i+1)).stripWhiteSpace();
434 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:226
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
QCString right(size_t len) const
Definition qcstring.h:219
QCString left(size_t len) const
Definition qcstring.h:214
void clear()
Definition qcstring.h:169
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString type
Definition arguments.h:37
QCString name
Definition arguments.h:39
QCString array
Definition arguments.h:40
QCString typeConstraint
Definition arguments.h:43
QCString attrib
Definition arguments.h:36
QCString removeRedundantWhiteSpace(const QCString &s)
Definition util.cpp:578
bool isId(int c)
Definition util.h:202
435
436 // if the type becomes a type specifier only then we make a mistake
437 // and need to correct it to avoid seeing a nameless parameter
438 // "struct A" as a parameter with type "struct" and name "A".
439 int sv=0;
440 if (a.type.startsWith("const ")) sv=6;
441 else if (a.type.startsWith("volatile ")) sv=9;
bool startsWith(const char *s) const
Definition qcstring.h:492
442
443 if (a.type.mid(sv)=="struct" ||
444 a.type.mid(sv)=="union" ||
445 a.type.mid(sv)=="class" ||
446 a.type.mid(sv)=="typename" ||
447 a.type=="const" ||
448 a.type=="volatile" ||
450 )
451 {
452 a.type = a.type + " " + a.name;
453 a.name.clear();
454 }
455 //printf(" --> a->type='%s' a->name='%s'\n",qPrint(a->type),qPrint(a->name));
456 }
457 else // assume only the type was specified, try to determine name later
458 {
459 a.type = removeRedundantWhiteSpace(yyextra->curArgTypeName);
460 }
461 if (!a.type.isEmpty() && a.type.at(0)=='$') // typeless PHP name?
462 {
463 a.name = a.type;
464 a.type = "";
465 }
466 a.array += removeRedundantWhiteSpace(yyextra->curArgArray);
467 //printf("array=%s\n",qPrint(a->array));
468 size_t alen = a.array.length();
469 if (alen>2 && a.array.at(0)=='(' &&
470 a.array.at(alen-1)==')') // fix-up for int *(a[10])
471 {
472 i=a.array.find('[')-1;
473 a.array = a.array.mid(1,alen-2);
474 if (i>0 && a.name.isEmpty())
475 {
476 a.name = a.array.left(i).stripWhiteSpace();
477 a.array = a.array.mid(i);
478 }
479 }
480 a.defval = yyextra->curArgDefValue;
481 //printf("a->type=%s a->name=%s a->defval=\"%s\"\n",qPrint(a->type),qPrint(a->name),qPrint(a->defval));
482 a.docs = yyextra->curArgDocs.stripWhiteSpace();
483 //printf("Argument '%s' '%s' adding docs='%s'\n",qPrint(a->type),qPrint(a->name),qPrint(a->docs));
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 //printf(">>> end of argument list\n");
496 }
497 else
498 {
499 BEGIN( ReadFuncArgType );
500 }
501 }
502 }
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:578
static bool nameIsActuallyPartOfType(QCString &name)
Definition defargs.l:802
QCString defval
Definition arguments.h:41
QCString docs
Definition arguments.h:42
503<ReadFuncArgType,ReadFuncArgPtr>"extends" {
504 if (yyextra->lang!=SrcLangExt::Java)
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} {
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 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>"&" {
560 yyextra->argList->setRefQualifier(RefQualifierType::LValue);
561 }
562<FuncQual>"&&" {
563 yyextra->argList->setRefQualifier(RefQualifierType::RValue);
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 // i.e. ")[]" in "int (*f(int))[4]" with argsString="(int))[4]"
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%%

◆ yyread()

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

Definition at line 625 of file defargs.l.

626{
627 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
628 int c=0;
629 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
630 {
631 *buf = yyextra->inputString[yyextra->inputPosition++] ;
632 c++; buf++;
633 }
634 return c;
635}