Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
6.1 KiB

  1. // $Header: /Monarch/src/msidxtr/flexcpp.h 10 8/01/97 2:17p A-charca $
  2. // FlexLexer.h -- define interfaces for lexical analyzer classes generated
  3. // by flex
  4. // Copyright (c) 1993 The Regents of the University of California.
  5. // All rights reserved.
  6. //
  7. // This code is derived from software contributed to Berkeley by
  8. // Kent Williams and Tom Epperly.
  9. //
  10. // Redistribution and use in source and binary forms are permitted provided
  11. // that: (1) source distributions retain this entire copyright notice and
  12. // comment, and (2) distributions including binaries display the following
  13. // acknowledgement: ``This product includes software developed by the
  14. // University of California, Berkeley and its contributors'' in the
  15. // documentation or other materials provided with the distribution and in
  16. // all advertising materials mentioning features or use of this software.
  17. // Neither the name of the University nor the names of its contributors may
  18. // be used to endorse or promote products derived from this software without
  19. // specific prior written permission.
  20. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  21. // WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  22. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  23. // This file defines FlexLexer, an abstract class which specifies the
  24. // external interface provided to flex C++ lexer objects, and YYLEXER,
  25. // which defines a particular lexer class.
  26. //
  27. // If you want to create multiple lexer classes, you use the -P flag
  28. // to rename each YYLEXER to some other xxFlexLexer. You then
  29. // include <FlexLexer.h> in your other sources once per lexer class:
  30. //
  31. // #undef YYLEXER
  32. // #define YYLEXER xxFlexLexer
  33. // #include <FlexLexer.h>
  34. //
  35. // #undef YYLEXER
  36. // #define YYLEXER zzFlexLexer
  37. // #include <FlexLexer.h>
  38. // ...
  39. #ifndef __FLEX_LEXER_H
  40. // Never included before - need to define base class.
  41. #define __FLEX_LEXER_H
  42. #ifndef YY_CHAR
  43. #define YY_CHAR TCHAR
  44. #endif
  45. #ifdef UNICODE
  46. # define strdup _wcsdup
  47. # define strlen wcslen
  48. # define atol _wtol
  49. inline double strtof(wchar_t *s) { char tmp[255]; wcstombs(tmp, s, 255); return atof(tmp); }
  50. #else
  51. # define strdup _strdup
  52. # define strlen strlen
  53. # define atol atol
  54. # define strtof atof
  55. #endif
  56. // extern "C++" {
  57. struct yy_buffer_state;
  58. typedef int yy_state_type;
  59. class FlexLexer {
  60. public:
  61. // virtual ~FlexLexer() = 0;
  62. const YY_CHAR* YYText() { return yytext; }
  63. int YYLeng() { return yyleng; }
  64. virtual void
  65. yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
  66. virtual struct yy_buffer_state*
  67. yy_create_buffer( int size ) = 0;
  68. virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
  69. virtual void yyrestart( ) = 0;
  70. virtual int yylex(YYSTYPE *yylval) = 0;
  71. int lineno() const { return yylineno; }
  72. int debug() const { return yy_flex_debug; }
  73. void set_debug( int flag ) { yy_flex_debug = flag; }
  74. protected:
  75. YY_CHAR* yytext;
  76. int yyleng;
  77. int yylineno; // only maintained if you use %option yylineno
  78. int yy_flex_debug; // only has effect with -d or "%option debug"
  79. };
  80. // }
  81. #endif
  82. #if defined(YYLEXER) || ! defined(yyFlexLexerOnce)
  83. // Either this is the first time through (yyFlexLexerOnce not defined),
  84. // or this is a repeated include to define a different flavor of
  85. // YYLEXER, as discussed in the flex man page.
  86. #define yyFlexLexerOnce
  87. class YYPARSER; // forward declaration
  88. class YYLEXER : public FlexLexer {
  89. public:
  90. YYLEXER();
  91. virtual ~YYLEXER();
  92. void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
  93. struct yy_buffer_state* yy_create_buffer( int size );
  94. void yy_delete_buffer( struct yy_buffer_state* b );
  95. void yyrestart( );
  96. int yylex(YYSTYPE *yylval);
  97. void yyprimebuffer(YY_CHAR *pszBuffer);
  98. int yybufferinput(YY_CHAR *pszBuffer, int cMax);
  99. void yyprimelexer(int eToken);
  100. protected:
  101. virtual int LexerInput( YY_CHAR* buf, int max_size );
  102. virtual void LexerOutput( const YY_CHAR* buf, int size );
  103. virtual void LexerError( const YY_CHAR* msg );
  104. #ifdef DEBUG
  105. virtual void LexerTrace(const YY_CHAR* buf, int size, int tknNum);
  106. #endif
  107. void yyunput( int c, YY_CHAR* buf_ptr );
  108. int yyinput();
  109. void ResetLexer();
  110. void CreateTknValue(YYSTYPE *ppqt, short tknNum, YY_CHAR wch = L'\0', BOOL fQuote = FALSE);
  111. void yy_load_buffer_state();
  112. void yy_init_buffer( struct yy_buffer_state* b );
  113. void yy_flush_buffer( struct yy_buffer_state* b );
  114. int yy_start_stack_ptr;
  115. int yy_start_stack_depth;
  116. int* yy_start_stack;
  117. void yy_push_state( int new_state );
  118. void yy_pop_state();
  119. int yy_top_state();
  120. yy_state_type yy_get_previous_state();
  121. yy_state_type yy_try_NUL_trans( yy_state_type current_state );
  122. int yy_get_next_buffer();
  123. struct yy_buffer_state* yy_current_buffer;
  124. // yy_hold_char holds the character lost when yytext is formed.
  125. YY_CHAR yy_hold_char;
  126. // Number of characters read into yy_ch_buf.
  127. int yy_n_chars;
  128. // Points to current character in buffer.
  129. YY_CHAR* yy_c_buf_p;
  130. YY_CHAR *pCurBuffer, *pszInputBuffer;
  131. int cInputBuffer;
  132. int yy_init; // whether we need to initialize
  133. int yy_start; // start state number
  134. int yyprimetoken; // priming token
  135. // Flag which is used to allow yywrap()'s to do buffer switches
  136. // instead of setting up a fresh yyin. A bit of a hack ...
  137. int yy_did_buffer_switch_on_eof;
  138. // The following are not always needed, but may be depending
  139. // on use of certain flex features (like REJECT or yymore()).
  140. yy_state_type yy_last_accepting_state;
  141. YY_CHAR* yy_last_accepting_cpos;
  142. yy_state_type* yy_state_buf;
  143. yy_state_type* yy_state_ptr;
  144. YY_CHAR* yy_full_match;
  145. int* yy_full_state;
  146. int yy_full_lp;
  147. int yy_lp;
  148. int yy_looking_for_trail_begin;
  149. int yy_more_flag;
  150. int yy_more_len;
  151. int yy_more_offset;
  152. int yy_prev_more_offset;
  153. #ifdef DEBUG
  154. int tkndebug;
  155. #endif
  156. };
  157. #endif