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