Doxygen
Loading...
Searching...
No Matches
defargs.l File Reference
#include <stdint.h>
#include "defargs.h"
#include "arguments.h"
#include "debug.h"
#include "entry.h"
#include "message.h"
#include "util.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 (DString &name)
static const char * getLexerFILE ()
int yylex (yyscan_t yyscanner)
std::unique_ptr< ArgumentListstringToArgumentList (SrcLangExt lang, const DString &argsString, DString *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 110 of file defargs.l.

◆ MAX_HASH_VALUE

#define MAX_HASH_VALUE   48

Definition at line 691 of file defargs.l.

Referenced by KeywordHash::find().

◆ MAX_WORD_LENGTH

#define MAX_WORD_LENGTH   9

Definition at line 689 of file defargs.l.

◆ MIN_HASH_VALUE

#define MIN_HASH_VALUE   3

Definition at line 690 of file defargs.l.

◆ MIN_WORD_LENGTH

#define MIN_WORD_LENGTH   3

Definition at line 688 of file defargs.l.

Referenced by KeywordHash::find().

◆ TOTAL_KEYWORDS

#define TOTAL_KEYWORDS   28

Definition at line 687 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:3981

Definition at line 106 of file defargs.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 64 of file defargs.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 65 of file defargs.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 47 of file defargs.l.

Typedef Documentation

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 49 of file defargs.l.

Function Documentation

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 109 of file defargs.l.

109{return __FILE__;}

◆ nameIsActuallyPartOfType()

bool nameIsActuallyPartOfType ( DString & name)
static

Definition at line 809 of file defargs.l.

810{
811 return KeywordHash::find(name.data(),name.length())!=nullptr;
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
static const char * find(const char *str, size_t len)
Definition defargs.l:749
812}

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

◆ stateToString()

const char * stateToString ( int state)
static

◆ stringToArgumentList()

std::unique_ptr< ArgumentList > stringToArgumentList ( SrcLangExt lang,
const DString & argsString,
DString * 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 821 of file defargs.l.

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

References DString::data(), DString::empty(), Debug::isFlagSet(), and Debug::Lex_defargs.

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

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; // for M$-IDL
163 }
164 else // array type
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;
173 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
174 BEGIN( CopyRawString );
175 }
DString extractBeginRawStringDelimiter(const char *rawStart)
Definition util.cpp:5339
176<ReadFuncArgDef>\" {
177 yyextra->curArgDefValue+=*yytext;
178 BEGIN( CopyArgString );
179 }
180<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
181 // function pointer as argument
182 yyextra->curArgTypeName+=yytext;
183 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
184 BEGIN( ReadFuncArgPtr );
185 }
186<ReadFuncArgPtr>{ID} {
187 yyextra->curArgName=yytext;
188 }
189<ReadFuncArgPtr>")"{B}*"(" { // function pointer
190 yyextra->curArgTypeName+=yytext;
191 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
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 //yyextra->curArgTypeName=yyextra->curArgTypeName.simplifyWhiteSpace();
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();
206 if (i!=DString::npos)
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
Definition dstring.h:178
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 // YY_START==ReadFuncArgDef
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 // yytext=='<'
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 // for e.g. < typename A = (i<<3) >
299 *yyextra->copyArgValue += yytext;
300 }
301 else
302 {
303 REJECT;
304 }
305 }
306<CopyArgSharp>">>" {
307 if (yyextra->argRoundCount>0)
308 {
309 // for e.g. < typename A = (i>>3) >
310 *yyextra->copyArgValue += yytext;
311 }
312 else
313 {
314 REJECT;
315 }
316 }
317<CopyArgSharp>"<" {
318 // don't count < inside (, e.g. for things like: < typename A=(i<6) >
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 // don't count > inside )
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;
362 if (extractEndRawStringDelimiter(yytext)==yyextra->delimiter)
363 {
364 BEGIN( ReadFuncArgDef );
365 }
366 }
DString extractEndRawStringDelimiter(const char *rawEnd)
Definition util.cpp:5347
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;
377 DString text(yytext);
378 if (text.find("//")!=DString::npos)
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...
Definition dstring.h:84
383<ReadFuncArgType,ReadFuncArgDef>[,)>] {
384 if (*yytext==')' && yyextra->curArgTypeName.stripWhiteSpace().empty())
385 {
386 yyextra->curArgTypeName+=*yytext;
387 BEGIN(FuncQual);
388 }
389 else
390 {
391 yyextra->curArgTypeName=removeRedundantWhiteSpace(yyextra->curArgTypeName);
392 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
393 //printf("curArgType='%s' curArgDefVal='%s'\n",qPrint(yyextra->curArgTypeName),qPrint(yyextra->curArgDefValue));
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--;
400 Argument a;
401 a.attrib = yyextra->curArgAttrib;
402 a.typeConstraint = yyextra->curTypeConstraint.stripWhiteSpace();
403 //printf("a->type=%s a->name=%s i=%d l=%d\n",
404 // qPrint(a->type),qPrint(a->name),i,l);
405 a.array.clear();
406 if (i==l-1 && yyextra->curArgTypeName.at(i)==')') // function argument
407 {
408 size_t bis=yyextra->curArgTypeName.find('(');
409 int bi = bis!=DString::npos ? static_cast<int>(bis) : -1;
410 int fi = bi-1;
411 //printf("func arg fi=%d\n",fi);
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);
416 a.name = yyextra->curArgTypeName.mid(fi+1,bi-fi-1).stripWhiteSpace();
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 { // type contains a name
426 a.type = removeRedundantWhiteSpace(yyextra->curArgTypeName.left(i+1)).stripWhiteSpace();
427 a.name = yyextra->curArgTypeName.right(l-i-1).stripWhiteSpace();
This class contains the information about the argument of a function or template.
Definition arguments.h:27
DString typeConstraint
Definition arguments.h:49
DString attrib
Definition arguments.h:42
DString array
Definition arguments.h:46
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
void clear()
Definition dstring.h:214
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
DString right(size_t len) const
Definition dstring.h:311
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
DString left(size_t len) const
Definition dstring.h:306
bool isId(int c)
Returns true if c is a valid character for an identifier.
Definition dstring.h:895
DString removeRedundantWhiteSpace(const DString &s)
Definition util.cpp:426
428
429 // if the type becomes a type specifier only then we make a mistake
430 // and need to correct it to avoid seeing a nameless parameter
431 // "struct A" as a parameter with type "struct" and name "A".
432 int sv=0;
433 if (a.type.startsWith("const ")) sv=6;
434 else if (a.type.startsWith("volatile ")) sv=9;
bool startsWith(const char *s) const
Definition dstring.h:600
435
436 if (a.type.mid(sv)=="struct" ||
437 a.type.mid(sv)=="union" ||
438 a.type.mid(sv)=="class" ||
439 a.type.mid(sv)=="typename" ||
440 a.type=="const" ||
441 a.type=="volatile" ||
443 )
444 {
445 a.type = a.type + " " + a.name;
446 a.name.clear();
447 }
448 //printf(" --> a->type='%s' a->name='%s'\n",qPrint(a->type),qPrint(a->name));
449 }
450 else // assume only the type was specified, try to determine name later
451 {
452 a.type = removeRedundantWhiteSpace(yyextra->curArgTypeName);
453 }
454 if (!a.type.empty() && a.type.at(0)=='$') // typeless PHP name?
455 {
456 a.name = a.type;
457 a.type = "";
458 }
459 a.array += removeRedundantWhiteSpace(yyextra->curArgArray);
460 //printf("array=%s\n",qPrint(a->array));
461 size_t alen = a.array.length();
462 if (alen>2 && a.array.at(0)=='(' &&
463 a.array.at(alen-1)==')') // fix-up for int *(a[10])
464 {
465 size_t pi=a.array.find('[');
466 i = pi!=DString::npos ? static_cast<int>(pi-1) : -1;
467 a.array = a.array.mid(1,alen-2);
468 if (i>0 && a.name.empty())
469 {
470 a.name = a.array.left(i).stripWhiteSpace();
471 a.array = a.array.mid(i);
472 }
473 }
474 a.defval = yyextra->curArgDefValue;
475 //printf("a->type=%s a->name=%s a->defval=\"%s\"\n",qPrint(a->type),qPrint(a->name),qPrint(a->defval));
476 a.docs = yyextra->curArgDocs.stripWhiteSpace();
477 //printf("Argument '%s' '%s' adding docs='%s'\n",qPrint(a->type),qPrint(a->name),qPrint(a->docs));
478 yyextra->argList->push_back(a);
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 //printf(">>> end of argument list\n");
490 }
491 else
492 {
493 BEGIN( ReadFuncArgType );
494 }
495 }
496 }
DString docs
Definition arguments.h:48
DString defval
Definition arguments.h:47
void push_back(char c)
Definition dstring.h:202
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
static bool nameIsActuallyPartOfType(DString &name)
Definition defargs.l:809
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} {
511 DString name(yytext);
512 if (YY_START==ReadFuncArgType && yyextra->curArgArray=="[]") // Java style array
513 {
514 yyextra->curArgTypeName+=" []";
515 yyextra->curArgArray.clear();
516 }
517 //printf("resolveName '%s'->'%s'\n",yytext,qPrint(name));
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>"&" {
567 yyextra->argList->setRefQualifier(RefQualifierType::LValue);
568 }
569<FuncQual>"&&" {
570 yyextra->argList->setRefQualifier(RefQualifierType::RValue);
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 // i.e. ")[]" in "int (*f(int))[4]" with argsString="(int))[4]"
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%%

◆ yyread()

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

Definition at line 632 of file defargs.l.

633{
634 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
635 int c=0;
636 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
637 {
638 *buf = yyextra->inputString[yyextra->inputPosition++] ;
639 c++; buf++;
640 }
641 return c;
642}