15%option never-interactive
16%option prefix="declinfoYY"
20%option extra-type="struct declinfoYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
46#define YY_NO_UNISTD_H 1
47#define YY_NEVER_INTERACTIVE 1
83#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner);
86static inline const char *
getLexerFILE() {
return __FILE__;}
87#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 void addType(yyscan_t yyscanner)
static void addTypeName(yyscan_t yyscanner)
This file contains a number of basic enums and types.
A bunch of utility functions.
93ID ([$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+)
104<Start>"operator"/({B}*"["{B}*"]")* {
105 yyextra->name += yytext;
108<Start>{ID}({B}*"*")?{B}*"("{B}*"^"{B}*")"{B}*"(" {
109 if (!yyextra->insideObjC)
116 yyextra->type += yytext;
119<Start>{ID}{B}*"("{B}*{ID}{B}*")" {
120 if (!yyextra->insideObjC)
126 yyextra->name += yytext;
129<Start>([~!]{B}*)?{ID}{B}*"["{B}*"]" {
130 if (!yyextra->insidePHP)
QCString removeRedundantWhiteSpace(const QCString &s)
137<Start>"anonymous_namespace{"[^}]+"}" {
138 if (!yyextra->scope.isEmpty())
140 yyextra->scope+=
QCString(
"::")+yytext;
144 yyextra->scope = yytext;
147<Start>([~!]{B}*)?{ID}/({B}*"["{B}*"]")* {
156 if (!yyextra->scope.isEmpty() && !yyextra->scope.endsWith(
"::"))
158 if (!yyextra->name.isEmpty()) yyextra->scope+=
"::"+yyextra->name;
162 yyextra->scope = yyextra->name;
164 yyextra->name.clear();
167 yyextra->name+=yytext;
171 yyextra->type+=yytext;
176<Start>{B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? {
177 if (yyextra->insidePHP) REJECT;
178 if (yyextra->insidePython) REJECT;
181 yyextra->type+=text.stripWhiteSpace();
186<Start>{B}*"decltype"/{B}*"(" {
187 yyextra->roundCount=0;
188 yyextra->type=
"decltype";
192 ++yyextra->roundCount;
197 if (--yyextra->roundCount == 0) {
202 yyextra->type+=yytext;
214 yyextra->sharpCount=0;
215 yyextra->roundCount=0;
218<Template>"<<" { yyextra->name+=
"<<"; }
219<Template>">>" { yyextra->name+=
">>"; }
220<Template>"(" { yyextra->name+=
"(";
221 yyextra->roundCount++;
223<Template>")" { yyextra->name+=
")";
224 if (yyextra->roundCount>0)
226 yyextra->roundCount--;
231 if (yyextra->roundCount==0)
233 yyextra->sharpCount++;
238 if (yyextra->roundCount==0)
240 if (yyextra->sharpCount)
241 --yyextra->sharpCount;
249 yyextra->name+=*yytext;
251<Operator>{B}*"("{B}*")"{B}*"<>"{Bopt}/"(" {
252 yyextra->name+=
"() <>";
255<Operator>{B}*"("{B}*")"{Bopt}/"(" {
259<Operator>[^(]*{B}*("<>"{B}*)?/"(" {
260 yyextra->name+=yytext;
263<ReadArgs>"throw"{B}*"(" {
264 yyextra->exceptionString=
"throw(";
265 BEGIN(ReadExceptions);
268 yyextra->args+=*yytext;
271 yyextra->exceptionString+=*yytext;
280 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
283 if (yyextra->name.isEmpty() && yyextra->scope.isEmpty())
return;
284 if (!yyextra->type.isEmpty()) yyextra->type+=
" ";
285 if (!yyextra->scope.isEmpty()) yyextra->type+=yyextra->scope+
"::";
286 yyextra->type+=yyextra->name;
287 yyextra->scope.clear();
288 yyextra->name.clear();
293 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
296 if (yyextra->name.isEmpty() ||
297 yyextra->name.at(yyextra->name.length()-1)==
':')
301 if (!yyextra->type.isEmpty()) yyextra->type+=
' ';
302 yyextra->type+=yyextra->name;
303 yyextra->name.clear();
308 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
310 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
312 *buf = yyextra->inputString[yyextra->inputPosition++] ;
331 struct yyguts_t *yyg = (
struct yyguts_t*)
g_yyscanner;
338 yyextra->inputString = decl.
data();
340 yyextra->inputPosition = 0;
341 yyextra->classTempListFound =
FALSE;
342 yyextra->funcTempListFound =
FALSE;
343 yyextra->insideObjC = lang==SrcLangExt::ObjC;
344 yyextra->insidePHP = lang==SrcLangExt::PHP;
345 yyextra->insidePython = lang==SrcLangExt::Python;
346 yyextra->scope.clear();
347 yyextra->className.clear();
348 yyextra->classTempList.clear();
349 yyextra->funcTempList.clear();
350 yyextra->name.clear();
351 yyextra->type.clear();
352 yyextra->args.clear();
353 yyextra->exceptionString.clear();
362 int nb = yyextra->name.findRev(
'[');
363 if (nb!=-1 && yyextra->args.isEmpty())
365 yyextra->args.prepend(yyextra->name.right(yyextra->name.length()-nb));
366 yyextra->name=yyextra->name.left(nb);
372 if (il!=-1 && ir!=-1 && n.
at(il+1)!=
'=')
399void dumpDecl(
const char *s)
407 msg(
"-----------------------------------------\n");
408 parseFuncDecl(s,yyextra->className,classTNames,yyextra->type,yyextra->name,yyextra->args,funcTNames);
409 msg(
"yyextra->type='{}' class='{}' classTempl='{}' yyextra->name='{}' "
410 "funcTemplateNames='{}' yyextra->args='{}'\n",
411 yyextra->type,yyextra->className,classTNames,
412 yyextra->name,funcTNames,yyextra->args
419 dumpDecl(
"A < T > :: Value * A < T > :: getValue < S > ( const A < T > & a )");
420 dumpDecl(
"const A<T>::Value* A<T>::getValue<S>(const A<T>&a)");
422 dumpDecl(
"friend void bla<>()");
423 dumpDecl(
"yyextra->name< T > :: operator () (int bla)");
424 dumpDecl(
"yyextra->name< T > :: operator << (int bla)");
425 dumpDecl(
"yyextra->name< T > :: operator << <> (int bla)");
426 dumpDecl(
"yyextra->className::func()");
427 dumpDecl(
"void ( * yyextra->Name < T > :: bla ) ( int, char * )");
431#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
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)