Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:48

0001 // char_state_machine.hpp
0002 // Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 #ifndef BOOST_SPIRIT_SUPPORT_DETAIL_LEXER_CONVERSION_CHAR_STATE_MACHINE_HPP
0007 #define BOOST_SPIRIT_SUPPORT_DETAIL_LEXER_CONVERSION_CHAR_STATE_MACHINE_HPP
0008 
0009 #include "../consts.hpp"
0010 #include <map>
0011 #include "../size_t.hpp"
0012 #include "../string_token.hpp"
0013 #include <vector>
0014 
0015 namespace boost
0016 {
0017 namespace lexer
0018 {
0019 namespace detail
0020 {
0021 template<typename CharT>
0022 struct basic_char_state_machine
0023 {
0024     struct state
0025     {
0026         typedef basic_string_token<CharT> string_token;
0027         typedef std::map<std::size_t, string_token> size_t_string_token_map;
0028         typedef std::pair<std::size_t, string_token> size_t_string_token_pair;
0029 
0030         bool _end_state;
0031         std::size_t _id;
0032         std::size_t _unique_id;
0033         std::size_t _state;
0034         std::size_t _bol_index;
0035         std::size_t _eol_index;
0036         size_t_string_token_map _transitions;
0037 
0038         state () :
0039             _end_state (false),
0040             _id (0),
0041             _unique_id (npos),
0042             _state (0),
0043             _bol_index (npos),
0044             _eol_index (npos)
0045         {
0046         }
0047     };
0048 
0049     typedef std::vector<state> state_vector;
0050     typedef std::vector<state_vector> state_vector_vector;
0051 
0052     state_vector_vector _sm_vector;
0053 
0054     bool empty () const
0055     {
0056         return _sm_vector.empty ();
0057     }
0058 
0059     void clear ()
0060     {
0061         _sm_vector.clear ();
0062     }
0063 
0064     void swap (basic_char_state_machine &csm_)
0065     {
0066         _sm_vector.swap (csm_._sm_vector);
0067     }
0068 };
0069 
0070 typedef basic_char_state_machine<char> char_state_machine;
0071 typedef basic_char_state_machine<wchar_t> wchar_state_machine;
0072 
0073 }
0074 }
0075 }
0076 
0077 #endif