"my/file.hpp"
以下のプログラムは、やなどの C++ ヘッダー インクルード文字列を解析しようとします<my/file.hpp>
。理由がわかりませんが、私のコードは"
ヘッダーを解析できません。これはスピリットのバグですか、それとも明らかな何かが欠けていますか?
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/home/x3.hpp>
#include <iostream>
#include <string>
#include <cassert>
using namespace boost::spirit::x3;
int main() {
auto header_name_brackets = '<' >> *(~char_('>')) >> '>';
auto header_name_quotes = '"' >> *(~char_('>')) >> '"';
{
auto s = std::string{"<my/file.hpp>"};
std::string parsed;
assert(phrase_parse(s.begin(), s.end(), header_name_brackets, space, parsed));
}
{
auto s = std::string{"\"my/file.hpp\""};
std::string parsed;
// this assert fails, but I don't know why.
assert(phrase_parse(s.begin(), s.end(), header_name_quotes, space, parsed));
}
}