Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:29:51

0001 // -*-C++-*-
0002 // FlexLexer.h -- define interfaces for lexical analyzer classes generated
0003 // by flex
0004 
0005 // Copyright (c) 1993 The Regents of the University of California.
0006 // All rights reserved.
0007 //
0008 // This code is derived from software contributed to Berkeley by
0009 // Kent Williams and Tom Epperly.
0010 //
0011 //  Redistribution and use in source and binary forms, with or without
0012 //  modification, are permitted provided that the following conditions
0013 //  are met:
0014 
0015 //  1. Redistributions of source code must retain the above copyright
0016 //  notice, this list of conditions and the following disclaimer.
0017 //  2. Redistributions in binary form must reproduce the above copyright
0018 //  notice, this list of conditions and the following disclaimer in the
0019 //  documentation and/or other materials provided with the distribution.
0020 
0021 //  Neither the name of the University nor the names of its contributors
0022 //  may be used to endorse or promote products derived from this software
0023 //  without specific prior written permission.
0024 
0025 //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
0026 //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
0027 //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0028 //  PURPOSE.
0029 
0030 // This file defines FlexLexer, an abstract class which specifies the
0031 // external interface provided to flex C++ lexer objects, and yyFlexLexer,
0032 // which defines a particular lexer class.
0033 //
0034 // If you want to create multiple lexer classes, you use the -P flag
0035 // to rename each yyFlexLexer to some other xxFlexLexer.  You then
0036 // include <FlexLexer.h> in your other sources once per lexer class:
0037 //
0038 //      #undef yyFlexLexer
0039 //      #define yyFlexLexer xxFlexLexer
0040 //      #include <FlexLexer.h>
0041 //
0042 //      #undef yyFlexLexer
0043 //      #define yyFlexLexer zzFlexLexer
0044 //      #include <FlexLexer.h>
0045 //      ...
0046 
0047 #ifndef __FLEX_LEXER_H
0048 // Never included before - need to define base class.
0049 #define __FLEX_LEXER_H
0050 
0051 #include <iostream>
0052 
0053 extern "C++" {
0054 
0055 struct yy_buffer_state;
0056 typedef int yy_state_type;
0057 
0058 class FlexLexer
0059 {
0060 public:
0061   virtual ~FlexLexer()        { }
0062 
0063   const char* YYText() const  { return yytext; }
0064   int YYLeng()        const   { return yyleng; }
0065 
0066   virtual void
0067   yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
0068   virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
0069   virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
0070   virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
0071   virtual void yyrestart( std::istream* s ) = 0;
0072   virtual void yyrestart( std::istream& s ) = 0;
0073 
0074   virtual int yylex() = 0;
0075 
0076   // Call yylex with new input/output sources.
0077   int yylex( std::istream& new_in, std::ostream& new_out )
0078   {
0079     switch_streams( new_in, new_out );
0080     return yylex();
0081   }
0082 
0083   int yylex( std::istream* new_in, std::ostream* new_out = 0)
0084   {
0085     switch_streams( new_in, new_out );
0086     return yylex();
0087   }
0088 
0089   // Switch to new input/output streams.  A nil stream pointer
0090   // indicates "keep the current one".
0091   virtual void switch_streams( std::istream* new_in,
0092                                std::ostream* new_out ) = 0;
0093   virtual void switch_streams( std::istream& new_in,
0094                                std::ostream& new_out ) = 0;
0095 
0096   int lineno() const          { return yylineno; }
0097 
0098   int debug() const           { return yy_flex_debug; }
0099   void set_debug( int flag )  { yy_flex_debug = flag; }
0100 
0101 protected:
0102   char* yytext;
0103   int yyleng;
0104   int yylineno;       // only maintained if you use %option yylineno
0105   int yy_flex_debug;  // only has effect with -d or "%option debug"
0106 };
0107 
0108 }
0109 #endif // FLEXLEXER_H
0110 
0111 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
0112 // Either this is the first time through (yyFlexLexerOnce not defined),
0113 // or this is a repeated include to define a different flavor of
0114 // yyFlexLexer, as discussed in the flex manual.
0115 # define yyFlexLexerOnce
0116 
0117 extern "C++" {
0118 
0119 class yyFlexLexer : public FlexLexer {
0120 public:
0121   // arg_yyin and arg_yyout default to the cin and cout, but we
0122   // only make that assignment when initializing in yylex().
0123   yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
0124   yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
0125 private:
0126   void ctor_common();
0127 
0128 public:
0129 
0130   virtual ~yyFlexLexer();
0131 
0132   void yy_switch_to_buffer( yy_buffer_state* new_buffer );
0133   yy_buffer_state* yy_create_buffer( std::istream* s, int size );
0134   yy_buffer_state* yy_create_buffer( std::istream& s, int size );
0135   void yy_delete_buffer( yy_buffer_state* b );
0136   void yyrestart( std::istream* s );
0137   void yyrestart( std::istream& s );
0138 
0139   void yypush_buffer_state( yy_buffer_state* new_buffer );
0140   void yypop_buffer_state();
0141 
0142   virtual int yylex();
0143   virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
0144   virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
0145   virtual int yywrap();
0146 
0147 protected:
0148   virtual int LexerInput( char* buf, int max_size );
0149   virtual void LexerOutput( const char* buf, int size );
0150   virtual void LexerError( const char* msg );
0151 
0152   void yyunput( int c, char* buf_ptr );
0153   int yyinput();
0154 
0155   void yy_load_buffer_state();
0156   void yy_init_buffer( yy_buffer_state* b, std::istream& s );
0157   void yy_flush_buffer( yy_buffer_state* b );
0158 
0159   int yy_start_stack_ptr;
0160   int yy_start_stack_depth;
0161   int* yy_start_stack;
0162 
0163   void yy_push_state( int new_state );
0164   void yy_pop_state();
0165   int yy_top_state();
0166 
0167   yy_state_type yy_get_previous_state();
0168   yy_state_type yy_try_NUL_trans( yy_state_type current_state );
0169   int yy_get_next_buffer();
0170 
0171   std::istream yyin;  // input source for default LexerInput
0172   std::ostream yyout; // output sink for default LexerOutput
0173 
0174   // yy_hold_char holds the character lost when yytext is formed.
0175   char yy_hold_char;
0176 
0177   // Number of characters read into yy_ch_buf.
0178   int yy_n_chars;
0179 
0180   // Points to current character in buffer.
0181   char* yy_c_buf_p;
0182 
0183   int yy_init;                // whether we need to initialize
0184   int yy_start;               // start state number
0185 
0186   // Flag which is used to allow yywrap()'s to do buffer switches
0187   // instead of setting up a fresh yyin.  A bit of a hack ...
0188   int yy_did_buffer_switch_on_eof;
0189 
0190 
0191   size_t yy_buffer_stack_top; /**< index of top of stack. */
0192   size_t yy_buffer_stack_max; /**< capacity of stack. */
0193   yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
0194   void yyensure_buffer_stack(void);
0195 
0196   // The following are not always needed, but may be depending
0197   // on use of certain flex features (like REJECT or yymore()).
0198 
0199   yy_state_type yy_last_accepting_state;
0200   char* yy_last_accepting_cpos;
0201 
0202   yy_state_type* yy_state_buf;
0203   yy_state_type* yy_state_ptr;
0204 
0205   char* yy_full_match;
0206   int* yy_full_state;
0207   int yy_full_lp;
0208 
0209   int yy_lp;
0210   int yy_looking_for_trail_begin;
0211 
0212   int yy_more_flag;
0213   int yy_more_len;
0214   int yy_more_offset;
0215   int yy_prev_more_offset;
0216 };
0217 
0218 }
0219 
0220 #endif // yyFlexLexer || ! yyFlexLexerOnce