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