scanner.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*=============================================================================
  2. Boost.Wave: A Standard compliant C++ preprocessor library
  3. http://www.boost.org/
  4. Copyright (c) 2001 Daniel C. Nuffer.
  5. Copyright (c) 2001-2012 Hartmut Kaiser.
  6. Distributed under the Boost Software License, Version 1.0. (See accompanying
  7. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. =============================================================================*/
  9. #if !defined(SCANNER_HPP_F4FB01EB_E75C_4537_A146_D34B9895EF37_INCLUDED)
  10. #define SCANNER_HPP_F4FB01EB_E75C_4537_A146_D34B9895EF37_INCLUDED
  11. #include <boost/wave/wave_config.hpp>
  12. #include <boost/wave/cpplexer/re2clex/aq.hpp>
  13. // this must occur after all of the includes and before any code appears
  14. #ifdef BOOST_HAS_ABI_HEADERS
  15. #include BOOST_ABI_PREFIX
  16. #endif
  17. ///////////////////////////////////////////////////////////////////////////////
  18. namespace boost {
  19. namespace wave {
  20. namespace cpplexer {
  21. namespace re2clex {
  22. template<typename Iterator>
  23. struct Scanner;
  24. typedef unsigned char uchar;
  25. template<typename Iterator>
  26. struct Scanner {
  27. typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
  28. char const *, ...);
  29. Scanner(Iterator const & f, Iterator const & l)
  30. : first(f), act(f), last(l),
  31. bot(0), top(0), eof(0), tok(0), ptr(0), cur(0), lim(0),
  32. eol_offsets(aq_create())
  33. // remaining data members externally initialized
  34. {}
  35. ~Scanner()
  36. {
  37. aq_terminate(eol_offsets);
  38. }
  39. Iterator first; /* start of input buffer */
  40. Iterator act; /* act position of input buffer */
  41. Iterator last; /* end (one past last char) of input buffer */
  42. uchar* bot; /* beginning of the current buffer */
  43. uchar* top; /* top of the current buffer */
  44. uchar* eof; /* when we read in the last buffer, will point 1 past the
  45. end of the file, otherwise 0 */
  46. uchar* tok; /* points to the beginning of the current token */
  47. uchar* ptr; /* used for YYMARKER - saves backtracking info */
  48. uchar* cur; /* saves the cursor (maybe is redundant with tok?) */
  49. uchar* lim; /* used for YYLIMIT - points to the end of the buffer */
  50. /* (lim == top) except for the last buffer, it points to
  51. the end of the input (lim == eof - 1) */
  52. std::size_t line; /* current line being lex'ed */
  53. std::size_t column; /* current token start column position */
  54. std::size_t curr_column; /* current column position */
  55. ReportErrorProc error_proc; /* must be != 0, this function is called to
  56. report an error */
  57. char const *file_name; /* name of the lex'ed file */
  58. aq_queue eol_offsets;
  59. bool enable_ms_extensions; /* enable MS extensions */
  60. bool act_in_c99_mode; /* lexer works in C99 mode */
  61. bool detect_pp_numbers; /* lexer should prefer to detect pp-numbers */
  62. bool enable_import_keyword; /* recognize import as a keyword */
  63. bool single_line_only; /* don't report missing eol's in C++ comments */
  64. bool act_in_cpp0x_mode; /* lexer works in C++11 mode */
  65. };
  66. ///////////////////////////////////////////////////////////////////////////////
  67. } // namespace re2clex
  68. } // namespace cpplexer
  69. } // namespace wave
  70. } // namespace boost
  71. // the suffix header occurs after all of the code
  72. #ifdef BOOST_HAS_ABI_HEADERS
  73. #include BOOST_ABI_SUFFIX
  74. #endif
  75. #endif // !defined(SCANNER_HPP_F4FB01EB_E75C_4537_A146_D34B9895EF37_INCLUDED)