Chris@16: /*============================================================================= Chris@16: Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) Chris@16: http://spirit.sourceforge.net/ Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: =============================================================================*/ Chris@16: #ifndef BOOST_SPIRIT_ACTOR_HPP Chris@16: #define BOOST_SPIRIT_ACTOR_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // Actors documentation and convention Chris@16: // Chris@16: // Actors Chris@16: // Chris@16: // Actors are predefined semantic action functors. They are used to do an Chris@16: // action on the parse result if the parser has had a successful match. An Chris@16: // example of actor is the append_actor described in the Spirit Chris@16: // documentation. Chris@16: // Chris@16: // The action takes place through a call to the () operator: single argument Chris@16: // () operator call for character parsers and two argument (first,last) call Chris@16: // for phrase parsers. Actors should implement at least one of the two () Chris@16: // operator. Chris@16: // Chris@16: // Actor instances are not created direcly since they usually involve a Chris@16: // number of template parameters. Instead generator functions ("helper Chris@16: // functions") are provided to generate actors according to their arguments. Chris@16: // All helper functions have the "_a" suffix. For example, append_actor is Chris@16: // created using the append_a function. Chris@16: // Chris@16: // Policy holder actors and policy actions Chris@16: // Chris@16: // A lot of actors need to store reference to one or more objects. For Chris@16: // example, actions on container need to store a reference to the container. Chris@16: // Therefore, this kind of actor have been broken down into Chris@16: // Chris@16: // - a action policy that does the action (act method), Chris@16: // - a policy holder actor that stores the references and feeds the act Chris@16: // method. Chris@16: // Chris@16: // Policy holder actors Chris@16: // Chris@16: // Policy holder have the following naming convention: Chris@16: // _ >> * >> !value >> actor Chris@16: // where member are the policy stored member, they can be of type: Chris@16: // Chris@16: // - ref, a reference, Chris@16: // - const_ref, a const reference, Chris@16: // - value, by value, Chris@16: // - empty, no stored members Chris@16: // - !value states if the policy uses the parse result or not. Chris@16: // Chris@16: // The available policy holder are enumerated below: Chris@16: // Chris@16: // - empty_actor, nothing stored, feeds parse result Chris@16: // - value_actor, 1 object stored by value, feeds value Chris@16: // - ref_actor, 1 reference stored, feeds ref Chris@16: // - ref_value_actor, 1 reference stored, feeds ref and parse result Chris@16: // Chris@16: // Doc. convention Chris@16: // Chris@16: // - ref is a reference to an object stored in a policy holder actor, Chris@16: // - value_ref,value1_ref, value2_ref are a const reference stored in a Chris@16: // policy holder actor, Chris@16: // - value is the parse result in the single argument () operator, Chris@16: // - first,last are the parse result in the two argument () operator Chris@16: // Chris@16: // Actors (generator functions) and quick description Chris@16: // Chris@16: // - assign_a(ref) assign parse result to ref Chris@16: // - assign_a(ref, value_ref) assign value_ref to ref Chris@16: // - increment_a(ref) increment ref Chris@16: // - decrement_a(ref) decrement ref Chris@16: // - push_back_a(ref) push back the parse result in ref Chris@16: // - push_back_a(ref, value_ref) push back value_ref in ref Chris@16: // - push_front_a(ref) push front the parse result in ref Chris@16: // - push_front_a(ref, value_ref) push front value_ref in ref Chris@16: // - insert_key_a(ref,value_ref) insert value_ref in ref using the Chris@16: // parse result as key Chris@16: // - insert_at_a(ref, key_ref) insert the parse result in ref at key_ref Chris@16: // - insert_at_a(ref, key_ref insert value_ref in ref at key_ref Chris@16: // , value_ref) Chris@16: // - assign_key_a(ref, value_ref) assign value_ref in ref using the Chris@16: // parse result as key Chris@16: // - erase_a(ref, key) erase data at key from ref Chris@16: // - clear_a(ref) clears ref Chris@16: // - swap_a(aref, bref) swaps aref and bref Chris@16: // Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #endif