summaryrefslogtreecommitdiffstats
path: root/src/defargs.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/defargs.l')
-rw-r--r--src/defargs.l120
1 files changed, 70 insertions, 50 deletions
diff --git a/src/defargs.l b/src/defargs.l
index 85878c1..9745f44 100644
--- a/src/defargs.l
+++ b/src/defargs.l
@@ -86,7 +86,9 @@ static int g_lastDocContext;
static int g_lastDocChar;
static int g_lastExtendsContext;
static QCString g_delimiter;
+static SrcLangExt g_lang;
+static const char *stateToString(int state);
/* -----------------------------------------------------------------
*/
#undef YY_INPUT
@@ -308,9 +310,21 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
}
<CopyArgSharp>">" {
*g_copyArgValue += *yytext;
- // don't count > inside )
- if (g_argSharpCount>0 && g_argRoundCount==0) g_argSharpCount--;
- else BEGIN( g_readArgContext );
+ if (g_argRoundCount>0 && g_argSharpCount==0)
+ {
+ // don't count > inside )
+ }
+ else
+ {
+ if (g_argSharpCount>0)
+ {
+ g_argSharpCount--;
+ }
+ else
+ {
+ BEGIN( g_readArgContext );
+ }
+ }
}
<CopyArgSharp>"(" {
g_argRoundCount++;
@@ -374,12 +388,12 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
int i=l-1;
while (i>=0 && (isspace((uchar)g_curArgTypeName.at(i)) || g_curArgTypeName.at(i)=='.')) i--;
while (i>=0 && (isId(g_curArgTypeName.at(i)) || g_curArgTypeName.at(i)=='$')) i--;
- Argument *a = new Argument;
- a->attrib = g_curArgAttrib.copy();
- a->typeConstraint = g_curTypeConstraint.stripWhiteSpace();
+ Argument a;
+ a.attrib = g_curArgAttrib.copy();
+ a.typeConstraint = g_curTypeConstraint.stripWhiteSpace();
//printf("a->type=%s a->name=%s i=%d l=%d\n",
// a->type.data(),a->name.data(),i,l);
- a->array.resize(0);
+ a.array.resize(0);
if (i==l-1 && g_curArgTypeName.at(i)==')') // function argument
{
int bi=g_curArgTypeName.find('(');
@@ -388,67 +402,67 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
while (fi>=0 && (isId(g_curArgTypeName.at(fi)) || g_curArgTypeName.at(fi)==':')) fi--;
if (fi>=0)
{
- a->type = g_curArgTypeName.left(fi+1);
- a->name = g_curArgTypeName.mid(fi+1,bi-fi-1).stripWhiteSpace();
- a->array = g_curArgTypeName.right(l-bi);
+ a.type = g_curArgTypeName.left(fi+1);
+ a.name = g_curArgTypeName.mid(fi+1,bi-fi-1).stripWhiteSpace();
+ a.array = g_curArgTypeName.right(l-bi);
}
else
{
- a->type = g_curArgTypeName;
+ a.type = g_curArgTypeName;
}
}
else if (i>=0 && g_curArgTypeName.at(i)!=':')
{ // type contains a name
- a->type = removeRedundantWhiteSpace(g_curArgTypeName.left(i+1)).stripWhiteSpace();
- a->name = g_curArgTypeName.right(l-i-1).stripWhiteSpace();
+ a.type = removeRedundantWhiteSpace(g_curArgTypeName.left(i+1)).stripWhiteSpace();
+ a.name = g_curArgTypeName.right(l-i-1).stripWhiteSpace();
// if the type becomes a type specifier only then we make a mistake
// and need to correct it to avoid seeing a nameless parameter
// "struct A" as a parameter with type "struct" and name "A".
int sv=0;
- if (a->type.left(6)=="const ") sv=6;
- else if (a->type.left(9)=="volatile ") sv=9;
+ if (a.type.left(6)=="const ") sv=6;
+ else if (a.type.left(9)=="volatile ") sv=9;
- if (a->type.mid(sv)=="struct" ||
- a->type.mid(sv)=="union" ||
- a->type.mid(sv)=="class" ||
- a->type.mid(sv)=="typename" ||
- nameIsActuallyPartOfType(a->name)
+ if (a.type.mid(sv)=="struct" ||
+ a.type.mid(sv)=="union" ||
+ a.type.mid(sv)=="class" ||
+ a.type.mid(sv)=="typename" ||
+ nameIsActuallyPartOfType(a.name)
)
{
- a->type = a->type + " " + a->name;
- a->name.resize(0);
+ a.type = a.type + " " + a.name;
+ a.name.resize(0);
}
//printf(" --> a->type='%s' a->name='%s'\n",a->type.data(),a->name.data());
}
else // assume only the type was specified, try to determine name later
{
- a->type = removeRedundantWhiteSpace(g_curArgTypeName);
+ a.type = removeRedundantWhiteSpace(g_curArgTypeName);
}
- if (!a->type.isEmpty() && a->type.at(0)=='$') // typeless PHP name?
+ if (!a.type.isEmpty() && a.type.at(0)=='$') // typeless PHP name?
{
- a->name = a->type;
- a->type = "";
+ a.name = a.type;
+ a.type = "";
}
- a->array += removeRedundantWhiteSpace(g_curArgArray);
+ a.array += removeRedundantWhiteSpace(g_curArgArray);
//printf("array=%s\n",a->array.data());
- int alen = a->array.length();
- if (alen>2 && a->array.at(0)=='(' &&
- a->array.at(alen-1)==')') // fix-up for int *(a[10])
+ int alen = a.array.length();
+ if (alen>2 && a.array.at(0)=='(' &&
+ a.array.at(alen-1)==')') // fix-up for int *(a[10])
{
- int i=a->array.find('[')-1;
- a->array = a->array.mid(1,alen-2);
- if (i>0 && a->name.isEmpty())
+ int i=a.array.find('[')-1;
+ a.array = a.array.mid(1,alen-2);
+ if (i>0 && a.name.isEmpty())
{
- a->name = a->array.left(i).stripWhiteSpace();
- a->array = a->array.mid(i);
+ a.name = a.array.left(i).stripWhiteSpace();
+ a.array = a.array.mid(i);
}
}
- a->defval = g_curArgDefValue.copy();
+ a.defval = g_curArgDefValue.copy();
//printf("a->type=%s a->name=%s a->defval=\"%s\"\n",a->type.data(),a->name.data(),a->defval.data());
- a->docs = g_curArgDocs.stripWhiteSpace();
+ a.docs = g_curArgDocs.stripWhiteSpace();
//printf("Argument '%s' '%s' adding docs='%s'\n",a->type.data(),a->name.data(),a->docs.data());
- g_argList->append(a);
+ g_argList->push_back(a);
}
g_curArgAttrib.resize(0);
g_curArgTypeName.resize(0);
@@ -468,9 +482,16 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
}
}
<ReadFuncArgType,ReadFuncArgPtr>"extends" {
- g_curTypeConstraint.resize(0);
- g_lastExtendsContext=YY_START;
- BEGIN(ReadTypeConstraint);
+ if (g_lang!=SrcLangExt_Java)
+ {
+ REJECT;
+ }
+ else
+ {
+ g_curTypeConstraint.resize(0);
+ g_lastExtendsContext=YY_START;
+ BEGIN(ReadTypeConstraint);
+ }
}
<ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} {
QCString name=yytext; //resolveDefines(yytext);
@@ -588,9 +609,8 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
* for complex types are written to
*/
-void stringToArgumentList(const char *argsString,ArgumentList* al,QCString *extraTypeChars)
+void stringToArgumentList(SrcLangExt lang, const char *argsString,ArgumentList& al,QCString *extraTypeChars)
{
- if (al==0) return;
if (argsString==0) return;
printlex(yy_flex_debug, TRUE, __FILE__, NULL);
@@ -610,18 +630,18 @@ void stringToArgumentList(const char *argsString,ArgumentList* al,QCString *extr
g_curArgTypeName.resize(0);
g_curArgDefValue.resize(0);
g_curArgName.resize(0);
- g_argList = al;
+ g_argList = &al;
+ g_lang = lang;
defargsYYrestart( defargsYYin );
BEGIN( Start );
defargsYYlex();
+ if (g_argList->empty())
+ {
+ g_argList->noParameters = TRUE;
+ }
if (extraTypeChars) *extraTypeChars=g_extraTypeChars;
//printf("stringToArgumentList(%s) result=%s\n",argsString,argListToString(al).data());
printlex(yy_flex_debug, FALSE, __FILE__, NULL);
}
-#if !defined(YY_FLEX_SUBMINOR_VERSION)
-extern "C" { // some bogus code to keep the compiler happy
- void defargsYYdummy() { yy_flex_realloc(0,0); }
-}
-#endif
-
+#include "defargs.l.h"