Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-22 08:29:41

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 
0056   struct yy_buffer_state;
0057   typedef int yy_state_type;
0058 
0059   class FlexLexer
0060   {
0061   public:
0062     virtual ~FlexLexer() {}
0063 
0064     const char* YYText() const { return yytext; }
0065 
0066     int YYLeng() const { return yyleng; }
0067 
0068     virtual void             yy_switch_to_buffer(yy_buffer_state* new_buffer) = 0;
0069     virtual yy_buffer_state* yy_create_buffer(std::istream* s, int size)      = 0;
0070     virtual yy_buffer_state* yy_create_buffer(std::istream& s, int size)      = 0;
0071     virtual void             yy_delete_buffer(yy_buffer_state* b)             = 0;
0072     virtual void             yyrestart(std::istream* s)                       = 0;
0073     virtual void             yyrestart(std::istream& s)                       = 0;
0074 
0075     virtual int yylex() = 0;
0076 
0077     // Call yylex with new input/output sources.
0078     int yylex(std::istream& new_in, std::ostream& new_out)
0079     {
0080       switch_streams(new_in, new_out);
0081       return yylex();
0082     }
0083 
0084     int yylex(std::istream* new_in, std::ostream* new_out = 0)
0085     {
0086       switch_streams(new_in, new_out);
0087       return yylex();
0088     }
0089 
0090     // Switch to new input/output streams.  A nil stream pointer
0091     // indicates "keep the current one".
0092     virtual void switch_streams(std::istream* new_in, std::ostream* new_out) = 0;
0093     virtual void switch_streams(std::istream& new_in, std::ostream& new_out) = 0;
0094 
0095     int lineno() const { return yylineno; }
0096 
0097     int debug() const { return yy_flex_debug; }
0098 
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 #endif // FLEXLEXER_H
0109 
0110 #if defined(yyFlexLexer) || !defined(yyFlexLexerOnce)
0111 // Either this is the first time through (yyFlexLexerOnce not defined),
0112 // or this is a repeated include to define a different flavor of
0113 // yyFlexLexer, as discussed in the flex manual.
0114 #define yyFlexLexerOnce
0115 
0116 extern "C++"
0117 {
0118 
0119   class yyFlexLexer : public FlexLexer
0120   {
0121   public:
0122     // arg_yyin and arg_yyout default to the cin and cout, but we
0123     // only make that assignment when initializing in yylex().
0124     yyFlexLexer(std::istream& arg_yyin, std::ostream& arg_yyout);
0125     yyFlexLexer(std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0);
0126 
0127   private:
0128     void ctor_common();
0129 
0130   public:
0131     virtual ~yyFlexLexer();
0132 
0133     void             yy_switch_to_buffer(yy_buffer_state* new_buffer);
0134     yy_buffer_state* yy_create_buffer(std::istream* s, int size);
0135     yy_buffer_state* yy_create_buffer(std::istream& s, int size);
0136     void             yy_delete_buffer(yy_buffer_state* b);
0137     void             yyrestart(std::istream* s);
0138     void             yyrestart(std::istream& s);
0139 
0140     void yypush_buffer_state(yy_buffer_state* new_buffer);
0141     void yypop_buffer_state();
0142 
0143     virtual int  yylex();
0144     virtual void switch_streams(std::istream& new_in, std::ostream& new_out);
0145     virtual void switch_streams(std::istream* new_in = 0, std::ostream* new_out = 0);
0146     virtual int  yywrap();
0147 
0148   protected:
0149     virtual int  LexerInput(char* buf, int max_size);
0150     virtual void LexerOutput(const char* buf, int size);
0151     virtual void LexerError(const char* msg);
0152 
0153     void yyunput(int c, char* buf_ptr);
0154     int  yyinput();
0155 
0156     void yy_load_buffer_state();
0157     void yy_init_buffer(yy_buffer_state* b, std::istream& s);
0158     void yy_flush_buffer(yy_buffer_state* b);
0159 
0160     int  yy_start_stack_ptr;
0161     int  yy_start_stack_depth;
0162     int* yy_start_stack;
0163 
0164     void yy_push_state(int new_state);
0165     void yy_pop_state();
0166     int  yy_top_state();
0167 
0168     yy_state_type yy_get_previous_state();
0169     yy_state_type yy_try_NUL_trans(yy_state_type current_state);
0170     int           yy_get_next_buffer();
0171 
0172     std::istream yyin;  // input source for default LexerInput
0173     std::ostream yyout; // output sink for default LexerOutput
0174 
0175     // yy_hold_char holds the character lost when yytext is formed.
0176     char yy_hold_char;
0177 
0178     // Number of characters read into yy_ch_buf.
0179     int yy_n_chars;
0180 
0181     // Points to current character in buffer.
0182     char* yy_c_buf_p;
0183 
0184     int yy_init;  // whether we need to initialize
0185     int yy_start; // start state number
0186 
0187     // Flag which is used to allow yywrap()'s to do buffer switches
0188     // instead of setting up a fresh yyin.  A bit of a hack ...
0189     int yy_did_buffer_switch_on_eof;
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 #endif // yyFlexLexer || ! yyFlexLexerOnce