diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-08-13 13:03:38 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-08-13 13:03:38 +0200 |
commit | f53984795d38946ee71684d88883cafd9f58f603 (patch) | |
tree | 21aff3aeacec725c3f7ff1eea59561955e735e50 /frontends/verilog | |
parent | 9d353fc543295db7d6f4b4ba60c2b66a509b3ee2 (diff) | |
download | yosys-f53984795d38946ee71684d88883cafd9f58f603.tar.gz yosys-f53984795d38946ee71684d88883cafd9f58f603.tar.bz2 yosys-f53984795d38946ee71684d88883cafd9f58f603.zip |
Added support for non-standard """ macro bodies
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/preproc.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/frontends/verilog/preproc.cc b/frontends/verilog/preproc.cc index 8efd4d7c3..7935fbc34 100644 --- a/frontends/verilog/preproc.cc +++ b/frontends/verilog/preproc.cc @@ -131,6 +131,12 @@ static std::string next_token(bool pass_newline = false) token += ch; } } + if (token == "\"\"" && (ch = next_char()) != 0) { + if (ch == '"') + token += ch; + else + return_char(ch); + } } else if (ch == '/') { @@ -311,12 +317,17 @@ std::string frontend_verilog_preproc(FILE *f, std::string filename, const std::m std::map<std::string, int> args; skip_spaces(); name = next_token(true); + bool here_doc_mode = false; int newline_count = 0; int state = 0; if (skip_spaces() != "") state = 3; while (!tok.empty()) { tok = next_token(); + if (tok == "\"\"\"") { + here_doc_mode = !here_doc_mode; + continue; + } if (state == 0 && tok == "(") { state = 1; skip_spaces(); @@ -332,7 +343,7 @@ std::string frontend_verilog_preproc(FILE *f, std::string filename, const std::m } else { if (state != 2) state = 3; - if (tok == "\n") { + if (tok == "\n" && !here_doc_mode) { return_char('\n'); break; } |