/****************************************************************************** * * * * 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" %{ /* * includes */ #include //#include #include #include #include "declinfo.h" #include "util.h" #include "message.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 /* ----------------------------------------------------------------- * * statics */ static const char * inputString; static int inputPosition; static QCString scope; static QCString className; static QCString classTempList; static QCString funcTempList; static QCString type; static QCString name; static QCString args; static int sharpCount; static bool classTempListFound; static bool funcTempListFound; static QCString exceptionString; static bool insideObjC; static void addType() { //printf("addType() type=`%s' scope=`%s' name=`%s'\n", // type.data(),scope.data(),name.data()); if (name.isEmpty() && scope.isEmpty()) return; if (!type.isEmpty()) type+=" "; if (!scope.isEmpty()) type+=scope+"::"; type+=name; scope.resize(0); name.resize(0); } static void addTypeName() { //printf("addTypeName() type=`%s' scope=`%s' name=`%s'\n", // type.data(),scope.data(),name.data()); if (name.isEmpty() || name.at(name.length()-1)==':') // end of Objective-C keyword => append to name not type { return; } if (!type.isEmpty()) type+=' '; type+=name; name.resize(0); } #define YY_NEVER_INTERACTIVE 1 /* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); static int yyread(char *buf,int max_size) { int c=0; while( c < max_size && inputString[inputPosition] ) { *buf = inputString[inputPosition++] ; c++; buf++; } return c; } %} B [ \t] ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) %option nounput %option noyywrap %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 name += yytext; BEGIN(Operator); } {ID}{B}*"("{B}*{ID}{B}*")" { // Objective-C class categories if (!insideObjC) { REJECT; } else { name += 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(); name += yytext; } {B}*"::"{B}* { // found a scope specifier if (!scope.isEmpty()) { scope+="::"+name; // add name to scope } else { scope = name.copy(); // scope becomes name } name.resize(0); } {B}*":" { // Objective-C argument separator name+=yytext; } [*&]+ { addType(); type+=yytext; } {B}+ { addType(); } {B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? { addType(); QCString text=yytext; type+=text.stripWhiteSpace(); } {B}*")" { type+=")"; } {B}*"(" { // TODO: function pointers args+="("; BEGIN(ReadArgs); } {B}*"[" { args+="["; BEGIN(ReadArgs); } {B}*"<" { name+="<"; sharpCount=0; BEGIN(Template); }