boost-spirit-x3

    3热度

    1回答

    我尝试将float或int的简单列表解析为变体的向量。我在Windows上使用boost 1.64(mingw 64bit)。 下面是一个小例子: #include <boost/spirit/home/x3/support/ast/variant.hpp> #include <boost/fusion/adapted/struct.hpp> #include <boost/spirit/ho

    1热度

    1回答

    我试图使用Boost 1.65.1中的Spirit X3来创建解析器。我减少了我的问题,下面的小例子用更简单的结构: #include <boost/config/warning_disable.hpp> #include <boost/spirit/home/x3.hpp> #include <boost/fusion/include/adapt_struct.hpp> #include

    2热度

    1回答

    简单的x3代码无法编译,因为没有任何内容附加到第二个ruleTest或整个解析器。即使我们把x3::omit[ruleTest]围绕第二个ruleTest它仍然不能编译。 void Test(std::string const& str) { auto const ruleTest = x3::rule<struct _, std::string>{} = *(x3::cha

    2热度

    2回答

    我最终得到了这些移动错误很多,我不太清楚为什么除了解析字符串的方式之外。删除与“虚拟”相关的所有内容,并返回错误。 有人提到使用attr_gen(在文档中找不到),通过这样做,我可以通过这些“traits :: move_to”编译错误,但解析器仍然失败。我已经标记了我为了编译而添加的行,但不要认为“< ---”是必要的。 #define BOOST_SPIRIT_X3_DEBUG #incl

    3热度

    1回答

    不能编译任何example 在Ubuntu 16.04 $ g++ -std=c++14 main.cpp In file included from /usr/include/boost/spirit/home/x3/nonterminal.hpp:14:0, from /usr/include/boost/spirit/home/x3.hpp:20, from

    2热度

    1回答

    假设我们想要解析像这样的递归块。当“skip_comments_tag”以块为前缀时,我们会以递归方式跳过此块中的所有注释(/*...*/)。 { {} { skip_comments_tag{ {} /*comments*/ { /*comments*/ } } } } 很容易想出一个递归解析器,如Colir

    1热度

    1回答

    BNF I实施了一个有趣的规则,根据运营商的不同,这些条款可以是链接的或事件不符合此生产规则。因此,我使用同样的AST数据结构,因为仅枚举变化: #include <boost/spirit/home/x3.hpp> #include <boost/fusion/include/adapt_struct.hpp> #include <iostream> #include <string>

    1热度

    1回答

    我正在努力提升精神x3,并且对一点不清楚。我有一个具有非常不同和重复行的文件。前几行可能是注释。接下来的1000行可能是坐标,下一千行可能是int的列表等等... 我的问题是如何识别行并知道该行使用哪个解析器。例如,这里有两个解析器函数.... template <typename Iterator> bool parse_ints(Iterator first, Iterator last,

    2热度

    1回答

    我基于我的应用程序关闭这个例子,并得到完全相同的结果。出于某种原因,输入字符串的内容全部被解析为融合结构'comments',并且没有任何东西被解析为融合结构'numbers'。所以不知道我在哪里错了。 namespace client { namespace ast { struct number { int num1; int num2;

    2热度

    1回答

    从升压精神X3教程: 首先,让我们创建一个代表雇员一个结构: namespace client { namespace ast { struct employee { int age; std::string surname; std::string forename; double salary; }; }}