精神上似乎发生了一些变化::x3 破坏了我奇特的小 asdl 解析器。当我从 Qi 移植它时(在最初的 x3 错误修复进入 Fedora 后),它工作得很好,但现在失败了:
/usr/include/boost/spirit/home/x3/operator/detail/sequence.hpp:143:9:错误:静态断言失败:属性没有预期的大小。
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include "asdl.h"
typedef boost::variant<asdl::ast::Product, asdl::ast::Sum> type_variant;
typedef std::vector<asdl::ast::Field> field_vec;
BOOST_FUSION_ADAPT_STRUCT(
asdl::ast::Module,
(std::string, id)
(std::vector<asdl::ast::Type>, dfns))
BOOST_FUSION_ADAPT_STRUCT(
asdl::ast::Type,
(std::string, name)
(type_variant, value))
BOOST_FUSION_ADAPT_STRUCT(
asdl::ast::Field,
(std::string, type)
(boost::optional<char>, flag)
(boost::optional<std::string>, name))
BOOST_FUSION_ADAPT_STRUCT(
asdl::ast::Constructor,
(std::string, name)
(boost::optional<field_vec>, fields))
BOOST_FUSION_ADAPT_STRUCT(
asdl::ast::Sum,
(std::vector<asdl::ast::Constructor>, types)
(boost::optional<field_vec>, attributes))
BOOST_FUSION_ADAPT_STRUCT(
asdl::ast::Product,
(field_vec, fields))
namespace asdl
{
namespace x3 = boost::spirit::x3;
namespace ascii = boost::spirit::x3::ascii;
x3::rule<class module, ast::Module > const module = "module";
x3::rule<class …Run Code Online (Sandbox Code Playgroud)