diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-04-24 22:04:05 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-04-24 22:04:05 +0200 |
commit | 49859393bbddfe9445757f3df0ff573c9072a594 (patch) | |
tree | b6aa1b32b1ae03c5427fcf3463c11ad274848568 /kernel/yosys.cc | |
parent | 687f5a5b12b41c4e26c9e5b8d3815c268a7ff7be (diff) | |
download | yosys-49859393bbddfe9445757f3df0ff573c9072a594.tar.gz yosys-49859393bbddfe9445757f3df0ff573c9072a594.tar.bz2 yosys-49859393bbddfe9445757f3df0ff573c9072a594.zip |
Improved attributes API and handling of "src" attributes
Diffstat (limited to 'kernel/yosys.cc')
-rw-r--r-- | kernel/yosys.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 7494b7e3c..1d6e7113b 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -209,6 +209,26 @@ std::string next_token(std::string &text, const char *sep, bool long_strings) return token; } +std::vector<std::string> split_tokens(const std::string &text, const char *sep) +{ + std::vector<std::string> tokens; + std::string current_token; + for (char c : text) { + if (strchr(sep, c)) { + if (!current_token.empty()) { + tokens.push_back(current_token); + current_token.clear(); + } + } else + current_token += c; + } + if (!current_token.empty()) { + tokens.push_back(current_token); + current_token.clear(); + } + return tokens; +} + // this is very similar to fnmatch(). the exact rules used by this // function are: // |