token: refactoring the 'isStandardType' a little
This commit is contained in:
parent
c95fee7266
commit
b179083788
11
token.cpp
11
token.cpp
|
@ -193,16 +193,13 @@ bool TOKEN::isNumber() const
|
|||
return _isNumber;
|
||||
}
|
||||
|
||||
|
||||
bool TOKEN::IsStandardType(const char str[])
|
||||
bool TOKEN::isStandardType() const
|
||||
{
|
||||
if (!str)
|
||||
return false;
|
||||
bool Ret = false;
|
||||
bool ret = false;
|
||||
const char *type[] = {"bool","char","short","int","long","float","double",0};
|
||||
for (int i = 0; type[i]; i++)
|
||||
Ret |= (strcmp(str,type[i])==0);
|
||||
return Ret;
|
||||
ret |= (_str == type[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
2
token.h
2
token.h
|
@ -64,7 +64,7 @@ public:
|
|||
static bool Match(const TOKEN *tok, const char pattern[], const char *varname1[]=0, const char *varname2[]=0);
|
||||
bool isName() const;
|
||||
bool isNumber() const;
|
||||
static bool IsStandardType(const char str[]);
|
||||
bool isStandardType() const;
|
||||
static const TOKEN *findmatch(const TOKEN *tok, const char pattern[], const char *varname1[]=0, const char *varname2[]=0);
|
||||
static const TOKEN *findtoken(const TOKEN *tok1, const char *tokenstr[]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue