リファレンスのトップ
大項目 | 記法 | 説明 | 返り値と変数への代入 (Attribute) |
マッチイベント呼び出し Action |
p[fa] | パーサpにマッチした時にfa関数を呼び出します。 faはtemplateで定義されているので、引数の型と数が合っていれば、関数でも関数オブジェクトでもよいです。 template <typename Attrib, typename Context> void fa(Attrib& attr, Context& context, bool& pass); |
p: P --> p[fa]: P パーサpの返り値を返します。 |
パーサ自動推測パーサAuto | auto_ | 与えられた返り値型に従って、自動でパーサを作ります。 あらかじめ、型に対してどのようにパースを作るか(create_parse)を定義しておき、コンパイラに型に応じてどのcreate_parseを採用するかを決めさせます。 使用例: 以下の場合はintを推測させています。 int i = 0; string s("123"); string::const_iterator begin = s.begin(); parse(begin, s.end(), auto_, i); ⇒ i=123が設定されます。 spiritで用意している定義(create_parse)も存在します。 以下の型に対しては用意されています。 char, wchar_t, short, int, long unsigned short, unsigned int, unsigned long float, double, long double long long, unsigned long long bool STLで用意されているコンテナ(std::vectorなど) BoostのFusion sequence boost::optional<> , boost::variant<> |
hold_any Boost.Anyと同じ意味です。 |