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; }; }}