mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-26 18:45:34 +00:00
verilog: strip leading and trailing spaces in macro args
This commit is contained in:
parent
98afe2b758
commit
27257a419f
2 changed files with 25 additions and 1 deletions
|
@ -390,12 +390,16 @@ static void input_file(std::istream &f, std::string filename)
|
|||
// the argument list); false if we finished with ','.
|
||||
static bool read_argument(std::string &dest)
|
||||
{
|
||||
skip_spaces();
|
||||
std::vector<char> openers;
|
||||
for (;;) {
|
||||
std::string tok = next_token(true);
|
||||
if (tok == ")") {
|
||||
if (openers.empty())
|
||||
if (openers.empty()) {
|
||||
while (dest.size() && (dest.back() == ' ' || dest.back() == '\t'))
|
||||
dest = dest.substr(0, dest.size() - 1);
|
||||
return true;
|
||||
}
|
||||
if (openers.back() != '(')
|
||||
log_error("Mismatched brackets in macro argument: %c and %c.\n",
|
||||
openers.back(), tok[0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue