4 #include <boost/tokenizer.hpp> 12 std::ifstream
input(filename.c_str());
17 while (getline(
input, buffer)) {
27 while (getline(std::cin, line)) {
35 if (!result.empty()) {
37 if (result[0] ==
'"' || result[0] ==
'\'') {
42 if (!result.empty()) {
44 int lastpos = result.size() - 1;
45 if (result[lastpos] ==
'"' || result[lastpos] ==
'\'') {
46 result.erase(lastpos, 1);
53 typedef boost::char_separator<char> separator_t;
54 typedef boost::tokenizer<separator_t> tokenizer_t;
56 std::vector<std::string>
result;
57 separator_t sep(separator.c_str(),
"", boost::keep_empty_tokens);
58 tokenizer_t tokens(input, sep);
59 copy_all(tokens, std::back_inserter<std::vector<std::string> >(result));
std::string read_whole_file(std::string const &filename)
only does the yacc interpretation
static std::string const input
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
static std::string const separator(":")
void read_from_cin(std::string &output)
std::string withoutQuotes(std::string const &from)
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator