diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-02-14 08:41:03 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-02-14 08:41:03 +0100 |
commit | ef151b0b30c7b7253aceba6d184e7721a4eff0c0 (patch) | |
tree | 8c3d8cae759a504076fd978a8ff7a3ca24776960 /frontends | |
parent | 756b4064b29cf07bf0870f06dd538b34763f3cdd (diff) | |
download | yosys-ef151b0b30c7b7253aceba6d184e7721a4eff0c0.tar.gz yosys-ef151b0b30c7b7253aceba6d184e7721a4eff0c0.tar.bz2 yosys-ef151b0b30c7b7253aceba6d184e7721a4eff0c0.zip |
Fixed handling of "//" in filenames in verilog pre-processor
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/verilog/preproc.cc | 2 | ||||
-rw-r--r-- | frontends/verilog/verilog_lexer.l | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/frontends/verilog/preproc.cc b/frontends/verilog/preproc.cc index 4e5d16599..e2118630e 100644 --- a/frontends/verilog/preproc.cc +++ b/frontends/verilog/preproc.cc @@ -201,7 +201,7 @@ static void input_file(std::istream &f, std::string filename) insert_input(""); auto it = input_buffer.begin(); - input_buffer.insert(it, "`file_push " + filename + "\n"); + input_buffer.insert(it, "`file_push \"" + filename + "\"\n"); while ((rc = readsome(f, buffer, sizeof(buffer)-1)) > 0) { buffer[rc] = 0; input_buffer.insert(it, buffer); diff --git a/frontends/verilog/verilog_lexer.l b/frontends/verilog/verilog_lexer.l index cb8fafcb2..13b3e2bfc 100644 --- a/frontends/verilog/verilog_lexer.l +++ b/frontends/verilog/verilog_lexer.l @@ -85,6 +85,10 @@ YOSYS_NAMESPACE_END fn_stack.push_back(current_filename); ln_stack.push_back(frontend_verilog_yyget_lineno()); current_filename = yytext+11; + if (!current_filename.empty() && current_filename.front() == '"') + current_filename = current_filename.substr(1); + if (!current_filename.empty() && current_filename.back() == '"') + current_filename = current_filename.substr(0, current_filename.size()-1); frontend_verilog_yyset_lineno(0); } |