diff options
author | Patrick Simianer <p@simianer.de> | 2014-08-24 17:26:05 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-08-24 17:26:05 +0100 |
commit | f1916c39b820b7d10d1ae7d7447675c4224d8197 (patch) | |
tree | 7d3673d7784e7b3adbb6ca5b86e31058176bd376 /fast/util.hh | |
parent | cef65063cec641a93973b38a48e100fdd115db44 (diff) |
fixes
Diffstat (limited to 'fast/util.hh')
-rw-r--r-- | fast/util.hh | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fast/util.hh b/fast/util.hh index c3e087e..9ce19da 100644 --- a/fast/util.hh +++ b/fast/util.hh @@ -2,13 +2,16 @@ #include <string> +#include "weaver.hh" + using namespace std; namespace util { inline string -json_escape(const string& s) { // FIXME: only inline? +json_escape(const string& s) +{ ostringstream os; for (auto it = s.cbegin(); it != s.cend(); it++) { switch (*it) { @@ -26,5 +29,19 @@ json_escape(const string& s) { // FIXME: only inline? return os.str(); } +inline vector<symbol_t> +tokenize(string s) +{ + istringstream ss(s); + vector<symbol_t> r; + while (ss.good()) { + string buf; + ss >> buf; + r.push_back(buf); + } + + return r; +} + } // namespace util |