]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // internals.hpp |
2 | // Copyright (c) 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_INTERNALS_HPP | |
7 | #define BOOST_LEXER_INTERNALS_HPP | |
8 | ||
9 | #include "containers/ptr_vector.hpp" | |
10 | ||
11 | namespace boost | |
12 | { | |
13 | namespace lexer | |
14 | { | |
15 | namespace detail | |
16 | { | |
17 | struct internals | |
18 | { | |
19 | typedef std::vector<std::size_t> size_t_vector; | |
20 | typedef ptr_vector<size_t_vector> size_t_vector_vector; | |
21 | ||
22 | size_t_vector_vector _lookup; | |
23 | size_t_vector _dfa_alphabet; | |
24 | size_t_vector_vector _dfa; | |
25 | bool _seen_BOL_assertion; | |
26 | bool _seen_EOL_assertion; | |
27 | ||
28 | internals () : | |
29 | _seen_BOL_assertion (false), | |
30 | _seen_EOL_assertion (false) | |
31 | { | |
32 | } | |
33 | ||
34 | void clear () | |
35 | { | |
36 | _lookup.clear (); | |
37 | _dfa_alphabet.clear (); | |
38 | _dfa.clear (); | |
39 | _seen_BOL_assertion = false; | |
40 | _seen_EOL_assertion = false; | |
41 | } | |
42 | ||
43 | void swap (internals &internals_) | |
44 | { | |
45 | _lookup->swap (*internals_._lookup); | |
46 | _dfa_alphabet.swap (internals_._dfa_alphabet); | |
47 | _dfa->swap (*internals_._dfa); | |
48 | std::swap (_seen_BOL_assertion, internals_._seen_BOL_assertion); | |
49 | std::swap (_seen_EOL_assertion, internals_._seen_EOL_assertion); | |
50 | } | |
51 | ||
52 | private: | |
53 | internals (const internals &); // No copy construction. | |
54 | internals &operator = (const internals &); // No assignment. | |
55 | }; | |
56 | } | |
57 | } | |
58 | } | |
59 | ||
60 | #endif |