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)
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 BEGIN( CopyRawString );
QCString extractBeginRawStringDelimiter(const char *rawStart)
180 yyextra->curArgDefValue+=*yytext;
181 BEGIN( CopyArgString );
183<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
185 yyextra->curArgTypeName+=yytext;
187 BEGIN( ReadFuncArgPtr );
189<ReadFuncArgPtr>{ID} {
190 yyextra->curArgName=yytext;
192<ReadFuncArgPtr>")"{B}*"(" {
193 yyextra->curArgTypeName+=yytext;
195 yyextra->readArgContext = ReadFuncArgType;
196 yyextra->copyArgValue=&yyextra->curArgTypeName;
197 yyextra->argRoundCount=0;
198 BEGIN( CopyArgRound2 );
200<ReadFuncArgPtr>")"/{B}*"[" {
201 yyextra->curArgTypeName+=yytext;
202 yyextra->curArgTypeName+=yyextra->curArgName;
204 BEGIN( ReadFuncArgType );
207 int i=yyextra->curArgTypeName.findRev(
'(');
208 int l=
static_cast<int>(yyextra->curArgTypeName.length());
211 yyextra->curArgTypeName=yyextra->curArgTypeName.left(i)+
212 yyextra->curArgTypeName.right(l-i-1);
214 yyextra->curArgTypeName+=yyextra->curArgName;
215 BEGIN( ReadFuncArgType );
217<ReadFuncArgType>"<="|">="|"->"|">>"|"<<" {
218 yyextra->curArgTypeName+=yytext;
220<ReadFuncArgType,ReadFuncArgDef>[({<\[] {
221 if (YY_START==ReadFuncArgType)
223 yyextra->curArgTypeName+=*yytext;
224 yyextra->copyArgValue=&yyextra->curArgTypeName;
228 yyextra->curArgDefValue+=*yytext;
229 yyextra->copyArgValue=&yyextra->curArgDefValue;
231 yyextra->readArgContext = YY_START;
234 yyextra->argRoundCount=0;
235 BEGIN( CopyArgRound );
237 else if (*yytext==
'[')
239 yyextra->argSquareCount=0;
240 BEGIN( CopyArgSquare );
242 else if (*yytext==
'{')
244 yyextra->argCurlyCount=0;
245 BEGIN( CopyArgCurly );
249 yyextra->argSharpCount=0;
250 yyextra->argRoundCount=0;
251 BEGIN( CopyArgSharp );
254<CopyArgRound,CopyArgRound2>"(" {
255 yyextra->argRoundCount++;
256 *yyextra->copyArgValue += *yytext;
258<CopyArgRound,CopyArgRound2>")"({B}*{ID})* {
259 *yyextra->copyArgValue += yytext;
260 if (yyextra->argRoundCount>0)
262 yyextra->argRoundCount--;
266 if (YY_START==CopyArgRound2)
268 *yyextra->copyArgValue+=
" "+yyextra->curArgName;
270 BEGIN( yyextra->readArgContext );
273<CopyArgRound>")"/{B}* {
274 *yyextra->copyArgValue += *yytext;
275 if (yyextra->argRoundCount>0) yyextra->argRoundCount--;
276 else BEGIN( yyextra->readArgContext );
279 yyextra->argSquareCount++;
280 *yyextra->copyArgValue += *yytext;
282<CopyArgSquare>"]"({B}*{ID})* {
283 *yyextra->copyArgValue += yytext;
284 if (yyextra->argSquareCount>0)
286 yyextra->argRoundCount--;
290 BEGIN( yyextra->readArgContext );
293<CopyArgSquare>"]"/{B}* {
294 *yyextra->copyArgValue += *yytext;
295 if (yyextra->argSquareCount>0) yyextra->argSquareCount--;
296 else BEGIN( yyextra->readArgContext );
299 if (yyextra->argRoundCount>0)
302 *yyextra->copyArgValue += yytext;
310 if (yyextra->argRoundCount>0)
313 *yyextra->copyArgValue += yytext;
322 if (yyextra->argRoundCount==0) yyextra->argSharpCount++;
323 *yyextra->copyArgValue += *yytext;
326 *yyextra->copyArgValue += *yytext;
327 if (yyextra->argRoundCount>0 && yyextra->argSharpCount==0)
333 if (yyextra->argSharpCount>0)
335 yyextra->argSharpCount--;
339 BEGIN( yyextra->readArgContext );
344 yyextra->argRoundCount++;
345 *yyextra->copyArgValue += *yytext;
348 yyextra->argRoundCount--;
349 *yyextra->copyArgValue += *yytext;
352 yyextra->argCurlyCount++;
353 *yyextra->copyArgValue += *yytext;
356 *yyextra->copyArgValue += *yytext;
357 if (yyextra->argCurlyCount>0) yyextra->argCurlyCount--;
358 else BEGIN( yyextra->readArgContext );
361 yyextra->curArgDefValue+=yytext;
363<CopyRawString>{RAWEND} {
364 yyextra->curArgDefValue+=yytext;
367 BEGIN( ReadFuncArgDef );
QCString extractEndRawStringDelimiter(const char *rawEnd)
371 yyextra->curArgDefValue+=*yytext;
372 BEGIN( ReadFuncArgDef );
374<ReadFuncArgType>"=" {
375 BEGIN( ReadFuncArgDef );
377<ReadFuncArgType,ReadFuncArgDef>[,)>]{B}*({CCS}[*!]|{CPPC}[/!])"<" {
378 yyextra->lastDocContext=YY_START;
379 yyextra->lastDocChar=*yytext;
381 if (text.find(
"//")!=-1)
382 BEGIN( ReadDocLine );
384 BEGIN( ReadDocBlock );
386<ReadFuncArgType,ReadFuncArgDef>[,)>] {
387 if (*yytext==
')' && yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
389 yyextra->curArgTypeName+=*yytext;
395 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
397 int l =
static_cast<int>(yyextra->curArgTypeName.length());
401 while (i>=0 && (isspace((uint8_t)yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)==
'.')) i--;
402 while (i>=0 && (
isId(yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)==
'$')) i--;
404 a.
attrib = yyextra->curArgAttrib;
409 if (i==l-1 && yyextra->curArgTypeName.at(i)==
')')
411 int bi=yyextra->curArgTypeName.find(
'(');
414 while (fi>=0 && (
isId(yyextra->curArgTypeName.at(fi)) || yyextra->curArgTypeName.at(fi)==
':')) fi--;
417 a.
type = yyextra->curArgTypeName.
left(fi+1);
419 a.
array = yyextra->curArgTypeName.
right(l-bi);
423 a.
type = yyextra->curArgTypeName;
426 else if (i>=0 && yyextra->curArgTypeName.at(i)!=
':')
438 if (a.
type.
mid(sv)==
"struct" ||
443 a.
type==
"volatile" ||
464 if (alen>2 && a.
array.
at(0)==
'(' &&
475 a.
defval = yyextra->curArgDefValue;
479 yyextra->argList->push_back(a);
481 yyextra->curArgAttrib.clear();
482 yyextra->curArgTypeName.clear();
483 yyextra->curArgDefValue.clear();
484 yyextra->curArgArray.clear();
485 yyextra->curArgDocs.clear();
486 yyextra->curTypeConstraint.clear();
494 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)
498<ReadFuncArgType,ReadFuncArgPtr>"extends" {
499 if (yyextra->lang!=SrcLangExt::Java)
505 yyextra->curTypeConstraint.clear();
506 yyextra->lastExtendsContext=YY_START;
507 BEGIN(ReadTypeConstraint);
510<ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} {
512 if (YY_START==ReadFuncArgType && yyextra->curArgArray==
"[]")
514 yyextra->curArgTypeName+=
" []";
515 yyextra->curArgArray.clear();
518 yyextra->curArgTypeName+=name;
520<ReadFuncArgType,ReadFuncArgPtr>. {
521 yyextra->curArgTypeName+=*yytext;
524<ReadFuncArgDef,CopyArgString>"<="|"->"|">="|">>"|"<<" {
525 yyextra->curArgDefValue+=yytext;
527<ReadFuncArgDef,CopyArgString,CopyRawString>. {
528 yyextra->curArgDefValue+=*yytext;
530<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>{ID} {
531 *yyextra->copyArgValue+=yytext;
533<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>. {
534 *yyextra->copyArgValue += *yytext;
536<ReadTypeConstraint>[,)>] {
538 BEGIN(yyextra->lastExtendsContext);
540<ReadTypeConstraint>. {
541 yyextra->curTypeConstraint+=yytext;
543<ReadTypeConstraint>\n {
544 yyextra->curTypeConstraint+=
' ';
547 yyextra->argList->setConstSpecifier(
TRUE);
549<FuncQual>"volatile" {
550 yyextra->argList->setVolatileSpecifier(
TRUE);
552<FuncQual>"override" {
560<FuncQual,TrailingReturn>"="{B}*"0" {
561 yyextra->argList->setPureSpecifier(
TRUE);
565 yyextra->argList->setTrailingReturnType(
QCString(
" -> "));
566 BEGIN(TrailingReturn);
568<TrailingReturn>{B}/("final"|"override"){B}* {
573 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
576 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
578<FuncQual>")"{B}*"["[^]]*"]" {
580 yyextra->extraTypeChars=yytext;
582<ReadDocBlock>[^\*\n]+ {
583 yyextra->curArgDocs+=yytext;
586 yyextra->curArgDocs+=yytext;
589 if (yyextra->lastDocChar!=0)
590 unput(yyextra->lastDocChar);
591 BEGIN(yyextra->lastDocContext);
594 if (yyextra->lastDocChar!=0)
595 unput(yyextra->lastDocChar);
596 BEGIN(yyextra->lastDocContext);
599 yyextra->curArgDocs+=*yytext;
602 yyextra->curArgDocs+=*yytext;
604<*>({CCS}[*!]|{CPPC}[/!])("<"?) {
605 yyextra->lastDocContext=YY_START;
606 yyextra->lastDocChar=0;
608 BEGIN( ReadDocLine );
610 BEGIN( ReadDocBlock );
622 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
624 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
626 *buf = yyextra->inputString[yyextra->inputPosition++] ;
675#define TOTAL_KEYWORDS 28
676#define MIN_WORD_LENGTH 3
677#define MAX_WORD_LENGTH 9
678#define MIN_HASH_VALUE 3
679#define MAX_HASH_VALUE 48
685 static inline size_t hash (
const char *str,
size_t len);
687 static const char *
find (
const char *str,
size_t len);
692 static const unsigned char asso_values[] =
694 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
695 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
696 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
697 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
698 49, 49, 49, 49, 49, 49, 49, 49, 49, 5,
699 5, 30, 0, 49, 25, 49, 10, 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, 0, 49, 0, 5, 49,
704 15, 0, 49, 10, 49, 30, 49, 49, 0, 20,
705 0, 49, 15, 49, 5, 10, 0, 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, 49, 49, 49, 49, 49,
709 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
710 49, 49, 49, 49, 49, 49, 49, 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
726 hval += asso_values[
static_cast<unsigned char>(str[4])];
729 hval += asso_values[
static_cast<unsigned char>(str[3])];
739 static const char *
const wordlist[] =
781 size_t key =
hash (str, len);
785 const char *s = wordlist[key];
787 if (*str == *s && !
qstrcmp (str + 1, s + 1))
811 std::unique_ptr<ArgumentList> al = std::make_unique<ArgumentList>();
812 if (argsString.
isEmpty())
return al;
816 defargsYYlex_init_extra(&extra,&yyscanner);
820 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
823 defargsYYrestart(
nullptr, yyscanner );
825 defargsYYlex(yyscanner);
826 if (yyextra->argList->empty())
828 yyextra->argList->setNoParameters(
TRUE);
830 if (extraTypeChars) *extraTypeChars=yyextra->extraTypeChars;
832 defargsYYlex_destroy(yyscanner);
836#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)