| <?xml version="1.0" encoding="utf-8"?> |
| <header name="boost/proto/matches.hpp"> |
| <para> |
| Contains definition of the |
| <computeroutput> |
| <classname alt="boost::proto::matches">proto::matches<></classname> |
| </computeroutput> |
| metafunction for determining if a given expression matches a given pattern. |
| </para> |
| <namespace name="boost"> |
| <namespace name="proto"> |
| <struct name="_"> |
| <inherit><type><classname>proto::transform</classname><_></type></inherit> |
| <purpose>A wildcard grammar element that matches any expression, and a transform that returns |
| the current expression unchanged.</purpose> |
| <description> |
| <para> |
| The wildcard type, <computeroutput>proto::_</computeroutput>, is a grammar element such |
| that <computeroutput><classname>proto::matches</classname><E, proto::_>::value</computeroutput> |
| is <computeroutput>true</computeroutput> for any expression type <computeroutput>E</computeroutput>. |
| </para> |
| <para> |
| The wildcard can also be used as a stand-in for a template argument when matching terminals. |
| For instance, the following is a grammar that will match any |
| <computeroutput>std::complex<></computeroutput> terminal:<programlisting>BOOST_MPL_ASSERT(( |
| <classname>proto::matches</classname>< |
| <classname>proto::terminal</classname><std::complex<double> >::type, |
| <emphasis role="bold"><classname>proto::terminal</classname><std::complex< proto::_ > ></emphasis> |
| > |
| ));</programlisting> |
| </para> |
| <para> |
| When used as a transform, <computeroutput>proto::_</computeroutput> returns the current expression |
| unchanged. For instance, in the following, <computeroutput>proto::_</computeroutput> is used with |
| the <computeroutput><classname alt="proto::fold">proto::fold<></classname></computeroutput> |
| transform to fold the children of a node:<programlisting>struct CountChildren : |
| <classname>proto::or_</classname>< |
| // Terminals have no children |
| <classname>proto::when</classname><<classname>proto::terminal</classname><proto::_>, mpl::int_<0>()>, |
| // Use proto::fold<> to count the children of non-terminals |
| <classname>proto::otherwise</classname>< |
| <classname>proto::fold</classname>< |
| proto::_, // <-- fold the current expression |
| mpl::int_<0>(), |
| mpl::plus<<classname>proto::_state</classname>, mpl::int_<1> >() |
| > |
| > |
| > |
| {};</programlisting> |
| </para> |
| </description> |
| <struct name="impl"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="State"/> |
| <template-type-parameter name="Data"/> |
| </template> |
| <inherit><type><classname>proto::transform_impl</classname><Expr, State, Data></type></inherit> |
| <typedef name="result_type"> |
| <type>Expr</type> |
| </typedef> |
| <method-group name="public member functions"> |
| <method name="operator()" cv="const"> |
| <type>Expr</type> |
| <parameter name="expr"> |
| <paramtype>typename impl::expr_param</paramtype> |
| <description> |
| <para>An expression </para> |
| </description> |
| </parameter> |
| <parameter name=""> |
| <paramtype>typename impl::state_param</paramtype> |
| </parameter> |
| <parameter name=""> |
| <paramtype>typename impl::data_param</paramtype> |
| </parameter> |
| <returns> |
| <para> |
| <computeroutput>expr</computeroutput> |
| </para> |
| </returns> |
| </method> |
| </method-group> |
| </struct> |
| <typedef name="proto_grammar"> |
| <type>_</type> |
| </typedef> |
| </struct> |
| |
| <!-- proto::not_ --> |
| <struct name="not_"> |
| <template> |
| <template-type-parameter name="Grammar"/> |
| </template> |
| <inherit><type><classname>proto::transform</classname><not_<Grammar> ></type></inherit> |
| <purpose>Inverts the set of expressions matched by a grammar. When used as a transform, |
| <computeroutput>proto::not_<></computeroutput> returns the current expression unchanged. |
| </purpose> |
| <description> |
| <para> |
| If an expression type <computeroutput>E</computeroutput> does not match a grammar |
| <computeroutput>G</computeroutput>, then <computeroutput>E</computeroutput> <emphasis>does</emphasis> |
| match <computeroutput>proto::not_<G></computeroutput>. For example, |
| <computeroutput><classname>proto::not_</classname><<classname>proto::terminal</classname><<classname>proto::_</classname>> ></computeroutput> |
| will match any non-terminal. |
| </para> |
| </description> |
| <struct name="impl"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="State"/> |
| <template-type-parameter name="Data"/> |
| </template> |
| <inherit><type><classname>proto::transform_impl</classname><Expr, State, Data></type></inherit> |
| <typedef name="result_type"> |
| <type>Expr</type> |
| </typedef> |
| <method-group name="public member functions"> |
| <method name="operator()" cv="const"> |
| <type>Expr</type> |
| <parameter name="expr"> |
| <paramtype>typename impl::expr_param</paramtype> |
| <description> |
| <para>An expression </para> |
| </description> |
| </parameter> |
| <parameter name=""> |
| <paramtype>typename impl::state_param</paramtype> |
| </parameter> |
| <parameter name=""> |
| <paramtype>typename impl::data_param</paramtype> |
| </parameter> |
| <requires> |
| <para> |
| <computeroutput><classname>proto::matches</classname><Expr, proto::not_>::value</computeroutput> |
| is <computeroutput>true</computeroutput>. |
| </para> |
| </requires> |
| <returns> |
| <para> |
| <computeroutput>expr</computeroutput> |
| </para> |
| </returns> |
| </method> |
| </method-group> |
| </struct> |
| <typedef name="proto_grammar"> |
| <type>not_</type> |
| </typedef> |
| </struct> |
| |
| <!-- proto::if_ --> |
| <struct name="if_"> |
| <template> |
| <template-type-parameter name="If"/> |
| <template-type-parameter name="Then"> |
| <default><type><classname>proto::_</classname></type></default> |
| </template-type-parameter> |
| <template-type-parameter name="Else"> |
| <default><type><classname>proto::not_</classname><<classname>proto::_</classname>></type></default> |
| </template-type-parameter> |
| </template> |
| <inherit><classname>proto::transform</classname><if_<If, Then, Else> ></inherit> |
| <purpose>Used to select one grammar or another based on the result of a compile-time Boolean. |
| When used as a transform, <computeroutput>proto::if_<></computeroutput> selects between two |
| transforms based on a compile-time Boolean.</purpose> |
| <description> |
| <para> |
| When <computeroutput>proto::if_<If, Then, Else></computeroutput> is used as a grammar, |
| <computeroutput>If</computeroutput> must be a Proto transform and |
| <computeroutput>Then</computeroutput> and <computeroutput>Else</computeroutput> must be grammars. |
| An expression type <computeroutput>E</computeroutput> matches |
| <computeroutput>proto::if_<If, Then, Else></computeroutput> if |
| <computeroutput>boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, If>(E)>::type::value</computeroutput> |
| is <computeroutput>true</computeroutput> and |
| <computeroutput>E</computeroutput> matches <computeroutput>Then</computeroutput>; or, if |
| <computeroutput>boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, If>(E)>::type::value</computeroutput> |
| is <computeroutput>false</computeroutput> and <computeroutput>E</computeroutput> matches <computeroutput>Else</computeroutput>. |
| </para> |
| <para> |
| The template parameter <computeroutput>Then</computeroutput> defaults to <computeroutput><classname>proto::_</classname></computeroutput> |
| and <computeroutput>Else</computeroutput> defaults to |
| <computeroutput><classname>proto::not_</classname><<classname>proto::_</classname>></computeroutput>, |
| so an expression type <computeroutput>E</computeroutput> will match |
| <computeroutput>proto::if_<If></computeroutput> if and only if |
| <computeroutput>boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, If>(E)>::type::value</computeroutput> |
| is <computeroutput>true</computeroutput>. |
| </para> |
| <para> |
| <programlisting>// A grammar that only matches integral terminals, |
| // using is_integral<> from Boost.Type_traits. |
| struct IsIntegral : |
| <classname>proto::and_</classname>< |
| <classname>proto::terminal</classname><<classname>proto::_</classname>>, |
| <classname>proto::if_</classname>< boost::is_integral<<classname>proto::_value</classname>>()> |
| > |
| {};</programlisting> |
| </para> |
| <para> |
| When <computeroutput>proto::if_<If, Then, Else></computeroutput> is used as a transform, |
| <computeroutput>If</computeroutput>, <computeroutput>Then</computeroutput> and |
| <computeroutput>Else</computeroutput> must be Proto transforms. When applying the transform to |
| an expression <computeroutput>E</computeroutput>, state <computeroutput>S</computeroutput> and |
| data <computeroutput>V</computeroutput>, if |
| <computeroutput>boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, If>(E,S,V)>::type::value</computeroutput> |
| is <computeroutput>true</computeroutput> then the <computeroutput>Then</computeroutput> transform |
| is applied; otherwise the <computeroutput>Else</computeroutput> transform is applied. |
| <programlisting>// Match a terminal. If the terminal is integral, return |
| // mpl::true_; otherwise, return mpl::false_. |
| struct IsIntegral2 : |
| <classname>proto::when</classname>< |
| <classname>proto::terminal</classname><_>, |
| proto::if_< |
| boost::is_integral<<classname>proto::_value</classname>>(), |
| mpl::true_(), |
| mpl::false_() |
| > |
| > |
| {};</programlisting> |
| </para> |
| </description> |
| <struct name="impl"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="State"/> |
| <template-type-parameter name="Data"/> |
| </template> |
| <inherit><type><classname>proto::transform_impl</classname>< Expr, State, Data ></type></inherit> |
| <typedef name="result_type"> |
| <type>typename mpl::if_< |
| typename boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, If>(Expr, State, Data)>::type, |
| typename boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, Then>(Expr, State, Data)>::type, |
| typename boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>, Else>(Expr, State, Data)>::type |
| >::type</type> |
| </typedef> |
| <method-group name="public member functions"> |
| <method name="operator()" cv="const"> |
| <type>result_type</type> |
| <parameter name="expr"> |
| <paramtype>typename impl::expr_param</paramtype> |
| <description> |
| <para>An expression </para> |
| </description> |
| </parameter> |
| <parameter name="state"> |
| <paramtype>typename impl::state_param</paramtype> |
| <description> |
| <para>The current state </para> |
| </description> |
| </parameter> |
| <parameter name="data"> |
| <paramtype>typename impl::data_param</paramtype> |
| <description> |
| <para>A data of arbitrary type </para> |
| </description> |
| </parameter> |
| <returns> |
| <para> |
| <computeroutput><classname>proto::when</classname><<classname>proto::_</classname>, <replaceable>Then-or-Else</replaceable>>()(expr, state, data)</computeroutput> |
| </para> |
| </returns> |
| </method> |
| </method-group> |
| </struct> |
| <typedef name="proto_grammar"> |
| <type>if_</type> |
| </typedef> |
| </struct> |
| |
| <!-- proto::or_ --> |
| <struct name="or_"> |
| <template> |
| <template-type-parameter name="G" pack="1"/> |
| </template> |
| <inherit><type><classname>proto::transform</classname><or_<G...> ></type></inherit> |
| <purpose>For matching one of a set of alternate grammars. Alternates are tried in order to avoid ambiguity. |
| When used as a transform, <computeroutput>proto::or_<></computeroutput> applies the transform |
| associated with the first grammar that matches the expression.</purpose> |
| <description> |
| <para> |
| An expression type <computeroutput>E</computeroutput> matches |
| <computeroutput>proto::or_<G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>></computeroutput> |
| if <computeroutput>E</computeroutput> matches any <computeroutput>G<subscript>x</subscript></computeroutput> for |
| <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput>. |
| </para> |
| <para> |
| When applying |
| <computeroutput>proto::or_<G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>></computeroutput> |
| as a transform with an expression <computeroutput>e</computeroutput> of type <computeroutput>E</computeroutput>, |
| state <computeroutput>s</computeroutput> and data <computeroutput>d</computeroutput>, it is equivalent to |
| <computeroutput>G<subscript>x</subscript>()(e, s, d)</computeroutput>, where |
| <computeroutput>x</computeroutput> is the lowest number such that |
| <computeroutput><classname>proto::matches</classname><E, G<subscript>x</subscript>>::value</computeroutput> |
| is <computeroutput>true</computeroutput>. |
| </para> |
| <para> |
| The maximun number of template arguments <computeroutput>proto::or_<></computeroutput> accepts |
| is controlled by the <computeroutput><macroname>BOOST_PROTO_MAX_LOGICAL_ARITY</macroname></computeroutput> |
| macro. |
| </para> |
| </description> |
| <struct name="impl"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="State"/> |
| <template-type-parameter name="Data"/> |
| </template> |
| <inherit><type><classname>proto::transform_impl</classname>< Expr, State, Data ></type></inherit> |
| <typedef name="result_type"> |
| <type><replaceable>unspecified</replaceable></type> |
| </typedef> |
| <method-group name="public member functions"> |
| <method name="operator()" cv="const"> |
| <type>result_type</type> |
| <parameter name="expr"> |
| <paramtype>typename impl::expr_param</paramtype> |
| <description> |
| <para>An expression </para> |
| </description> |
| </parameter> |
| <parameter name="state"> |
| <paramtype>typename impl::state_param</paramtype> |
| <description> |
| <para>The current state </para> |
| </description> |
| </parameter> |
| <parameter name="data"> |
| <paramtype>typename impl::data_param</paramtype> |
| <description> |
| <para>A data of arbitrary type </para> |
| </description> |
| </parameter> |
| <returns> |
| <para> |
| <computeroutput> |
| G<subscript>x</subscript>()(expr, state, data) |
| </computeroutput>, where |
| <computeroutput>x</computeroutput> is the lowest number such that |
| <computeroutput> |
| <classname>proto::matches</classname><Expr, G<subscript>x</subscript>>::value |
| </computeroutput> |
| is <computeroutput>true</computeroutput>. |
| </para> |
| </returns> |
| </method> |
| </method-group> |
| </struct> |
| <typedef name="proto_grammar"> |
| <type>or_</type> |
| </typedef> |
| </struct> |
| |
| <!-- proto::and_ --> |
| <struct name="and_"> |
| <template> |
| <template-type-parameter name="G" pack="1"/> |
| </template> |
| <inherit><type><classname>proto::transform</classname><and_<G...> ></type></inherit> |
| <purpose>For matching all of a set of grammars. When used as a transform, |
| <computeroutput>proto::and_<></computeroutput> applies the transform associated |
| with each grammar in the set and returns the result of the last.</purpose> |
| <description> |
| <para> |
| An expression type <computeroutput>E</computeroutput> matches |
| <computeroutput>proto::and_<G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>></computeroutput> |
| if <computeroutput>E</computeroutput> matches all <computeroutput>G<subscript>x</subscript></computeroutput> |
| for <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput>. |
| </para> |
| <para> |
| When applying |
| <computeroutput>proto::and_<G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>></computeroutput> |
| as a transform with an expression <computeroutput>e</computeroutput>, state |
| <computeroutput>s</computeroutput> and data <computeroutput>d</computeroutput>, it is equivalent |
| to <computeroutput>(G<subscript>0</subscript>()(e, s, d),G<subscript>1</subscript>()(e, s, d),...G<subscript>n</subscript>()(e, s, d))</computeroutput>. |
| </para> |
| <para> |
| The maximun number of template arguments <computeroutput>proto::and_<></computeroutput> accepts |
| is controlled by the <computeroutput><macroname>BOOST_PROTO_MAX_LOGICAL_ARITY</macroname></computeroutput> |
| macro. |
| </para> |
| </description> |
| <struct name="impl"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="State"/> |
| <template-type-parameter name="Data"/> |
| </template> |
| <inherit><type><classname>proto::transform_impl</classname>< Expr, State, Data ></type></inherit> |
| <typedef name="result_type"> |
| <type>typename boost::result_of<G<subscript>n</subscript>(Expr, State, Data)>::type</type> |
| </typedef> |
| <method-group name="public member functions"> |
| <method name="operator()" cv="const"> |
| <type>result_type</type> |
| <parameter name="expr"> |
| <paramtype>typename impl::expr_param</paramtype> |
| <description> |
| <para>An expression </para> |
| </description> |
| </parameter> |
| <parameter name="state"> |
| <paramtype>typename impl::state_param</paramtype> |
| <description> |
| <para>The current state </para> |
| </description> |
| </parameter> |
| <parameter name="data"> |
| <paramtype>typename impl::data_param</paramtype> |
| <description> |
| <para>A data of arbitrary type </para> |
| </description> |
| </parameter> |
| <returns> |
| <para> |
| <computeroutput>(G<subscript>0</subscript>()(expr, state, data),G<subscript>1</subscript>()(expr, state, data),...G<subscript>n</subscript>()(expr, state, data))</computeroutput> |
| </para> |
| </returns> |
| </method> |
| </method-group> |
| </struct> |
| <typedef name="proto_grammar"> |
| <type>and_</type> |
| </typedef> |
| </struct> |
| |
| <!-- proto::switch_ --> |
| <struct name="switch_"> |
| <template> |
| <template-type-parameter name="Cases"/> |
| </template> |
| <inherit><classname>proto::transform</classname><switch_<Cases> ></inherit> |
| <purpose>For matching one of a set of alternate grammars, which are looked up based on an |
| expression's tag type. When used as a transform, |
| <computeroutput>proto::switch_<></computeroutput> applies the transform associated |
| with the sub-grammar that matches the expression.</purpose> |
| <description> |
| <para> |
| An expression type <computeroutput>E</computeroutput> matches |
| <computeroutput>proto::switch_<C></computeroutput> if |
| <computeroutput>E</computeroutput> matches |
| <computeroutput>C::case_<E::proto_tag></computeroutput>. |
| </para> |
| <para> |
| When applying <computeroutput>proto::switch_<C></computeroutput> as a transform |
| with an expression <computeroutput>e</computeroutput> of type |
| <computeroutput>E</computeroutput>, state <computeroutput>s</computeroutput> and |
| data <computeroutput>d</computeroutput>, it is equivalent to |
| <computeroutput>C::case_<E::proto_tag>()(e, s, d)</computeroutput>. |
| </para> |
| </description> |
| <struct name="impl"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="State"/> |
| <template-type-parameter name="Data"/> |
| </template> |
| <inherit><type> |
| Cases::template case_<typename Expr::tag_type>::template impl<Expr, State, Data></type></inherit> |
| </struct> |
| <typedef name="proto_grammar"> |
| <type>switch_</type> |
| </typedef> |
| </struct> |
| |
| <!-- proto::exact --> |
| <struct name="exact"> |
| <template> |
| <template-type-parameter name="T"/> |
| </template> |
| <purpose>For forcing exact matches of terminal types.</purpose> |
| <description> |
| <para>By default, matching terminals ignores references and cv-qualifiers. For instance, |
| a terminal expression of type |
| <computeroutput><classname>proto::terminal</classname><int const &>::type</computeroutput> |
| will match the grammar <computeroutput><classname>proto::terminal</classname><int></computeroutput>. |
| If that is not desired, you can force an exact match with |
| <computeroutput><classname>proto::terminal</classname><proto::exact<int> ></computeroutput>. |
| This will only match integer terminals where the terminal is held by value.</para> |
| </description> |
| </struct> |
| |
| <!-- proto::convertible_to --> |
| <struct name="convertible_to"> |
| <template> |
| <template-type-parameter name="T"/> |
| </template> |
| <purpose>For matching terminals that are convertible to a type.</purpose> |
| <description> |
| <para> |
| Use <computeroutput>proto::convertible_to<></computeroutput> to match a terminal that is |
| convertible to some type. For example, the grammar |
| <computeroutput><classname>proto::terminal</classname><proto::convertible_to<int> ></computeroutput> |
| will match any terminal whose argument is convertible to an integer. |
| </para> |
| </description> |
| </struct> |
| |
| <!-- proto::vararg --> |
| <struct name="vararg"> |
| <template> |
| <template-type-parameter name="Grammar"/> |
| </template> |
| <purpose>For matching a Grammar to a variable number of sub-expressions.</purpose> |
| <description> |
| <para> |
| An expression type <computeroutput><classname>proto::basic_expr</classname><AT, |
| <classname alt="proto::listN">proto::list<replaceable>N</replaceable></classname><A<subscript>0</subscript>,...A<subscript>n</subscript>,U<subscript>0</subscript>,...U<subscript>m</subscript>> ></computeroutput> |
| matches a grammar <computeroutput><classname>proto::basic_expr</classname><BT, |
| <classname alt="proto::listN">proto::list<replaceable>M</replaceable></classname><B<subscript>0</subscript>,...B<subscript>n</subscript>,proto::vararg<V> > ></computeroutput> |
| if <computeroutput>BT</computeroutput> is <computeroutput><classname>proto::_</classname></computeroutput> |
| or <computeroutput>AT</computeroutput>, and if |
| <computeroutput>A<subscript>x</subscript></computeroutput> matches |
| <computeroutput>B<subscript>x</subscript></computeroutput> |
| for each <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput> |
| and if <computeroutput>U<subscript>x</subscript></computeroutput> matches |
| <computeroutput>V</computeroutput> for each <computeroutput>x</computeroutput> in <computeroutput>[0,m]</computeroutput>. |
| </para> |
| <para>For example:</para> |
| <para> |
| <programlisting>// Match any function call expression, regardless |
| // of the number of function arguments: |
| struct Function : |
| <classname>proto::function</classname>< proto::vararg<proto::_> > |
| {};</programlisting> |
| </para> |
| <para> |
| When used as a transform, <computeroutput>proto::vararg<G></computeroutput> |
| applies <computeroutput>G</computeroutput>'s transform. |
| </para> |
| </description> |
| </struct> |
| |
| <!-- proto::matches --> |
| <struct name="matches"> |
| <template> |
| <template-type-parameter name="Expr"/> |
| <template-type-parameter name="Grammar"/> |
| </template> |
| <purpose>A Boolean metafunction that evaluates whether a given expression type matches a grammar.</purpose> |
| <description> |
| <para> |
| <computeroutput>proto::matches<Expr, Grammar></computeroutput> inherits from |
| <computeroutput>mpl::true_</computeroutput> if |
| <computeroutput>Expr::proto_grammar</computeroutput> matches |
| <computeroutput>Grammar::proto_grammar</computeroutput>, and from |
| <computeroutput>mpl::false_</computeroutput> otherwise. |
| </para> |
| <para> |
| Non-terminal expressions are matched against a grammar according to the following rules: |
| <itemizedlist> |
| <listitem> |
| <para> |
| The wildcard pattern, <computeroutput> |
| <classname>proto::_</classname> |
| </computeroutput>, matches any expression. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression |
| <computeroutput> |
| <classname>proto::basic_expr</classname><AT, |
| <classname alt="proto::listN"> |
| proto::list<replaceable>N</replaceable> |
| </classname><A<subscript>0</subscript>,...A<subscript>n</subscript>> |
| > |
| </computeroutput> |
| matches a grammar |
| <computeroutput> |
| <classname>proto::basic_expr</classname><BT, |
| <classname alt="proto::listN"> |
| proto::list<replaceable>N</replaceable> |
| </classname><B<subscript>0</subscript>,...B<subscript>n</subscript>> |
| > |
| </computeroutput> if |
| <computeroutput>BT</computeroutput> is <computeroutput> |
| <classname>proto::_</classname> |
| </computeroutput> or |
| <computeroutput>AT</computeroutput>, and if <computeroutput> |
| A<subscript>x</subscript> |
| </computeroutput> matches |
| <computeroutput> |
| B<subscript>x</subscript> |
| </computeroutput> for each <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression |
| <computeroutput> |
| <classname>proto::basic_expr</classname><AT, |
| <classname alt="proto::listN"> |
| proto::list<replaceable>N</replaceable> |
| </classname><A<subscript>0</subscript>,...A<subscript>n</subscript>,U<subscript>0</subscript>,...U<subscript>m</subscript>> |
| > |
| </computeroutput> matches a grammar |
| <computeroutput> |
| <classname>proto::basic_expr</classname><BT, |
| <classname alt="proto::listN"> |
| proto::list<replaceable>M</replaceable> |
| </classname><B<subscript>0</subscript>,...B<subscript>n</subscript>,<classname>proto::vararg</classname><V> |
| > > |
| </computeroutput> if |
| <computeroutput>BT</computeroutput> is <computeroutput> |
| <classname>proto::_</classname> |
| </computeroutput> or |
| <computeroutput>AT</computeroutput>, and if |
| <computeroutput> |
| A<subscript>x</subscript> |
| </computeroutput> matches |
| <computeroutput> |
| B<subscript>x</subscript> |
| </computeroutput> for each |
| <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput> and if |
| <computeroutput> |
| U<subscript>x</subscript> |
| </computeroutput> matches |
| <computeroutput>V</computeroutput> for each <computeroutput>x</computeroutput> in |
| <computeroutput>[0,m]</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression <computeroutput>E</computeroutput> matches |
| <computeroutput> |
| <classname>proto::or_</classname><B<subscript>0</subscript>,...B<subscript>n</subscript>> |
| </computeroutput> if |
| <computeroutput>E</computeroutput> matches some |
| <computeroutput> |
| B<subscript>x</subscript> |
| </computeroutput> for |
| <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression <computeroutput>E</computeroutput> matches |
| <computeroutput> |
| <classname>proto::and_</classname><B<subscript>0</subscript>,...B<subscript>n</subscript>> |
| </computeroutput> if |
| <computeroutput>E</computeroutput> matches all |
| <computeroutput> |
| B<subscript>x</subscript> |
| </computeroutput> for |
| <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression <computeroutput>E</computeroutput> matches |
| <computeroutput> |
| <classname>proto::if_</classname><T,U,V> |
| </computeroutput> if: |
| <itemizedlist> |
| <listitem> |
| <computeroutput> |
| boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>,T>(E)>::type::value |
| </computeroutput> |
| is <computeroutput>true</computeroutput> and |
| <computeroutput>E</computeroutput> matches |
| <computeroutput>U</computeroutput>, <emphasis>or</emphasis> |
| </listitem> |
| <listitem> |
| <computeroutput> |
| boost::result_of<<classname>proto::when</classname><<classname>proto::_</classname>,T>(E)>::type::value |
| </computeroutput> |
| is <computeroutput>false</computeroutput> and <computeroutput>E</computeroutput> matches |
| <computeroutput>V</computeroutput>. |
| </listitem> |
| </itemizedlist> |
| Note: <computeroutput>U</computeroutput> defaults to <computeroutput> |
| <classname>proto::_</classname> |
| </computeroutput> |
| and <computeroutput>V</computeroutput> defaults to |
| <computeroutput> |
| <classname>proto::not_</classname><<classname>proto::_</classname>> |
| </computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression <computeroutput>E</computeroutput> matches |
| <computeroutput> |
| <classname>proto::not_</classname><T> |
| </computeroutput> if |
| <computeroutput>E</computeroutput> does <emphasis>not</emphasis> match <computeroutput>T</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| An expression <computeroutput>E</computeroutput> matches |
| <computeroutput> |
| <classname>proto::switch_</classname><C> |
| </computeroutput> if |
| <computeroutput>E</computeroutput> matches <computeroutput>C::case_<E::proto_tag></computeroutput>. |
| </para> |
| </listitem> |
| </itemizedlist> |
| </para> |
| <para> |
| A terminal expression |
| <computeroutput> |
| <classname>proto::basic_expr</classname><AT, |
| <classname>proto::term</classname><A> > |
| </computeroutput> matches a grammar |
| <computeroutput> |
| <classname>proto::basic_expr</classname><BT, <classname>proto::term</classname><B> > |
| </computeroutput> |
| if <computeroutput>BT</computeroutput> is <computeroutput><classname>proto::_</classname></computeroutput> |
| or <computeroutput>AT</computeroutput> and one of the following is true: |
| <itemizedlist> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> is the wildcard pattern, |
| <computeroutput> |
| <classname>proto::_</classname> |
| </computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>A</computeroutput> is <computeroutput>B</computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>A</computeroutput> is <computeroutput>B &</computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>A</computeroutput> is <computeroutput>B const &</computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> is <computeroutput> |
| <classname>proto::exact</classname><A> |
| </computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> is |
| <computeroutput> |
| <classname>proto::convertible_to</classname><X> |
| </computeroutput> |
| and <computeroutput>boost::is_convertible<A,X>::value</computeroutput> is |
| <computeroutput>true</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>A</computeroutput> is <computeroutput>X[M]</computeroutput> or |
| <computeroutput>X(&)[M]</computeroutput> and |
| <computeroutput>B</computeroutput> is <computeroutput> |
| X[<globalname>proto::N</globalname>] |
| </computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>A</computeroutput> is <computeroutput>X(&)[M]</computeroutput> |
| and <computeroutput>B</computeroutput> is <computeroutput> |
| X(&)[<globalname>proto::N</globalname>] |
| </computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>A</computeroutput> is <computeroutput>X[M]</computeroutput> or |
| <computeroutput>X(&)[M]</computeroutput> and <computeroutput>B</computeroutput> is |
| <computeroutput>X*</computeroutput>. |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> <replaceable>lambda-matches</replaceable> |
| <computeroutput>A</computeroutput> (see below). |
| </para> |
| </listitem> |
| </itemizedlist> |
| </para> |
| <para> |
| A type <computeroutput>B</computeroutput> <replaceable>lambda-matches</replaceable> |
| <computeroutput>A</computeroutput> if one of the following is true: |
| <itemizedlist> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> is <computeroutput>A</computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> is the wildcard pattern, <computeroutput> |
| <classname>proto::_</classname> |
| </computeroutput> |
| </para> |
| </listitem> |
| <listitem> |
| <para> |
| <computeroutput>B</computeroutput> is <computeroutput> |
| T<B<subscript>0</subscript>,...B<subscript>n</subscript>> |
| </computeroutput> and <computeroutput>A</computeroutput> is <computeroutput> |
| T<A<subscript>0</subscript>,...A<subscript>n</subscript>> |
| </computeroutput> and for each <computeroutput>x</computeroutput> in <computeroutput>[0,n]</computeroutput>, |
| <computeroutput>A<subscript>x</subscript></computeroutput> and |
| <computeroutput>B<subscript>x</subscript></computeroutput> are types such that |
| <computeroutput>A<subscript>x</subscript></computeroutput> <replaceable>lambda-matches</replaceable> |
| <computeroutput>B<subscript>x</subscript></computeroutput> |
| </para> |
| </listitem> |
| </itemizedlist> |
| </para> |
| </description> |
| <inherit> |
| <type>mpl::bool_<<replaceable>true-or-false</replaceable>></type></inherit> |
| </struct> |
| </namespace> |
| </namespace> |
| </header> |