Optimization: isNotPattern() removed
This commit is contained in:
parent
d24913caf8
commit
a303cf278d
12
token.cpp
12
token.cpp
|
@ -159,7 +159,7 @@ bool TOKEN::Match(const TOKEN *tok, const char pattern[], const char *varname1[]
|
||||||
if (!tok)
|
if (!tok)
|
||||||
{
|
{
|
||||||
// If we have no tokens, pattern "!!else" should return true
|
// If we have no tokens, pattern "!!else" should return true
|
||||||
if( isNotPattern( p ) )
|
if( p[1] == '!' && p[0] == '!' && strlen(p) > 2 )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -294,7 +294,7 @@ bool TOKEN::Match(const TOKEN *tok, const char pattern[], const char *varname1[]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse "not" options. Token can be anything except the given one
|
// Parse "not" options. Token can be anything except the given one
|
||||||
else if( isNotPattern( str ) )
|
else if( str[1] == '!' && str[0] == '!' && strlen(str) > 2 )
|
||||||
{
|
{
|
||||||
if( strcmp( tok->aaaa(), &(str[2]) ) == 0 )
|
if( strcmp( tok->aaaa(), &(str[2]) ) == 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -310,14 +310,6 @@ bool TOKEN::Match(const TOKEN *tok, const char pattern[], const char *varname1[]
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TOKEN::isNotPattern( const char *pattern )
|
|
||||||
{
|
|
||||||
if( pattern && strlen(pattern) > 2 && pattern[0] == '!' && pattern[1] == '!' )
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TOKEN::isName() const
|
bool TOKEN::isName() const
|
||||||
{
|
{
|
||||||
return _isName;
|
return _isName;
|
||||||
|
|
10
token.h
10
token.h
|
@ -155,16 +155,6 @@ private:
|
||||||
void next( TOKEN *next );
|
void next( TOKEN *next );
|
||||||
void previous( TOKEN *previous );
|
void previous( TOKEN *previous );
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if pattern is e.g. "!!else".
|
|
||||||
* See Match() for more info.
|
|
||||||
*
|
|
||||||
* @param pattern Pattern to match, e.g. "if ; !!else"
|
|
||||||
* @return true if pattern starts with "!!" and contains 3
|
|
||||||
* or more characters.
|
|
||||||
*/
|
|
||||||
static bool isNotPattern( const char *pattern );
|
|
||||||
|
|
||||||
std::string _str;
|
std::string _str;
|
||||||
char * _cstr;
|
char * _cstr;
|
||||||
bool _isName;
|
bool _isName;
|
||||||
|
|
Loading…
Reference in New Issue