consts.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // consts.h
  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_CONSTS_H
  7. #define BOOST_LEXER_CONSTS_H
  8. #include <boost/config.hpp>
  9. #include <boost/integer_traits.hpp>
  10. #include "size_t.hpp"
  11. namespace boost
  12. {
  13. namespace lexer
  14. {
  15. enum regex_flags {none = 0, icase = 1, dot_not_newline = 2};
  16. // 0 = end state, 1 = id, 2 = unique_id, 3 = lex state, 4 = bol, 5 = eol,
  17. // 6 = dead_state_index
  18. enum {end_state_index, id_index, unique_id_index, state_index, bol_index,
  19. eol_index, dead_state_index, dfa_offset};
  20. const std::size_t max_macro_len = 30;
  21. const std::size_t num_chars = 256;
  22. // If sizeof(wchar_t) == sizeof(size_t) then don't overflow to 0
  23. // by adding one to comparison.
  24. const std::size_t num_wchar_ts =
  25. (boost::integer_traits<wchar_t>::const_max < 0x110000) ?
  26. boost::integer_traits<wchar_t>::const_max +
  27. static_cast<std::size_t> (1) : 0x110000;
  28. const std::size_t null_token = static_cast<std::size_t> (~0);
  29. const std::size_t bol_token = static_cast<std::size_t> (~1);
  30. const std::size_t eol_token = static_cast<std::size_t> (~2);
  31. const std::size_t end_state = 1;
  32. const std::size_t npos = static_cast<std::size_t> (~0);
  33. }
  34. }
  35. #endif