diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-05-17 14:10:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 14:10:24 +0200 |
commit | 177a989e48d13b1b983b28a9c322967548a138ee (patch) | |
tree | 37f57b505d69160d8efff34d68d8dabd13b7f8c1 | |
parent | c3be94e967c904d4b7a0591fdaa2d86bc926ec41 (diff) | |
parent | 4a229e5b953c15ecb31945258e0ca2f7bffe8a3e (diff) | |
download | yosys-177a989e48d13b1b983b28a9c322967548a138ee.tar.gz yosys-177a989e48d13b1b983b28a9c322967548a138ee.tar.bz2 yosys-177a989e48d13b1b983b28a9c322967548a138ee.zip |
Merge pull request #550 from jimparis/yosys-upstream
Support SystemVerilog `` extension for macros
-rw-r--r-- | frontends/verilog/preproc.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/frontends/verilog/preproc.cc b/frontends/verilog/preproc.cc index c43ff4e3a..dea22ee8a 100644 --- a/frontends/verilog/preproc.cc +++ b/frontends/verilog/preproc.cc @@ -183,8 +183,9 @@ static std::string next_token(bool pass_newline = false) const char *ok = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ$0123456789"; if (ch == '`' || strchr(ok, ch) != NULL) { + char first = ch; ch = next_char(); - if (ch == '"') { + if (first == '`' && (ch == '"' || ch == '`')) { token += ch; } else do { 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()); while (1) { + skip_spaces(); tok = next_token(true); if (tok == ")" || tok == "}" || tok == "]") level--; @@ -264,6 +266,9 @@ static bool try_expand_macro(std::set<std::string> &defines_with_args, } insert_input(defines_map[name]); return true; + } else if (tok == "``") { + // Swallow `` in macro expansion + return true; } else return false; } |