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.

217 lines
7.1 KiB

  1. //----------------------------------------------------------------------------
  2. // Flexcpp.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. //
  40. // History: 10-Oct-97 emilyb ported from Monarch SQL code
  41. //
  42. //----------------------------------------------------------------------------
  43. #ifndef __FLEX_LEXER_H
  44. // Never included before - need to define base class.
  45. #define __FLEX_LEXER_H
  46. #ifndef YY_CHAR
  47. #define YY_CHAR WCHAR
  48. #endif
  49. DECLARE_DEBUG(yacc)
  50. #if CIDBG
  51. #define yaccDebugOut(x) yaccInlineDebugOut x
  52. #define yaccAssert(x) Win4Assert x
  53. #define yaccDebugStr(x) yaccInlineDebugOut x
  54. #else // CIDBG
  55. #define yaccDebugStr(x)
  56. #define yaccDebugOut(x)
  57. #define yaccAssert(x)
  58. #endif // CIDBG
  59. // extern "C++" {
  60. struct yy_buffer_state;
  61. typedef int yy_state_type;
  62. class FlexLexer {
  63. public:
  64. // virtual ~FlexLexer() = 0;
  65. const YY_CHAR* YYText() { return yytext; }
  66. int YYLeng() { return yyleng; }
  67. virtual void
  68. yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
  69. virtual struct yy_buffer_state*
  70. yy_create_buffer( int size ) = 0;
  71. virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
  72. virtual void yyrestart( ) = 0;
  73. virtual int yylex(YYSTYPE *yylval) = 0;
  74. int lineno() const { return yylineno; }
  75. int debug() const { return yy_flex_debug; }
  76. void set_debug( int flag ) { yy_flex_debug = flag; }
  77. protected:
  78. YY_CHAR* yytext;
  79. int yyleng;
  80. int yylineno; // only maintained if you use %option yylineno
  81. int yy_flex_debug; // only has effect with -d or "%option debug"
  82. };
  83. // }
  84. #endif
  85. #if defined(YYLEXER) || ! defined(yyFlexLexerOnce)
  86. // Either this is the first time through (yyFlexLexerOnce not defined),
  87. // or this is a repeated include to define a different flavor of
  88. // YYLEXER, as discussed in the flex man page.
  89. #define yyFlexLexerOnce
  90. class YYPARSER; // forward declaration
  91. class YYLEXER : public FlexLexer {
  92. public:
  93. // arg_yyin and arg_yyout default to the cin and cout, but we
  94. // only make that assignment when initializing in yylex().
  95. YYLEXER();
  96. virtual ~YYLEXER();
  97. void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
  98. struct yy_buffer_state* yy_create_buffer( int size );
  99. void yy_delete_buffer( struct yy_buffer_state* b );
  100. void yyrestart( );
  101. int yylex(YYSTYPE *yylval);
  102. void yyprimebuffer(const YY_CHAR *pszBuffer);
  103. int yybufferinput(YY_CHAR *pszBuffer, int cMax);
  104. CCountedDynArray<WCHAR> _allocations;
  105. protected:
  106. virtual int LexerInput( YY_CHAR* buf, int max_size );
  107. virtual void LexerOutput( const YY_CHAR* buf, int size );
  108. virtual void LexerError( const YY_CHAR* msg );
  109. #ifdef DEBUG
  110. virtual void LexerTrace(const YY_CHAR* buf, int size, int tknNum);
  111. #endif
  112. void yyunput( int c, YY_CHAR* buf_ptr );
  113. int yyinput();
  114. void ResetLexer();
  115. short CreateTknValue(YYSTYPE *ppStg, short tknNum, BOOL fLong, BOOL fQuote);
  116. short DetermineTokenType();
  117. BOOL IsTokenEmpty();
  118. BOOL IsNotOperator();
  119. void yy_load_buffer_state();
  120. void yy_init_buffer( struct yy_buffer_state* b );
  121. void yy_flush_buffer( struct yy_buffer_state* b );
  122. int yy_start_stack_ptr;
  123. int yy_start_stack_depth;
  124. int* yy_start_stack;
  125. void yy_push_state( int new_state );
  126. void yy_pop_state();
  127. int yy_top_state();
  128. yy_state_type yy_get_previous_state();
  129. yy_state_type yy_try_NUL_trans( yy_state_type current_state );
  130. int yy_get_next_buffer();
  131. //istream* yyin; // input source for default LexerInput
  132. //ostream* yyout; // output sink for default LexerOutput
  133. struct yy_buffer_state* yy_current_buffer;
  134. // yy_hold_char holds the character lost when yytext is formed.
  135. YY_CHAR yy_hold_char;
  136. // Number of characters read into yy_ch_buf.
  137. int yy_n_chars;
  138. // Points to current character in buffer.
  139. YY_CHAR* yy_c_buf_p;
  140. YY_CHAR *pCurBuffer, *pszInputBuffer;
  141. int cInputBuffer;
  142. int yy_init; // whether we need to initialize
  143. int yy_start; // start state number
  144. int yyprimetoken; // priming token
  145. // Flag which is used to allow yywrap()'s to do buffer switches
  146. // instead of setting up a fresh yyin. A bit of a hack ...
  147. int yy_did_buffer_switch_on_eof;
  148. // The following are not always needed, but may be depending
  149. // on use of certain flex features (like REJECT or yymore()).
  150. yy_state_type yy_last_accepting_state;
  151. YY_CHAR* yy_last_accepting_cpos;
  152. yy_state_type* yy_state_buf;
  153. yy_state_type* yy_state_ptr;
  154. YY_CHAR* yy_full_match;
  155. int* yy_full_state;
  156. int yy_full_lp;
  157. int yy_lp;
  158. int yy_looking_for_trail_begin;
  159. int yy_more_flag;
  160. int yy_more_len;
  161. int yy_more_offset;
  162. int yy_prev_more_offset;
  163. BOOL fContinueImplicitPhrase;
  164. BOOL fContinueRegex;
  165. BOOL fContinueMaybeRegex;
  166. BOOL fTreatFreetextAsPhrase;
  167. #ifdef DEBUG
  168. int tkndebug;
  169. #endif
  170. };
  171. #endif