相关疑难解决方法(0)

如何使用boost :: spirit :: qi解析行尾?

不应该简单eol的伎俩吗?

#include <algorithm>
#include <boost/spirit/include/qi.hpp>
#include <iostream>
#include <string>
using boost::spirit::ascii::space;
using boost::spirit::lit;
using boost::spirit::qi::eol;
using boost::spirit::qi::phrase_parse;

struct fix : std::unary_function<char, void> {
  fix(std::string &result) : result(result) {}
  void operator() (char c) {
    if      (c == '\n') result += "\\n";
    else if (c == '\r') result += "\\r";
    else                result += c;
  }
  std::string &result;
};

template <typename Parser>
void parse(const std::string &s, const Parser &p) {
  std::string::const_iterator it = s.begin(), end = s.end();
  bool r = phrase_parse(it, …
Run Code Online (Sandbox Code Playgroud)

c++ eol boost-spirit boost-spirit-qi

9
推荐指数
1
解决办法
4004
查看次数

标签 统计

boost-spirit ×1

boost-spirit-qi ×1

c++ ×1

eol ×1