aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-03-12 21:14:50 +0100
committerClifford Wolf <clifford@clifford.at>2019-03-12 21:15:11 +0100
commit1cd04a68389671c91dddb56cc3d2f9032f9b44e3 (patch)
tree104daee0bbb581ce337bed0d153a0e25e015a769 /kernel
parentac10f72e49d87ccca82207eceee6c2aadb01820d (diff)
downloadyosys-1cd04a68389671c91dddb56cc3d2f9032f9b44e3.tar.gz
yosys-1cd04a68389671c91dddb56cc3d2f9032f9b44e3.tar.bz2
yosys-1cd04a68389671c91dddb56cc3d2f9032f9b44e3.zip
Fix a bug in handling quotes in multi-cmd lines in Yosys scripts
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/yosys.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc
index 6fd53f85e..450e4e4cf 100644
--- a/kernel/yosys.cc
+++ b/kernel/yosys.cc
@@ -218,12 +218,18 @@ std::string next_token(std::string &text, const char *sep, bool long_strings)
if (long_strings && pos_begin != text.size() && text[pos_begin] == '"') {
string sep_string = sep;
- for (size_t i = pos_begin+1; i < text.size(); i++)
+ for (size_t i = pos_begin+1; i < text.size(); i++) {
if (text[i] == '"' && (i+1 == text.size() || sep_string.find(text[i+1]) != std::string::npos)) {
std::string token = text.substr(pos_begin, i-pos_begin+1);
text = text.substr(i+1);
return token;
}
+ if (i+1 < text.size() && text[i] == '"' && text[i+1] == ';' && (i+2 == text.size() || sep_string.find(text[i+2]) != std::string::npos)) {
+ std::string token = text.substr(pos_begin, i-pos_begin+1);
+ text = text.substr(i+2);
+ return token + ";";
+ }
+ }
}
size_t pos_end = text.find_first_of(sep, pos_begin);