如何在VS2017中在提升精神x3中制定递归规则
How to make a recursive rule in boost spirit x3 in VS2017
我在boost::spirit::x3中编写了以下递归规则,但它似乎只在g ++/clang中编译,而不是VS2017(15.5.3(:
#include <iostream>
#include <boost/spirit/home/x3.hpp>
namespace lex3
{
namespace x3 = boost::spirit::x3;
x3::rule<struct foo_class> const foo = "foo";
x3::rule<struct bar_class> const bar = "bar";
auto bar_def = *((x3::char_ - "/*") - "*/") >> *(foo > *((x3::char_ - "/*") - "*/"));
auto foo_def = "/*" > bar > "*/";
BOOST_SPIRIT_DEFINE(foo)
BOOST_SPIRIT_DEFINE(bar)
}
int main(int argc, char** argv)
{
std::string input = "/* a /* nested */ comment */";
auto f = input.begin();
auto l = input.end();
if (parse(f, l, lex3::foo) && (f == l))
std::cout << "Parse success.n";
else
std::cout << "Parse failure (remainder: " << std::string(f, l) << ").n";
return 0;
}
Coliru link, g++
Coliru 链接,叮当++
如何在VS2017中完成这项工作(如果可能(?
P.S:平台工具集设置为v141,ISO标准设置为C++17,boost版本设置为1.66.0
P.P.S:编译错误如下
error C2039: 'insert': is not a member of 'boost::spirit::x3::unused_type'
note: see declaration of 'boost::spirit::x3::unused_type'
error C2039: 'end': is not a member of 'boost::spirit::x3::unused_type'
note: see declaration of 'boost::spirit::x3::unused_type'
error C2039: 'begin': is not a member of 'boost::spirit::x3::unused_type'
note: see declaration of 'boost::spirit::x3::unused_type'
我查看了GitHub上的Boost.Spirit存储库,因为我的本地版本太旧了,并注意到您的示例在最新的develop
分支上编译良好,但在1.66.0版本(也在Clang和GCC上(上编译不行。 将提交历史记录一分为二显示此错误已在
ee4943d5891bdae0706fb616b908e3bf528e0dfa
您可以将此提交的修补程序应用到安装中,也可以等待下一个版本。
相关文章:
- 通过递归进行因子分解
- 递归函数计算序列中的平方和(并输出过程)
- 使用递归的数组的最小值.这是怎么回事
- 递归列出所有目录中的C++与Python与Ruby的性能
- 递归计数给定目录的文件和所有目录
- 如何在BST的这个简单递归实现中消除警告
- C++:正在检查LinkedList中的回文-递归方法-错误
- 递归模板化函数不能分配给具有常量限定类型"const tt &"的变量"state"
- 递归无序映射
- TSP递归解的迭代形式
- 如何在Elixir中调用递归函数并行
- 返回递归调用和仅递归调用的区别
- 精神:不能在其规则定义中使用x3::skip(skipper)[一些递归规则]
- 如何替换提升精神x3中的左递归?
- 递归 x3 解析器,结果传递
- 如何在VS2017中在提升精神x3中制定递归规则
- Boost.Spirit X3 编译时间因递归规则而爆炸
- Boost.Spirit(X3,Boost 1.64):如何正确实施此递归规则
- 使用 spirit x3 解析递归规则
- 消除spirit x3解析器规则中的左递归