summaryrefslogtreecommitdiff
path: root/fast/util.hh
diff options
context:
space:
mode:
Diffstat (limited to 'fast/util.hh')
-rw-r--r--fast/util.hh19
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