# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

lex.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 
00027 #ifndef NL_LEX_H
00028 #define NL_LEX_H
00029 
00030 #include <strstream>
00031 
00032 struct yy_buffer_state;
00033 
00034 typedef int yy_state_type;
00035 #define YY_SKIP_YYWRAP
00036 
00037 namespace NLAISCRIPT
00038 {
00039         
00040         
00041         class FlexLexer {
00042         public:
00043                 virtual ~FlexLexer()    { }
00044 
00045                 const char* YYText()    { return yytext; }
00046                 int YYLeng()            { return yyleng; }
00047 
00048                 virtual void
00049                         yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
00050                 virtual struct yy_buffer_state*
00051                         yy_create_buffer( istream* s, int size ) = 0;
00052                 virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
00053                 virtual void yyrestart( istream* s ) = 0;
00054 
00055                 virtual int yylex() = 0;
00056 
00057                 // Call yylex with new input/output sources.
00058                 int yylex( istream* new_in, ostream* new_out = 0 )
00059                         {
00060                         switch_streams( new_in, new_out );
00061                         return yylex();
00062                         }
00063 
00064                 // Switch to new input/output streams.  A nil stream pointer
00065                 // indicates "keep the current one".
00066                 virtual void switch_streams( istream* new_in = 0,
00067                                                 ostream* new_out = 0 ) = 0;
00068 
00069                 int lineno() const              { return yylineno; }
00070 
00071                 int debug() const               { return yy_flex_debug; }
00072                 void set_debug( int flag )      { yy_flex_debug = flag; }               
00073 
00074         protected:
00075                 char* yytext;
00076                 int yyleng;
00077                 int yylineno;           // only maintained if you use %option yylineno
00078                 int yy_flex_debug;      // only has effect with -d or "%option debug"           
00079                 
00080         };
00081 
00082 
00083         #define yyFlexLexerOnce
00084 
00085         class yyFlexLexer : public FlexLexer {
00086         public:
00087                 // arg_yyin and arg_yyout default to the cin and cout, but we
00088                 // only make that assignment when initializing in yylex().
00089                 yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
00090 
00091                 virtual ~yyFlexLexer();
00092 
00093                 void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
00094                 struct yy_buffer_state* yy_create_buffer( istream* s, int size );
00095                 void yy_delete_buffer( struct yy_buffer_state* b );
00096                 void yyrestart( istream* s );
00097 
00098                 virtual int yylex();
00099                 virtual void switch_streams( istream* new_in, ostream* new_out );
00100                 
00101 
00102         protected:
00103                 virtual int LexerInput( char* buf, int max_size );
00104                 virtual void LexerOutput( const char* buf, int size );
00105                 virtual void LexerError( const char* msg );
00106 
00107                 void yyunput( int c, char* buf_ptr );
00108                 int yyinput();
00109 
00110                 void yy_load_buffer_state();
00111                 void yy_init_buffer( struct yy_buffer_state* b, istream* s );
00112                 void yy_flush_buffer( struct yy_buffer_state* b );
00113 
00114                 int yy_start_stack_ptr;
00115                 int yy_start_stack_depth;
00116                 int* yy_start_stack;
00117 
00118                 void yy_push_state( int new_state );
00119                 void yy_pop_state();
00120                 int yy_top_state();
00121 
00122                 yy_state_type yy_get_previous_state();
00123                 yy_state_type yy_try_NUL_trans( yy_state_type current_state );
00124                 int yy_get_next_buffer();
00125 
00126                 istream* yyin;  // input source for default LexerInput
00127                 ostream* yyout; // output sink for default LexerOutput
00128 
00129                 struct yy_buffer_state* yy_current_buffer;
00130 
00131                 // yy_hold_char holds the character lost when yytext is formed.
00132                 char yy_hold_char;
00133 
00134                 // Number of characters read into yy_ch_buf.
00135                 int yy_n_chars;
00136 
00137                 // Points to current character in buffer.
00138                 char* yy_c_buf_p;
00139 
00140                 int yy_init;            // whether we need to initialize
00141                 int yy_start;           // start state number
00142 
00143                 // Flag which is used to allow yywrap()'s to do buffer switches
00144                 // instead of setting up a fresh yyin.  A bit of a hack ...
00145                 int yy_did_buffer_switch_on_eof;
00146 
00147                 // The following are not always needed, but may be depending
00148                 // on use of certain flex features (like REJECT or yymore()).
00149 
00150                 yy_state_type yy_last_accepting_state;
00151                 char* yy_last_accepting_cpos;
00152 
00153                 yy_state_type* yy_state_buf;
00154                 yy_state_type* yy_state_ptr;
00155 
00156                 char* yy_full_match;
00157                 int* yy_full_state;
00158                 int yy_full_lp;
00159 
00160                 int yy_lp;
00161                 int yy_looking_for_trail_begin;
00162 
00163                 int yy_more_flag;
00164                 int yy_more_len;
00165                 
00166 
00167                 //this is a new define type for our operation
00168                 char LastyyText[2][1024*4];
00169                 double LastyyNum;               
00170                 int yyLine,yyColone;
00171 
00172                 virtual int     yywrap() = 0;
00173 
00175                 virtual void setNewLine() = 0;
00176         };
00177 }
00178 #endif