FlexLexer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef __FLEX_LEXER_H
00045
00046 #define __FLEX_LEXER_H
00047
00048 #include <iostream>
00049 using namespace std;
00050
00051 extern "C++" {
00052
00053 struct yy_buffer_state;
00054 typedef int yy_state_type;
00055
00056 class FlexLexer {
00057 public:
00058 virtual ~FlexLexer() { }
00059
00060 const char* YYText() { return yytext; }
00061 int YYLeng() { return yyleng; }
00062
00063 virtual void
00064 yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
00065 virtual struct yy_buffer_state*
00066 yy_create_buffer( istream* s, int size ) = 0;
00067 virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
00068 virtual void yyrestart( istream* s ) = 0;
00069
00070 virtual int yylex() = 0;
00071
00072
00073 int yylex( istream* new_in, ostream* new_out = 0 )
00074 {
00075 switch_streams( new_in, new_out );
00076 return yylex();
00077 }
00078
00079
00080
00081 virtual void switch_streams( istream* new_in = 0,
00082 ostream* new_out = 0 ) = 0;
00083
00084 int lineno() const { return yylineno; }
00085
00086 int debug() const { return yy_flex_debug; }
00087 void set_debug( int flag ) { yy_flex_debug = flag; }
00088
00089 protected:
00090 char* yytext;
00091 int yyleng;
00092 int yylineno;
00093 int yy_flex_debug;
00094 };
00095
00096 }
00097 #endif
00098
00099 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
00100
00101
00102
00103 #define yyFlexLexerOnce
00104
00105 class yyFlexLexer : public FlexLexer {
00106 public:
00107
00108
00109 yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
00110
00111 virtual ~yyFlexLexer();
00112
00113 void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
00114 struct yy_buffer_state* yy_create_buffer( istream* s, int size );
00115 void yy_delete_buffer( struct yy_buffer_state* b );
00116 void yyrestart( istream* s );
00117
00118 virtual int yylex();
00119 virtual void switch_streams( istream* new_in, ostream* new_out );
00120
00121 protected:
00122 virtual int LexerInput( char* buf, int max_size );
00123 virtual void LexerOutput( const char* buf, int size );
00124 virtual void LexerError( const char* msg );
00125
00126 void yyunput( int c, char* buf_ptr );
00127 int yyinput();
00128
00129 void yy_load_buffer_state();
00130 void yy_init_buffer( struct yy_buffer_state* b, istream* s );
00131 void yy_flush_buffer( struct yy_buffer_state* b );
00132
00133 int yy_start_stack_ptr;
00134 int yy_start_stack_depth;
00135 int* yy_start_stack;
00136
00137 void yy_push_state( int new_state );
00138 void yy_pop_state();
00139 int yy_top_state();
00140
00141 yy_state_type yy_get_previous_state();
00142 yy_state_type yy_try_NUL_trans( yy_state_type current_state );
00143 int yy_get_next_buffer();
00144
00145 istream* yyin;
00146 ostream* yyout;
00147
00148 struct yy_buffer_state* yy_current_buffer;
00149
00150
00151 char yy_hold_char;
00152
00153
00154 int yy_n_chars;
00155
00156
00157 char* yy_c_buf_p;
00158
00159 int yy_init;
00160 int yy_start;
00161
00162
00163
00164 int yy_did_buffer_switch_on_eof;
00165
00166
00167
00168
00169 yy_state_type yy_last_accepting_state;
00170 char* yy_last_accepting_cpos;
00171
00172 yy_state_type* yy_state_buf;
00173 yy_state_type* yy_state_ptr;
00174
00175 char* yy_full_match;
00176 int* yy_full_state;
00177 int yy_full_lp;
00178
00179 int yy_lp;
00180 int yy_looking_for_trail_begin;
00181
00182 int yy_more_flag;
00183 int yy_more_len;
00184 int yy_more_offset;
00185 int yy_prev_more_offset;
00186 };
00187
00188 #endif