/****************************************************************************** * * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ %option never-interactive %option prefix="declinfoYY" %option nounput %option noyywrap %option reentrant %option extra-type="struct declinfoYY_state *" %top{ #include } %{ /* * includes */ #include //#include #include #include #include "declinfo.h" #include "util.h" #include "message.h" #include "types.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 #define YY_NEVER_INTERACTIVE 1 #define USE_STATE2STRING 0 /* ----------------------------------------------------------------- * * statics */ struct declinfoYY_state { const char *inputString; int inputPosition; QCString scope; QCString className; QCString classTempList; QCString funcTempList; QCString type; QCString name; QCString args; int sharpCount; bool classTempListFound; bool funcTempListFound; QCString exceptionString; bool insideObjC; bool insidePHP; }; #if USE_STATE2STRING static const char *stateToString(int state); #endif static void addType(yyscan_t yyscanner); static void addTypeName(yyscan_t yyscanner); static yy_size_t yyread(char *buf,yy_size_t max_size, yyscan_t yyscanner); /* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner); %} B [ \t] Bopt {B}* ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) %x Start %x Template %x ReadArgs %x Operator %x FuncPtr %x EndTemplate %x StripTempArgs %x SkipSharp %x ReadExceptions %% "operator"/({B}*"["{B}*"]")* { // operator rule must be before {ID} rule yyextra->name += yytext; BEGIN(Operator); } {ID}{B}*"("{B}*{ID}{B}*")" { // Objective-C class categories if (!yyextra->insideObjC) { REJECT; } else { yyextra->name += yytext; } } ([~!]{B}*)?{ID}{B}*"["{B}*"]" { // PHP if (!yyextra->insidePHP) { REJECT; } addTypeName(yyscanner); yyextra->name += removeRedundantWhiteSpace(QCString(yytext)); } ([~!]{B}*)?{ID}/({B}*"["{B}*"]")* { // the []'s are for Java, // the / was add to deal with multi- // dimensional C++ arrays like A[][15] // the leading ~ is for a destructor // the leading ! is for a C++/CLI finalizer (see bug 456475 and 635198) addTypeName(yyscanner); yyextra->name += removeRedundantWhiteSpace(QCString(yytext)); } {B}*"::"{B}* { // found a yyextra->scope specifier if (!yyextra->scope.isEmpty()) { yyextra->scope+="::"+yyextra->name; // add yyextra->name to yyextra->scope } else { yyextra->scope = yyextra->name; // yyextra->scope becomes yyextra->name } yyextra->name.resize(0); } {B}*":" { // Objective-C argument separator yyextra->name+=yytext; } [*&]+ { addType(yyscanner); yyextra->type+=yytext; } {B}+ { addType(yyscanner); } {B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? { if (yyextra->insidePHP) REJECT; addType(yyscanner); QCString text(yytext); yyextra->type+=text.stripWhiteSpace(); } {B}*")" { yyextra->type+=")"; } {B}*"(" { // TODO: function pointers yyextra->args+="("; BEGIN(ReadArgs); } {B}*"[" { yyextra->args+="["; BEGIN(ReadArgs); } {B}*"<" { yyextra->name+="<"; yyextra->sharpCount=0; BEGIN(Template); }