Added %name% pattern to Token.
Currenly same as %var%, but in the future %var% is supposed to match only tokens that have varid != 0.
This commit is contained in:
parent
17b8d025a3
commit
ba00e031c0
|
@ -375,6 +375,9 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
|
||||||
bool patternIdentified = false;
|
bool patternIdentified = false;
|
||||||
if (p[0] == '%')
|
if (p[0] == '%')
|
||||||
{
|
{
|
||||||
|
// TODO: %var% should match only for
|
||||||
|
// variables that have varId != 0, but that needs a lot of
|
||||||
|
// work, before that change can be made.
|
||||||
// Any symbolname..
|
// Any symbolname..
|
||||||
if (firstWordEquals(p, "%var%") == 0)
|
if (firstWordEquals(p, "%var%") == 0)
|
||||||
{
|
{
|
||||||
|
@ -384,6 +387,15 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
|
||||||
patternIdentified = true;
|
patternIdentified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Any symbolname..
|
||||||
|
if (firstWordEquals(p, "%name%") == 0)
|
||||||
|
{
|
||||||
|
if (!tok->isName())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
patternIdentified = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Type..
|
// Type..
|
||||||
if (firstWordEquals(p, "%type%") == 0)
|
if (firstWordEquals(p, "%type%") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
* Possible patterns
|
* Possible patterns
|
||||||
* "%any%" any token
|
* "%any%" any token
|
||||||
* "%var%" any token which is a name or type e.g. "hello" or "int"
|
* "%var%" any token which is a name or type e.g. "hello" or "int"
|
||||||
|
* "%name%" any token which is a name or type e.g. "hello" or "int"
|
||||||
* "%type%" Anything that can be a variable type, e.g. "int", but not "delete".
|
* "%type%" Anything that can be a variable type, e.g. "int", but not "delete".
|
||||||
* "%num%" Any numeric token, e.g. "23"
|
* "%num%" Any numeric token, e.g. "23"
|
||||||
* "%bool%" true or false
|
* "%bool%" true or false
|
||||||
|
|
Loading…
Reference in New Issue