diff -r 000000000000 -r 42188c7ea2d9 Orb/Doxygen/src/declinfo.l --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orb/Doxygen/src/declinfo.l Thu Jan 21 17:29:01 2010 +0000 @@ -0,0 +1,355 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2008 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. + * + */ + +%{ + +/* + * includes + */ +#include +//#include +#include +#include + +#include "declinfo.h" +#include "util.h" +#include "message.h" + +/* ----------------------------------------------------------------- + * + * 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 QCString tmpType; +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] + 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); + } +