40%option never-interactive
41%option prefix="defargsYY"
43%option extra-type="struct defargsYY_state *"
47#define YY_TYPEDEF_YY_SCANNER_T
70#define YY_NO_UNISTD_H 1
80 std::unique_ptr<ArgumentList> &
argList;
111#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
114static inline const char *
getLexerFILE() {
return __FILE__;}
115#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 const char * getLexerFILE()
static bool nameIsActuallyPartOfType(QCString &name)
QCString curTypeConstraint
std::unique_ptr< ArgumentList > & argList
defargsYY_state(const char *inStr, std::unique_ptr< ArgumentList > &al, SrcLangExt l)
A bunch of utility functions.
122ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
123RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
124RAWEND ")"[^ \t\(\)\\]{0,16}\"
155<Start>[<(] { BEGIN(ReadFuncArgType); }
157<ReadFuncArgType>{B}* {
158 yyextra->curArgTypeName+=
" ";
160<ReadFuncArgType>"["[^\]]*"]" {
161 if (yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
163 yyextra->curArgAttrib=yytext;
167 yyextra->curArgArray+=yytext;
170<ReadFuncArgDef>"'"\\[0-7]{1,3}"'" { yyextra->curArgDefValue+=yytext; }
171<ReadFuncArgDef>"'"\\."'" { yyextra->curArgDefValue+=yytext; }
172<ReadFuncArgDef>"'"."'" { yyextra->curArgDefValue+=yytext; }
173<ReadFuncArgDef>{RAWBEGIN} { yyextra->curArgDefValue+=yytext;
175 BEGIN( CopyRawString );
QCString extractBeginRawStringDelimiter(const char *rawStart)
178 yyextra->curArgDefValue+=*yytext;
179 BEGIN( CopyArgString );
181<ReadFuncArgType>"("([^:)]+{B}*"::")*{B}*[&*\^]+{Bopt}/{ID} {
183 yyextra->curArgTypeName+=yytext;
185 BEGIN( ReadFuncArgPtr );
187<ReadFuncArgPtr>{ID} {
188 yyextra->curArgName=yytext;
190<ReadFuncArgPtr>")"{B}*"(" {
191 yyextra->curArgTypeName+=yytext;
193 yyextra->readArgContext = ReadFuncArgType;
194 yyextra->copyArgValue=&yyextra->curArgTypeName;
195 yyextra->argRoundCount=0;
196 BEGIN( CopyArgRound2 );
198<ReadFuncArgPtr>")"/{B}*"[" {
199 yyextra->curArgTypeName+=yytext;
200 yyextra->curArgTypeName+=yyextra->curArgName;
202 BEGIN( ReadFuncArgType );
205 int i=yyextra->curArgTypeName.findRev(
'(');
206 int l=
static_cast<int>(yyextra->curArgTypeName.length());
209 yyextra->curArgTypeName=yyextra->curArgTypeName.left(i)+
210 yyextra->curArgTypeName.right(l-i-1);
212 yyextra->curArgTypeName+=yyextra->curArgName;
213 BEGIN( ReadFuncArgType );
215<ReadFuncArgType>"<="|">="|"->"|">>"|"<<" {
216 yyextra->curArgTypeName+=yytext;
218<ReadFuncArgType,ReadFuncArgDef>[({<\[] {
219 if (YY_START==ReadFuncArgType)
221 yyextra->curArgTypeName+=*yytext;
222 yyextra->copyArgValue=&yyextra->curArgTypeName;
226 yyextra->curArgDefValue+=*yytext;
227 yyextra->copyArgValue=&yyextra->curArgDefValue;
229 yyextra->readArgContext = YY_START;
232 yyextra->argRoundCount=0;
233 BEGIN( CopyArgRound );
235 else if (*yytext==
'[')
237 yyextra->argSquareCount=0;
238 BEGIN( CopyArgSquare );
240 else if (*yytext==
'{')
242 yyextra->argCurlyCount=0;
243 BEGIN( CopyArgCurly );
247 yyextra->argSharpCount=0;
248 yyextra->argRoundCount=0;
249 BEGIN( CopyArgSharp );
252<CopyArgRound,CopyArgRound2>"(" {
253 yyextra->argRoundCount++;
254 *yyextra->copyArgValue += *yytext;
256<CopyArgRound,CopyArgRound2>")"({B}*{ID})* {
257 *yyextra->copyArgValue += yytext;
258 if (yyextra->argRoundCount>0)
260 yyextra->argRoundCount--;
264 if (YY_START==CopyArgRound2)
266 *yyextra->copyArgValue+=
" "+yyextra->curArgName;
268 BEGIN( yyextra->readArgContext );
271<CopyArgRound>")"/{B}* {
272 *yyextra->copyArgValue += *yytext;
273 if (yyextra->argRoundCount>0) yyextra->argRoundCount--;
274 else BEGIN( yyextra->readArgContext );
277 yyextra->argSquareCount++;
278 *yyextra->copyArgValue += *yytext;
280<CopyArgSquare>"]"({B}*{ID})* {
281 *yyextra->copyArgValue += yytext;
282 if (yyextra->argSquareCount>0)
284 yyextra->argRoundCount--;
288 BEGIN( yyextra->readArgContext );
291<CopyArgSquare>"]"/{B}* {
292 *yyextra->copyArgValue += *yytext;
293 if (yyextra->argSquareCount>0) yyextra->argSquareCount--;
294 else BEGIN( yyextra->readArgContext );
297 if (yyextra->argRoundCount>0)
300 *yyextra->copyArgValue += yytext;
308 if (yyextra->argRoundCount>0)
311 *yyextra->copyArgValue += yytext;
320 if (yyextra->argRoundCount==0) yyextra->argSharpCount++;
321 *yyextra->copyArgValue += *yytext;
324 *yyextra->copyArgValue += *yytext;
325 if (yyextra->argRoundCount>0 && yyextra->argSharpCount==0)
331 if (yyextra->argSharpCount>0)
333 yyextra->argSharpCount--;
337 BEGIN( yyextra->readArgContext );
342 yyextra->argRoundCount++;
343 *yyextra->copyArgValue += *yytext;
346 yyextra->argRoundCount--;
347 *yyextra->copyArgValue += *yytext;
350 yyextra->argCurlyCount++;
351 *yyextra->copyArgValue += *yytext;
354 *yyextra->copyArgValue += *yytext;
355 if (yyextra->argCurlyCount>0) yyextra->argCurlyCount--;
356 else BEGIN( yyextra->readArgContext );
359 yyextra->curArgDefValue+=yytext;
361<CopyRawString>{RAWEND} {
362 yyextra->curArgDefValue+=yytext;
365 BEGIN( ReadFuncArgDef );
QCString extractEndRawStringDelimiter(const char *rawEnd)
369 yyextra->curArgDefValue+=*yytext;
370 BEGIN( ReadFuncArgDef );
372<ReadFuncArgType>"=" {
373 BEGIN( ReadFuncArgDef );
375<ReadFuncArgType,ReadFuncArgDef>[,)>]{B}*({CCS}[*!]|{CPPC}[/!])"<" {
376 yyextra->lastDocContext=YY_START;
377 yyextra->lastDocChar=*yytext;
379 if (text.find(
"//")!=-1)
380 BEGIN( ReadDocLine );
382 BEGIN( ReadDocBlock );
384<ReadFuncArgType,ReadFuncArgDef>[,)>] {
385 if (*yytext==
')' && yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
387 yyextra->curArgTypeName+=*yytext;
393 yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace();
395 int l =
static_cast<int>(yyextra->curArgTypeName.length());
399 while (i>=0 && (isspace((uint8_t)yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)==
'.')) i--;
400 while (i>=0 && (
isId(yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)==
'$')) i--;
402 a.
attrib = yyextra->curArgAttrib;
407 if (i==l-1 && yyextra->curArgTypeName.at(i)==
')')
409 int bi=yyextra->curArgTypeName.find(
'(');
412 while (fi>=0 && (
isId(yyextra->curArgTypeName.at(fi)) || yyextra->curArgTypeName.at(fi)==
':')) fi--;
415 a.
type = yyextra->curArgTypeName.
left(fi+1);
417 a.
array = yyextra->curArgTypeName.
right(l-bi);
421 a.
type = yyextra->curArgTypeName;
424 else if (i>=0 && yyextra->curArgTypeName.at(i)!=
':')
436 if (a.
type.
mid(sv)==
"struct" ||
441 a.
type==
"volatile" ||
462 if (alen>2 && a.
array.
at(0)==
'(' &&
473 a.
defval = yyextra->curArgDefValue;
477 yyextra->argList->push_back(a);
479 yyextra->curArgAttrib.clear();
480 yyextra->curArgTypeName.clear();
481 yyextra->curArgDefValue.clear();
482 yyextra->curArgArray.clear();
483 yyextra->curArgDocs.clear();
484 yyextra->curTypeConstraint.clear();
492 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)
496<ReadFuncArgType,ReadFuncArgPtr>"extends" {
497 if (yyextra->lang!=SrcLangExt::Java)
503 yyextra->argSharpCount=0;
504 yyextra->curTypeConstraint.clear();
505 yyextra->lastExtendsContext=YY_START;
506 BEGIN(ReadTypeConstraint);
509<ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} {
511 if (YY_START==ReadFuncArgType && yyextra->curArgArray==
"[]")
513 yyextra->curArgTypeName+=
" []";
514 yyextra->curArgArray.clear();
517 yyextra->curArgTypeName+=name;
519<ReadFuncArgType,ReadFuncArgPtr>. {
520 yyextra->curArgTypeName+=*yytext;
523<ReadFuncArgDef,CopyArgString>"<="|"->"|">="|">>"|"<<" {
524 yyextra->curArgDefValue+=yytext;
526<ReadFuncArgDef,CopyArgString,CopyRawString>. {
527 yyextra->curArgDefValue+=*yytext;
529<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>{ID} {
530 *yyextra->copyArgValue+=yytext;
532<CopyArgRound,CopyArgRound2,CopyArgSquare,CopyArgSharp,CopyArgCurly>. {
533 *yyextra->copyArgValue += *yytext;
535<ReadTypeConstraint>[,)>] {
536 if (yytext[0]!=
'>' || yyextra->argSharpCount==0)
539 BEGIN(yyextra->lastExtendsContext);
543 yyextra->curTypeConstraint+=yytext;
544 yyextra->argSharpCount--;
547<ReadTypeConstraint>"<" {
548 yyextra->curTypeConstraint+=yytext;
549 yyextra->argSharpCount++;
551<ReadTypeConstraint>. {
552 yyextra->curTypeConstraint+=yytext;
554<ReadTypeConstraint>\n {
555 yyextra->curTypeConstraint+=
' ';
558 yyextra->argList->setConstSpecifier(
TRUE);
560<FuncQual>"volatile" {
561 yyextra->argList->setVolatileSpecifier(
TRUE);
563<FuncQual>"override" {
571<FuncQual,TrailingReturn>"="{B}*"0" {
572 yyextra->argList->setPureSpecifier(
TRUE);
576 yyextra->argList->setTrailingReturnType(
QCString(
" -> "));
577 BEGIN(TrailingReturn);
579<TrailingReturn>{B}/("final"|"override"){B}* {
584 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
587 yyextra->argList->setTrailingReturnType(yyextra->argList->trailingReturnType()+yytext);
589<FuncQual>")"{B}*"["[^]]*"]" {
591 yyextra->extraTypeChars=yytext;
593<ReadDocBlock>[^\*\n]+ {
594 yyextra->curArgDocs+=yytext;
597 yyextra->curArgDocs+=yytext;
600 if (yyextra->lastDocChar!=0)
601 unput(yyextra->lastDocChar);
602 BEGIN(yyextra->lastDocContext);
605 if (yyextra->lastDocChar!=0)
606 unput(yyextra->lastDocChar);
607 BEGIN(yyextra->lastDocContext);
610 yyextra->curArgDocs+=*yytext;
613 yyextra->curArgDocs+=*yytext;
615<*>({CCS}[*!]|{CPPC}[/!])("<"?) {
616 yyextra->lastDocContext=YY_START;
617 yyextra->lastDocChar=0;
619 BEGIN( ReadDocLine );
621 BEGIN( ReadDocBlock );
633 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
635 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
637 *buf = yyextra->inputString[yyextra->inputPosition++] ;
686#define TOTAL_KEYWORDS 28
687#define MIN_WORD_LENGTH 3
688#define MAX_WORD_LENGTH 9
689#define MIN_HASH_VALUE 3
690#define MAX_HASH_VALUE 48
696 static inline size_t hash (
const char *str,
size_t len);
698 static const char *
find (
const char *str,
size_t len);
703 static const unsigned char asso_values[] =
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, 49, 49, 49, 49, 49,
709 49, 49, 49, 49, 49, 49, 49, 49, 49, 5,
710 5, 30, 0, 49, 25, 49, 10, 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, 0, 49, 0, 5, 49,
715 15, 0, 49, 10, 49, 30, 49, 49, 0, 20,
716 0, 49, 15, 49, 5, 10, 0, 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, 49, 49, 49, 49,
725 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
726 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
727 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
728 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
729 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
730 49, 49, 49, 49, 49, 49
737 hval += asso_values[
static_cast<unsigned char>(str[4])];
740 hval += asso_values[
static_cast<unsigned char>(str[3])];
750 static const char *
const wordlist[] =
792 size_t key =
hash (str, len);
796 const char *s = wordlist[key];
798 if (*str == *s && !
qstrcmp (str + 1, s + 1))
822 std::unique_ptr<ArgumentList> al = std::make_unique<ArgumentList>();
823 if (argsString.
isEmpty())
return al;
827 defargsYYlex_init_extra(&extra,&yyscanner);
831 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
834 defargsYYrestart(
nullptr, yyscanner );
836 defargsYYlex(yyscanner);
837 if (yyextra->argList->empty())
839 yyextra->argList->setNoParameters(
TRUE);
841 if (extraTypeChars) *extraTypeChars=yyextra->extraTypeChars;
843 defargsYYlex_destroy(yyscanner);
847#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.
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars)
int qstrcmp(const char *str1, const char *str2)