42%option never-interactive
43%option prefix="defargsYY"
45%option extra-type="struct defargsYY_state *"
49#define YY_TYPEDEF_YY_SCANNER_T
72#define YY_NO_UNISTD_H 1
113#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
117#define LEX_NO_INPUT_FILENAME
This is an alternative implementation of QCString.
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static const char * stateToString(int state)
static bool nameIsActuallyPartOfType(QCString &name)
static const char * getLexerFILE()
QCString curTypeConstraint
std::unique_ptr< ArgumentList > & argList
defargsYY_state(const char *inStr, std::unique_ptr< ArgumentList > &al, SrcLangExt l)
SrcLangExt
Language as given by extension.
A bunch of utility functions.
124ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
125RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
126RAWEND ")"[^ \t\(\)\\]{0,16}\"
157<Start>[<(] { BEGIN(ReadFuncArgType); }
159<ReadFuncArgType>{B}* {
160 yyextra->curArgTypeName+=
" ";
162<ReadFuncArgType>"["[^\]]*"]" {
163 if (yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
165 yyextra->curArgAttrib=yytext;
169 yyextra->curArgArray+=yytext;
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;
177 int i=text.find(
'"');
178 yyextra->delimiter = yytext+i+1;
179 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
180 BEGIN( CopyRawString );
183 yyextra->curArgDefValue+=*yytext;
184 BEGIN( CopyArgString );
186<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
188 yyextra->curArgTypeName+=yytext;
190 BEGIN( ReadFuncArgPtr );
192<ReadFuncArgPtr>{ID} {
193 yyextra->curArgName=yytext;
195<ReadFuncArgPtr>")"{B}*"(" {
196 yyextra->curArgTypeName+=yytext;
198 yyextra->readArgContext = ReadFuncArgType;
199 yyextra->copyArgValue=&yyextra->curArgTypeName;
200 yyextra->argRoundCount=0;
201 BEGIN( CopyArgRound2 );
203<ReadFuncArgPtr>")"/{B}*"[" {
204 yyextra->curArgTypeName+=yytext;
205 yyextra->curArgTypeName+=yyextra->curArgName;
207 BEGIN( ReadFuncArgType );
210 int i=yyextra->curArgTypeName.findRev(
'(');
211 int l=
static_cast<int>(yyextra->curArgTypeName.length());
214 yyextra->curArgTypeName=yyextra->curArgTypeName.left(i)+
215 yyextra->curArgTypeName.right(l-i-1);
217 yyextra->curArgTypeName+=yyextra->curArgName;
218 BEGIN( ReadFuncArgType );
220<ReadFuncArgType>"<="|">="|"->"|">>"|"<<" {
221 yyextra->curArgTypeName+=yytext;
223<ReadFuncArgType,ReadFuncArgDef>[({<\[] {
224 if (YY_START==ReadFuncArgType)
226 yyextra->curArgTypeName+=*yytext;
227 yyextra->copyArgValue=&yyextra->curArgTypeName;
231 yyextra->curArgDefValue+=*yytext;
232 yyextra->copyArgValue=&yyextra->curArgDefValue;
234 yyextra->readArgContext = YY_START;
237 yyextra->argRoundCount=0;
238 BEGIN( CopyArgRound );
240 else if (*yytext==
'[')
242 yyextra->argSquareCount=0;
243 BEGIN( CopyArgSquare );
245 else if (*yytext==
'{')
247 yyextra->argCurlyCount=0;
248 BEGIN( CopyArgCurly );
252 yyextra->argSharpCount=0;
253 yyextra->argRoundCount=0;
254 BEGIN( CopyArgSharp );
257<CopyArgRound,CopyArgRound2>"(" {
258 yyextra->argRoundCount++;
259 *yyextra->copyArgValue += *yytext;
261<CopyArgRound,CopyArgRound2>")"({B}*{ID})* {
262 *yyextra->copyArgValue += yytext;
263 if (yyextra->argRoundCount>0)
265 yyextra->argRoundCount--;
269 if (YY_START==CopyArgRound2)
271 *yyextra->copyArgValue+=
" "+yyextra->curArgName;
273 BEGIN( yyextra->readArgContext );
276<CopyArgRound>")"/{B}* {
277 *yyextra->copyArgValue += *yytext;
278 if (yyextra->argRoundCount>0) yyextra->argRoundCount--;
279 else BEGIN( yyextra->readArgContext );
282 yyextra->argSquareCount++;
283 *yyextra->copyArgValue += *yytext;
285<CopyArgSquare>"]"({B}*{ID})* {
286 *yyextra->copyArgValue += yytext;
287 if (yyextra->argSquareCount>0)
289 yyextra->argRoundCount--;
293 BEGIN( yyextra->readArgContext );
296<CopyArgSquare>"]"/{B}* {
297 *yyextra->copyArgValue += *yytext;
298 if (yyextra->argSquareCount>0) yyextra->argSquareCount--;
299 else BEGIN( yyextra->readArgContext );
302 if (yyextra->argRoundCount>0)
305 *yyextra->copyArgValue += yytext;
313 if (yyextra->argRoundCount>0)
316 *yyextra->copyArgValue += yytext;
325 if (yyextra->argRoundCount==0) yyextra->argSharpCount++;
326 *yyextra->copyArgValue += *yytext;
329 *yyextra->copyArgValue += *yytext;
330 if (yyextra->argRoundCount>0 && yyextra->argSharpCount==0)
336 if (yyextra->argSharpCount>0)
338 yyextra->argSharpCount--;
342 BEGIN( yyextra->readArgContext );
347 yyextra->argRoundCount++;
348 *yyextra->copyArgValue += *yytext;
351 yyextra->argRoundCount--;
352 *yyextra->copyArgValue += *yytext;
355 yyextra->argCurlyCount++;
356 *yyextra->copyArgValue += *yytext;
359 *yyextra->copyArgValue += *yytext;
360 if (yyextra->argCurlyCount>0) yyextra->argCurlyCount--;
361 else BEGIN( yyextra->readArgContext );
364 yyextra->curArgDefValue+=yytext;
366<CopyRawString>{RAWEND} {
367 yyextra->curArgDefValue+=yytext;
369 delimiter=delimiter.left(delimiter.length()-1);
370 if (delimiter==yyextra->delimiter)
372 BEGIN( ReadFuncArgDef );
376 yyextra->curArgDefValue+=*yytext;
377 BEGIN( ReadFuncArgDef );
379<ReadFuncArgType>"=" {
380 BEGIN( ReadFuncArgDef );
382<ReadFuncArgType,ReadFuncArgDef>[,)>]{B}*({CCS}[*!]|{CPPC}[/!])"<" {
383 yyextra->lastDocContext=YY_START;
384 yyextra->lastDocChar=*yytext;
386 if (text.find(
"//")!=-1)
387 BEGIN( ReadDocLine );
389 BEGIN( ReadDocBlock );
391<ReadFuncArgType,ReadFuncArgDef>[,)>] {
392 if (*yytext==
')' && yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
394 yyextra->curArgTypeName+=*yytext;
400 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
402 int l =
static_cast<int>(yyextra->curArgTypeName.length());
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--;
409 a.
attrib = yyextra->curArgAttrib;
414 if (i==l-1 && yyextra->curArgTypeName.at(i)==
')')
416 int bi=yyextra->curArgTypeName.find(
'(');
419 while (fi>=0 && (
isId(yyextra->curArgTypeName.at(fi)) || yyextra->curArgTypeName.at(fi)==
':')) fi--;
422 a.
type = yyextra->curArgTypeName.
left(fi+1);
424 a.
array = yyextra->curArgTypeName.
right(l-bi);
428 a.
type = yyextra->curArgTypeName;
431 else if (i>=0 && yyextra->curArgTypeName.at(i)!=
':')
443 if (a.
type.
mid(sv)==
"struct" ||
448 a.
type==
"volatile" ||
469 if (alen>2 && a.
array.
at(0)==
'(' &&
480 a.
defval = yyextra->curArgDefValue;
484 yyextra->argList->push_back(a);
486 yyextra->curArgAttrib.clear();
487 yyextra->curArgTypeName.clear();
488 yyextra->curArgDefValue.clear();
489 yyextra->curArgArray.clear();
490 yyextra->curArgDocs.clear();
491 yyextra->curTypeConstraint.clear();
499 BEGIN( ReadFuncArgType );
int find(char c, int index=0, bool cs=TRUE) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) const
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString right(size_t len) const
QCString left(size_t len) const
This class contains the information about the argument of a function or template.
QCString removeRedundantWhiteSpace(const QCString &s)
503<ReadFuncArgType,ReadFuncArgPtr>"extends" {
510 yyextra->curTypeConstraint.clear();
511 yyextra->lastExtendsContext=YY_START;
512 BEGIN(ReadTypeConstraint);
515<ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} {
517 if (YY_START==ReadFuncArgType && yyextra->curArgArray==
"[]")
519 yyextra->curArgTypeName+=
" []";
520 yyextra->curArgArray.clear();
523 yyextra->curArgTypeName+=name;
525<ReadFuncArgType,ReadFuncArgPtr>. {
526 yyextra->curArgTypeName+=*yytext;
529<ReadFuncArgDef,CopyArgString>"<="|"->"|">="|">>"|"<<" {
530 yyextra->curArgDefValue+=yytext;
532<ReadFuncArgDef,CopyArgString,CopyRawString>. {
533 yyextra->curArgDefValue+=*yytext;
535<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>{ID} {
536 *yyextra->copyArgValue+=yytext;
538<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>. {
539 *yyextra->copyArgValue += *yytext;
541<ReadTypeConstraint>[,)>] {
543 BEGIN(yyextra->lastExtendsContext);
545<ReadTypeConstraint>. {
546 yyextra->curTypeConstraint+=yytext;
548<ReadTypeConstraint>\n {
549 yyextra->curTypeConstraint+=
' ';
552 yyextra->argList->setConstSpecifier(
TRUE);
554<FuncQual>"volatile" {
555 yyextra->argList->setVolatileSpecifier(
TRUE);
557<FuncQual>"override" {
565<FuncQual,TrailingReturn>"="{B}*"0" {
566 yyextra->argList->setPureSpecifier(
TRUE);
570 yyextra->argList->setTrailingReturnType(
QCString(
" -> "));
571 BEGIN(TrailingReturn);
573<TrailingReturn>{B}/("final"|"override"){B}* {
578 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
581 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
583<FuncQual>")"{B}*"["[^]]*"]" {
585 yyextra->extraTypeChars=yytext;
587<ReadDocBlock>[^\*\n]+ {
588 yyextra->curArgDocs+=yytext;
591 yyextra->curArgDocs+=yytext;
594 if (yyextra->lastDocChar!=0)
595 unput(yyextra->lastDocChar);
596 BEGIN(yyextra->lastDocContext);
599 if (yyextra->lastDocChar!=0)
600 unput(yyextra->lastDocChar);
601 BEGIN(yyextra->lastDocContext);
604 yyextra->curArgDocs+=*yytext;
607 yyextra->curArgDocs+=*yytext;
609<*>({CCS}[*!]|{CPPC}[/!])("<"?) {
610 yyextra->lastDocContext=YY_START;
611 yyextra->lastDocChar=0;
613 BEGIN( ReadDocLine );
615 BEGIN( ReadDocBlock );
627 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
629 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
631 *buf = yyextra->inputString[yyextra->inputPosition++] ;
680#define TOTAL_KEYWORDS 28
681#define MIN_WORD_LENGTH 3
682#define MAX_WORD_LENGTH 9
683#define MIN_HASH_VALUE 3
684#define MAX_HASH_VALUE 48
690 static inline size_t hash (
const char *str,
size_t len);
692 static const char *
find (
const char *str,
size_t len);
697 static const unsigned char asso_values[] =
699 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
700 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
701 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
702 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
703 49, 49, 49, 49, 49, 49, 49, 49, 49, 5,
704 5, 30, 0, 49, 25, 49, 10, 49, 49, 49,
705 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
706 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
707 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
708 49, 49, 49, 49, 49, 0, 49, 0, 5, 49,
709 15, 0, 49, 10, 49, 30, 49, 49, 0, 20,
710 0, 49, 15, 49, 5, 10, 0, 49, 49, 49,
711 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
712 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
713 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
714 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
715 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
716 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
717 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
718 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
719 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
720 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
721 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
722 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
723 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
724 49, 49, 49, 49, 49, 49
731 hval += asso_values[
static_cast<unsigned char>(str[4])];
734 hval += asso_values[
static_cast<unsigned char>(str[3])];
744 static const char *
const wordlist[] =
786 size_t key =
hash (str, len);
790 const char *s = wordlist[key];
792 if (*str == *s && !
qstrcmp (str + 1, s + 1))
816 std::unique_ptr<ArgumentList> al = std::make_unique<ArgumentList>();
817 if (argsString.
isEmpty())
return al;
821 defargsYYlex_init_extra(&extra,&yyscanner);
825 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
828 defargsYYrestart(
nullptr, yyscanner );
830 defargsYYlex(yyscanner);
831 if (yyextra->argList->empty())
833 yyextra->argList->setNoParameters(
TRUE);
835 if (extraTypeChars) *extraTypeChars=yyextra->extraTypeChars;
837 defargsYYlex_destroy(yyscanner);
841#include "defargs.l.h"
static bool isFlagSet(const DebugMask mask)
static size_t hash(const char *str, size_t len)
static const char * find(const char *str, size_t len)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars)
int qstrcmp(const char *str1, const char *str2)