]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/include/boost/spirit/home/support/detail/lexer/conversion/char_state_machine.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / support / detail / lexer / conversion / char_state_machine.hpp
1 // char_state_machine.hpp
2 // Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BOOST_LEXER_CHAR_STATE_MACHINE_HPP
7 #define BOOST_LEXER_CHAR_STATE_MACHINE_HPP
8
9 #include "../consts.hpp"
10 #include <map>
11 #include "../size_t.hpp"
12 #include "../string_token.hpp"
13 #include <vector>
14
15 namespace boost
16 {
17 namespace lexer
18 {
19 namespace detail
20 {
21 template<typename CharT>
22 struct basic_char_state_machine
23 {
24 struct state
25 {
26 typedef basic_string_token<CharT> string_token;
27 typedef std::map<std::size_t, string_token> size_t_string_token_map;
28 typedef std::pair<std::size_t, string_token> size_t_string_token_pair;
29
30 bool _end_state;
31 std::size_t _id;
32 std::size_t _unique_id;
33 std::size_t _state;
34 std::size_t _bol_index;
35 std::size_t _eol_index;
36 size_t_string_token_map _transitions;
37
38 state () :
39 _end_state (false),
40 _id (0),
41 _unique_id (npos),
42 _state (0),
43 _bol_index (npos),
44 _eol_index (npos)
45 {
46 }
47 };
48
49 typedef std::vector<state> state_vector;
50 typedef std::vector<state_vector> state_vector_vector;
51
52 state_vector_vector _sm_vector;
53
54 bool empty () const
55 {
56 return _sm_vector.empty ();
57 }
58
59 void clear ()
60 {
61 _sm_vector.clear ();
62 }
63
64 void swap (basic_char_state_machine &csm_)
65 {
66 _sm_vector.swap (csm_._sm_vector);
67 }
68 };
69
70 typedef basic_char_state_machine<char> char_state_machine;
71 typedef basic_char_state_machine<wchar_t> wchar_state_machine;
72
73 }
74 }
75 }
76
77 #endif