/****************************************************************************** * * $Id$ * * Copyright (C) 1997-1999 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. * * All output generated with Doxygen is not covered by this license. * */ %{ /* * includes */ #include #include #include #include #include "declinfo.h" #include "util.h" #define YY_NO_UNPUT /* ----------------------------------------------------------------- * * statics */ static const char * inputString; static int inputPosition; static QString scope; static QString className; static QString classTempList; static QString funcTempList; static QString type; static QString name; static QString args; static QString tmpType; static int sharpCount; static bool classTempListFound; static bool funcTempListFound; static QString exceptionString; 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.isNull()) 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()) return; if (!type.isNull()) 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][a-z_A-Z0-9]* %x Start %x Template %x ReadArgs %x Operator %x FuncPtr %x EndTemplate %x StripTempArgs %x SkipSharp %x ReadExceptions %% "operator" { // operator rule must be before {ID} rule name += yytext; BEGIN(Operator); } (~{B}*)?{ID} { 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); } [*&]+ { addType(); type+=yytext; } {B}+ { addType(); } {B}*"("{B}*"*" { addType(); type+="(*"; } {B}*")" { type+=")"; } {B}*"(" { // TODO: function pointers args+="("; BEGIN(ReadArgs); } {B}*"[" { args+="["; BEGIN(ReadArgs); } {B}*"<" { name+="<"; sharpCount=0; BEGIN(Template); }