17%option never-interactive
18%option prefix="declinfoYY"
22%option extra-type="struct declinfoYY_state *"
26#define YY_TYPEDEF_YY_SCANNER_T
48#define YY_NO_UNISTD_H 1
49#define YY_NEVER_INTERACTIVE 1
85#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner);
89#define LEX_NO_INPUT_FILENAME
This is an alternative implementation of QCString.
static int yyread(char *buf, int max_size, yyscan_t yyscanner)
static void addTypeName(yyscan_t yyscanner)
static const char * stateToString(int state)
static const char * getLexerFILE()
static void addType(yyscan_t yyscanner)
This file contains a number of basic enums and types.
A bunch of utility functions.
95ID ([$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+)
106<Start>"operator"/({B}*"["{B}*"]")* {
107 yyextra->name += yytext;
110<Start>{ID}({B}*"*")?{B}*"("{B}*"^"{B}*")"{B}*"(" {
111 if (!yyextra->insideObjC)
118 yyextra->type += yytext;
static void addType(yyscan_t yyscanner)
121<Start>{ID}{B}*"("{B}*{ID}{B}*")" {
122 if (!yyextra->insideObjC)
128 yyextra->name += yytext;
131<Start>([~!]{B}*)?{ID}{B}*"["{B}*"]" {
132 if (!yyextra->insidePHP)
QCString removeRedundantWhiteSpace(const QCString &s)
139<Start>"anonymous_namespace{"[^}]+"}" {
140 if (!yyextra->scope.isEmpty())
142 yyextra->scope+=
QCString(
"::")+yytext;
146 yyextra->scope = yytext;
149<Start>([~!]{B}*)?{ID}/({B}*"["{B}*"]")* {
158 if (!yyextra->scope.isEmpty() && !yyextra->scope.endsWith(
"::"))
160 if (!yyextra->name.isEmpty()) yyextra->scope+=
"::"+yyextra->name;
164 yyextra->scope = yyextra->name;
166 yyextra->name.clear();
169 yyextra->name+=yytext;
173 yyextra->type+=yytext;
178<Start>{B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? {
179 if (yyextra->insidePHP) REJECT;
180 if (yyextra->insidePython) REJECT;
183 yyextra->type+=text.stripWhiteSpace();
188<Start>{B}*"decltype"/{B}*"(" {
189 yyextra->roundCount=0;
190 yyextra->type=
"decltype";
194 ++yyextra->roundCount;
199 if (--yyextra->roundCount == 0) {
204 yyextra->type+=yytext;
216 yyextra->sharpCount=0;
217 yyextra->roundCount=0;
220<Template>"<<" { yyextra->name+=
"<<"; }
221<Template>">>" { yyextra->name+=
">>"; }
222<Template>"(" { yyextra->name+=
"(";
223 yyextra->roundCount++;
225<Template>")" { yyextra->name+=
")";
226 if (yyextra->roundCount>0)
228 yyextra->roundCount--;
233 if (yyextra->roundCount==0)
235 yyextra->sharpCount++;
240 if (yyextra->roundCount==0)
242 if (yyextra->sharpCount)
243 --yyextra->sharpCount;
251 yyextra->name+=*yytext;
253<Operator>{B}*"("{B}*")"{B}*"<>"{Bopt}/"(" {
254 yyextra->name+=
"() <>";
257<Operator>{B}*"("{B}*")"{Bopt}/"(" {
261<Operator>[^(]*{B}*("<>"{B}*)?/"(" {
262 yyextra->name+=yytext;
265<ReadArgs>"throw"{B}*"(" {
266 yyextra->exceptionString=
"throw(";
267 BEGIN(ReadExceptions);
270 yyextra->args+=*yytext;
273 yyextra->exceptionString+=*yytext;
282 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
285 if (yyextra->name.isEmpty() && yyextra->scope.isEmpty())
return;
286 if (!yyextra->type.isEmpty()) yyextra->type+=
" ";
287 if (!yyextra->scope.isEmpty()) yyextra->type+=yyextra->scope+
"::";
288 yyextra->type+=yyextra->name;
289 yyextra->scope.clear();
290 yyextra->name.clear();
295 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
298 if (yyextra->name.isEmpty() ||
299 yyextra->name.at(yyextra->name.length()-1)==
':')
303 if (!yyextra->type.isEmpty()) yyextra->type+=
' ';
304 yyextra->type+=yyextra->name;
305 yyextra->name.clear();
310 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
312 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
314 *buf = yyextra->inputString[yyextra->inputPosition++] ;
333 struct yyguts_t *yyg = (
struct yyguts_t*)
g_yyscanner;
340 yyextra->inputString = decl.
data();
342 yyextra->inputPosition = 0;
343 yyextra->classTempListFound =
FALSE;
344 yyextra->funcTempListFound =
FALSE;
348 yyextra->scope.clear();
349 yyextra->className.clear();
350 yyextra->classTempList.clear();
351 yyextra->funcTempList.clear();
352 yyextra->name.clear();
353 yyextra->type.clear();
354 yyextra->args.clear();
355 yyextra->exceptionString.clear();
364 int nb = yyextra->name.findRev(
'[');
365 if (nb!=-1 && yyextra->args.isEmpty())
367 yyextra->args.prepend(yyextra->name.right(yyextra->name.length()-nb));
368 yyextra->name=yyextra->name.left(nb);
374 if (il!=-1 && ir!=-1 && n.
at(il+1)!=
'=')
401void dumpDecl(
const char *s)
409 msg(
"-----------------------------------------\n");
410 parseFuncDecl(s,yyextra->className,classTNames,yyextra->type,yyextra->name,yyextra->args,funcTNames);
411 msg(
"yyextra->type='%s' class='%s' classTempl='%s' yyextra->name='%s' "
412 "funcTemplateNames='%s' yyextra->args='%s'\n",
421 dumpDecl(
"A < T > :: Value * A < T > :: getValue < S > ( const A < T > & a )");
422 dumpDecl(
"const A<T>::Value* A<T>::getValue<S>(const A<T>&a)");
424 dumpDecl(
"friend void bla<>()");
425 dumpDecl(
"yyextra->name< T > :: operator () (int bla)");
426 dumpDecl(
"yyextra->name< T > :: operator << (int bla)");
427 dumpDecl(
"yyextra->name< T > :: operator << <> (int bla)");
428 dumpDecl(
"yyextra->className::func()");
429 dumpDecl(
"void ( * yyextra->Name < T > :: bla ) ( int, char * )");
433#include "declinfo.l.h"
static bool isFlagSet(const DebugMask mask)
int find(char c, int index=0, bool cs=TRUE) const
QCString & prepend(const char *s)
size_t length() const
Returns the length of the string, not counting the 0-terminator.
bool startsWith(const char *s) 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 right(size_t len) const
int findRev(char c, int index=-1, bool cs=TRUE) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
QCString left(size_t len) const
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
void parseFuncDecl(const QCString &decl, const SrcLangExt lang, QCString &clName, QCString &type, QCString &name, QCString &args, QCString &funcTempList, QCString &exceptions)
static yyscan_t g_yyscanner
static struct declinfoYY_state g_declinfo_extra
int main(int argc, char **argv)
void msg(const char *fmt,...)
const char * qPrint(const char *s)
SrcLangExt
Language as given by extension.