source: NonGTP/Boost/boost/spirit/actor.hpp @ 857

Revision 857, 5.1 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
3    http://spirit.sourceforge.net/
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8=============================================================================*/
9#ifndef BOOST_SPIRIT_ACTOR_HPP
10#define BOOST_SPIRIT_ACTOR_HPP
11
12#include <boost/spirit/version.hpp>
13
14///////////////////////////////////////////////////////////////////////////////
15//
16//  Actors documentation and convention
17//
18//  Actors
19//
20//  Actors are predefined semantic action functors. They are used to do an
21//  action on the parse result if the parser has had a successful match. An
22//  example of actor is the append_actor described in the Spirit
23//  documentation.
24//
25//  The action takes place through a call to the () operator: single argument
26//  () operator call for character parsers and two argument (first,last) call
27//  for phrase parsers. Actors should implement at least one of the two ()
28//  operator.
29//
30//  Actor instances are not created direcly since they usually involve a
31//  number of template parameters. Instead generator functions ("helper
32//  functions") are provided to generate actors according to their arguments.
33//  All helper functions have the "_a" suffix. For example, append_actor is
34//  created using the append_a function.
35//
36//  Policy holder actors and policy actions
37//
38//  A lot of actors need to store reference to one or more objects. For
39//  example, actions on container need to store a reference to the container.
40//  Therefore, this kind of actor have been broken down into
41//
42//      - a action policy that does the action (act method),
43//      - a policy holder actor that stores the references and feeds the act
44//        method.
45//
46//  Policy holder actors
47//
48//      Policy holder have the following naming convention:
49//          <member>_ >> *<member> >> !value >> actor
50//      where member are the policy stored member, they can be of type:
51//
52//       - ref, a reference,
53//       - const_ref, a const reference,
54//       - value, by value,
55//       - empty, no stored members
56//       - !value states if the policy uses the parse result or not.
57//
58//  The available policy holder are enumerated below:
59//
60//      - empty_actor, nothing stored, feeds parse result
61//      - value_actor, 1 object stored by value, feeds value
62//      - ref_actor, 1 reference stored, feeds ref
63//      - ref_value_actor, 1 reference stored, feeds ref and parse result
64//
65//  Doc. convention
66//
67//      - ref is a reference to an object stored in a policy holder actor,
68//      - value_ref,value1_ref, value2_ref are a const reference stored in a
69//          policy holder actor,
70//      - value is the parse result in the single argument () operator,
71//      - first,last are the parse result in the two argument () operator
72//
73//  Actors (generator functions) and quick description
74//
75//      - assign_a(ref)                 assign parse result to ref
76//      - assign_a(ref, value_ref)      assign value_ref to ref
77//      - increment_a(ref)              increment ref
78//      - decrement_a(ref)              decrement ref
79//      - push_back_a(ref)              push back the parse result in ref
80//      - push_back_a(ref, value_ref)   push back value_ref in ref
81//      - push_front_a(ref)             push front the parse result in ref
82//      - push_front_a(ref, value_ref)  push front value_ref in ref
83//      - insert_key_a(ref,value_ref)   insert value_ref in ref using the
84//                                      parse result as key
85//      - insert_at_a(ref, key_ref)     insert the parse result in ref at key_ref
86//      - insert_at_a(ref, key_ref      insert value_ref in ref at key_ref
87//          , value_ref)               
88//      - assign_key_a(ref, value_ref)  assign value_ref in ref using the
89//                                      parse result as key
90//      - erase_a(ref, key)             erase data at key from ref
91//      - clear_a(ref)                  clears ref
92//      - swap_a(aref, bref)            swaps aref and bref
93//
94///////////////////////////////////////////////////////////////////////////////
95
96#include <boost/spirit/actor/ref_actor.hpp>
97#include <boost/spirit/actor/ref_value_actor.hpp>
98#include <boost/spirit/actor/ref_const_ref_actor.hpp>
99#include <boost/spirit/actor/ref_const_ref_value_actor.hpp>
100#include <boost/spirit/actor/ref_const_ref_const_ref_a.hpp>
101
102#include <boost/spirit/actor/assign_actor.hpp>
103#include <boost/spirit/actor/clear_actor.hpp>
104#include <boost/spirit/actor/increment_actor.hpp>
105#include <boost/spirit/actor/decrement_actor.hpp>
106#include <boost/spirit/actor/push_back_actor.hpp>
107#include <boost/spirit/actor/push_front_actor.hpp>
108#include <boost/spirit/actor/erase_actor.hpp>
109#include <boost/spirit/actor/insert_key_actor.hpp>
110#include <boost/spirit/actor/insert_at_actor.hpp>
111#include <boost/spirit/actor/assign_key_actor.hpp>
112#include <boost/spirit/actor/swap_actor.hpp>
113
114#endif
Note: See TracBrowser for help on using the repository browser.