mirror of https://github.com/YosysHQ/yosys.git
Improved ID matching scheme in select (and thus for all commands)
This commit is contained in:
parent
792bbad448
commit
293356e87c
|
@ -29,10 +29,20 @@ static std::vector<RTLIL::Selection> work_stack;
|
||||||
|
|
||||||
static bool match_ids(RTLIL::IdString id, std::string pattern)
|
static bool match_ids(RTLIL::IdString id, std::string pattern)
|
||||||
{
|
{
|
||||||
if (!fnmatch(pattern.c_str(), id.c_str(), FNM_NOESCAPE))
|
if (id == pattern)
|
||||||
return true;
|
return true;
|
||||||
if (id.size() > 0 && id[0] == '\\' && !fnmatch(pattern.c_str(), id.substr(1).c_str(), FNM_NOESCAPE))
|
if (id.size() > 0 && id[0] == '\\' && id.substr(1) == pattern)
|
||||||
return true;
|
return true;
|
||||||
|
if (!fnmatch(pattern.c_str(), id.c_str(), 0))
|
||||||
|
return true;
|
||||||
|
if (id.size() > 0 && id[0] == '\\' && !fnmatch(pattern.c_str(), id.substr(1).c_str(), 0))
|
||||||
|
return true;
|
||||||
|
if (id.size() > 0 && id[0] == '$' && pattern.size() > 0 && pattern[0] == '$') {
|
||||||
|
const char *p = id.c_str();
|
||||||
|
const char *q = strrchr(p, '$');
|
||||||
|
if (pattern == q)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue