/home/enzo/treballs/fib/pfc/nanocomp/src/FlexLexer.h

Go to the documentation of this file.
00001 
00002 // -*-C++-*-
00003 // FlexLexer.h -- define interfaces for lexical analyzer classes generated
00004 // by flex
00005 
00006 // Copyright (c) 1993 The Regents of the University of California.
00007 // All rights reserved.
00008 //
00009 // This code is derived from software contributed to Berkeley by
00010 // Kent Williams and Tom Epperly.
00011 //
00012 //  Redistribution and use in source and binary forms, with or without
00013 //  modification, are permitted provided that the following conditions
00014 //  are met:
00015 
00016 //  1. Redistributions of source code must retain the above copyright
00017 //  notice, this list of conditions and the following disclaimer.
00018 //  2. Redistributions in binary form must reproduce the above copyright
00019 //  notice, this list of conditions and the following disclaimer in the
00020 //  documentation and/or other materials provided with the distribution.
00021 
00022 //  Neither the name of the University nor the names of its contributors
00023 //  may be used to endorse or promote products derived from this software
00024 //  without specific prior written permission.
00025 
00026 //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00027 //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00028 //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 //  PURPOSE.
00030 
00031 // This file defines FlexLexer, an abstract class which specifies the
00032 // external interface provided to flex C++ lexer objects, and yyFlexLexer,
00033 // which defines a particular lexer class.
00034 //
00035 // If you want to create multiple lexer classes, you use the -P flag
00036 // to rename each yyFlexLexer to some other xxFlexLexer.  You then
00037 // include <FlexLexer.h> in your other sources once per lexer class:
00038 //
00039 //      #undef yyFlexLexer
00040 //      #define yyFlexLexer xxFlexLexer
00041 //      #include <FlexLexer.h>
00042 //
00043 //      #undef yyFlexLexer
00044 //      #define yyFlexLexer zzFlexLexer
00045 //      #include <FlexLexer.h>
00046 //      ...
00047 
00048 #ifndef __FLEX_LEXER_H
00049 // Never included before - need to define base class.
00050 #define __FLEX_LEXER_H
00051 
00052 #include <iostream>
00053 #  ifndef FLEX_STD
00054 #    define FLEX_STD std::
00055 #  endif
00056 
00057 extern "C++" {
00058 
00059 struct yy_buffer_state;
00060 typedef int yy_state_type;
00061 
00062 class FlexLexer {
00063 public:
00064         virtual ~FlexLexer()    { }
00065 
00066         const char* YYText() const      { return yytext; }
00067         int YYLeng()    const   { return yyleng; }
00068 
00069         virtual void
00070                 yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
00071         virtual struct yy_buffer_state*
00072                 yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
00073         virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
00074         virtual void yyrestart( FLEX_STD istream* s ) = 0;
00075 
00076         virtual int yylex() = 0;
00077 
00078         // Call yylex with new input/output sources.
00079         int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
00080                 {
00081                 switch_streams( new_in, new_out );
00082                 return yylex();
00083                 }
00084 
00085         // Switch to new input/output streams.  A nil stream pointer
00086         // indicates "keep the current one".
00087         virtual void switch_streams( FLEX_STD istream* new_in = 0,
00088                                         FLEX_STD ostream* new_out = 0 ) = 0;
00089 
00090         int lineno() const              { return yylineno; }
00091 
00092         int debug() const               { return yy_flex_debug; }
00093         void set_debug( int flag )      { yy_flex_debug = flag; }
00094 
00095 protected:
00096         char* yytext;
00097         int yyleng;
00098         int yylineno;           // only maintained if you use %option yylineno
00099         int yy_flex_debug;      // only has effect with -d or "%option debug"
00100 };
00101 
00102 }
00103 #endif
00104 
00105 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
00106 // Either this is the first time through (yyFlexLexerOnce not defined),
00107 // or this is a repeated include to define a different flavor of
00108 // yyFlexLexer, as discussed in the flex man page.
00109 #define yyFlexLexerOnce
00110 
00111 extern "C++" {
00112 
00113 class yyFlexLexer : public FlexLexer {
00114 public:
00115         // arg_yyin and arg_yyout default to the cin and cout, but we
00116         // only make that assignment when initializing in yylex().
00117         yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
00118 
00119         virtual ~yyFlexLexer();
00120 
00121         void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
00122         struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
00123         void yy_delete_buffer( struct yy_buffer_state* b );
00124         void yyrestart( FLEX_STD istream* s );
00125 
00126     void yypush_buffer_state( struct yy_buffer_state* new_buffer );
00127     void yypop_buffer_state(void);
00128 
00129         virtual int yylex();
00130         virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out );
00131 
00132 protected:
00133         virtual int LexerInput( char* buf, int max_size );
00134         virtual void LexerOutput( const char* buf, int size );
00135         virtual void LexerError( const char* msg );
00136 
00137         void yyunput( int c, char* buf_ptr );
00138         int yyinput();
00139 
00140         void yy_load_buffer_state();
00141         void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
00142         void yy_flush_buffer( struct yy_buffer_state* b );
00143 
00144         int yy_start_stack_ptr;
00145         int yy_start_stack_depth;
00146         int* yy_start_stack;
00147 
00148         void yy_push_state( int new_state );
00149         void yy_pop_state();
00150         int yy_top_state();
00151 
00152         yy_state_type yy_get_previous_state();
00153         yy_state_type yy_try_NUL_trans( yy_state_type current_state );
00154         int yy_get_next_buffer();
00155 
00156         FLEX_STD istream* yyin; // input source for default LexerInput
00157         FLEX_STD ostream* yyout;        // output sink for default LexerOutput
00158 
00159         // yy_hold_char holds the character lost when yytext is formed.
00160         char yy_hold_char;
00161 
00162         // Number of characters read into yy_ch_buf.
00163         int yy_n_chars;
00164 
00165         // Points to current character in buffer.
00166         char* yy_c_buf_p;
00167 
00168         int yy_init;            // whether we need to initialize
00169         int yy_start;           // start state number
00170 
00171         // Flag which is used to allow yywrap()'s to do buffer switches
00172         // instead of setting up a fresh yyin.  A bit of a hack ...
00173         int yy_did_buffer_switch_on_eof;
00174 
00175 
00176     size_t yy_buffer_stack_top; 
00177     size_t yy_buffer_stack_max; 
00178     struct yy_buffer_state ** yy_buffer_stack; 
00179     void yyensure_buffer_stack(void);
00180 
00181         // The following are not always needed, but may be depending
00182         // on use of certain flex features (like REJECT or yymore()).
00183 
00184         yy_state_type yy_last_accepting_state;
00185         char* yy_last_accepting_cpos;
00186 
00187         yy_state_type* yy_state_buf;
00188         yy_state_type* yy_state_ptr;
00189 
00190         char* yy_full_match;
00191         int* yy_full_state;
00192         int yy_full_lp;
00193 
00194         int yy_lp;
00195         int yy_looking_for_trail_begin;
00196 
00197         int yy_more_flag;
00198         int yy_more_len;
00199         int yy_more_offset;
00200         int yy_prev_more_offset;
00201 };
00202 
00203 }
00204 
00205 #endif

Generated on Fri Sep 1 23:55:13 2006 for NanoComp by  doxygen 1.4.6