mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #550 from jimparis/yosys-upstream
Support SystemVerilog `` extension for macros
This commit is contained in:
commit
177a989e48
|
@ -183,8 +183,9 @@ static std::string next_token(bool pass_newline = false)
|
||||||
const char *ok = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ$0123456789";
|
const char *ok = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ$0123456789";
|
||||||
if (ch == '`' || strchr(ok, ch) != NULL)
|
if (ch == '`' || strchr(ok, ch) != NULL)
|
||||||
{
|
{
|
||||||
|
char first = ch;
|
||||||
ch = next_char();
|
ch = next_char();
|
||||||
if (ch == '"') {
|
if (first == '`' && (ch == '"' || ch == '`')) {
|
||||||
token += ch;
|
token += ch;
|
||||||
} else do {
|
} else do {
|
||||||
if (strchr(ok, ch) == NULL) {
|
if (strchr(ok, ch) == NULL) {
|
||||||
|
@ -244,6 +245,7 @@ static bool try_expand_macro(std::set<std::string> &defines_with_args,
|
||||||
args.push_back(std::string());
|
args.push_back(std::string());
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
skip_spaces();
|
||||||
tok = next_token(true);
|
tok = next_token(true);
|
||||||
if (tok == ")" || tok == "}" || tok == "]")
|
if (tok == ")" || tok == "}" || tok == "]")
|
||||||
level--;
|
level--;
|
||||||
|
@ -264,6 +266,9 @@ static bool try_expand_macro(std::set<std::string> &defines_with_args,
|
||||||
}
|
}
|
||||||
insert_input(defines_map[name]);
|
insert_input(defines_map[name]);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (tok == "``") {
|
||||||
|
// Swallow `` in macro expansion
|
||||||
|
return true;
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue