Blame src/FlexLexer.h

Packit f00812
// -*-C++-*-
Packit f00812
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
Packit f00812
// by flex
Packit f00812
Packit f00812
// Copyright (c) 1993 The Regents of the University of California.
Packit f00812
// All rights reserved.
Packit f00812
//
Packit f00812
// This code is derived from software contributed to Berkeley by
Packit f00812
// Kent Williams and Tom Epperly.
Packit f00812
//
Packit f00812
//  Redistribution and use in source and binary forms, with or without
Packit f00812
//  modification, are permitted provided that the following conditions
Packit f00812
//  are met:
Packit f00812
Packit f00812
//  1. Redistributions of source code must retain the above copyright
Packit f00812
//  notice, this list of conditions and the following disclaimer.
Packit f00812
//  2. Redistributions in binary form must reproduce the above copyright
Packit f00812
//  notice, this list of conditions and the following disclaimer in the
Packit f00812
//  documentation and/or other materials provided with the distribution.
Packit f00812
Packit f00812
//  Neither the name of the University nor the names of its contributors
Packit f00812
//  may be used to endorse or promote products derived from this software
Packit f00812
//  without specific prior written permission.
Packit f00812
Packit f00812
//  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
Packit f00812
//  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Packit f00812
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
Packit f00812
//  PURPOSE.
Packit f00812
Packit f00812
// This file defines FlexLexer, an abstract class which specifies the
Packit f00812
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
Packit f00812
// which defines a particular lexer class.
Packit f00812
//
Packit f00812
// If you want to create multiple lexer classes, you use the -P flag
Packit f00812
// to rename each yyFlexLexer to some other xxFlexLexer.  You then
Packit f00812
// include <FlexLexer.h> in your other sources once per lexer class:
Packit f00812
//
Packit f00812
//      #undef yyFlexLexer
Packit f00812
//      #define yyFlexLexer xxFlexLexer
Packit f00812
//      #include <FlexLexer.h>
Packit f00812
//
Packit f00812
//      #undef yyFlexLexer
Packit f00812
//      #define yyFlexLexer zzFlexLexer
Packit f00812
//      #include <FlexLexer.h>
Packit f00812
//      ...
Packit f00812
Packit f00812
#ifndef __FLEX_LEXER_H
Packit f00812
// Never included before - need to define base class.
Packit f00812
#define __FLEX_LEXER_H
Packit f00812
Packit f00812
#include <iostream>
Packit f00812
Packit f00812
extern "C++" {
Packit f00812
Packit f00812
struct yy_buffer_state;
Packit f00812
typedef int yy_state_type;
Packit f00812
Packit f00812
class FlexLexer
Packit f00812
{
Packit f00812
public:
Packit f00812
  virtual ~FlexLexer()        { }
Packit f00812
Packit f00812
  const char* YYText() const  { return yytext; }
Packit f00812
  int YYLeng()        const   { return yyleng; }
Packit f00812
Packit f00812
  virtual void
Packit f00812
  yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
Packit f00812
  virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
Packit f00812
  virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
Packit f00812
  virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
Packit f00812
  virtual void yyrestart( std::istream* s ) = 0;
Packit f00812
  virtual void yyrestart( std::istream& s ) = 0;
Packit f00812
Packit f00812
  virtual int yylex() = 0;
Packit f00812
Packit f00812
  // Call yylex with new input/output sources.
Packit f00812
  int yylex( std::istream& new_in, std::ostream& new_out )
Packit f00812
  {
Packit f00812
    switch_streams( new_in, new_out );
Packit f00812
    return yylex();
Packit f00812
  }
Packit f00812
Packit f00812
  int yylex( std::istream* new_in, std::ostream* new_out = 0)
Packit f00812
  {
Packit f00812
    switch_streams( new_in, new_out );
Packit f00812
    return yylex();
Packit f00812
  }
Packit f00812
Packit f00812
  // Switch to new input/output streams.  A nil stream pointer
Packit f00812
  // indicates "keep the current one".
Packit f00812
  virtual void switch_streams( std::istream* new_in,
Packit f00812
                               std::ostream* new_out ) = 0;
Packit f00812
  virtual void switch_streams( std::istream& new_in,
Packit f00812
                               std::ostream& new_out ) = 0;
Packit f00812
Packit f00812
  int lineno() const          { return yylineno; }
Packit f00812
Packit f00812
  int debug() const           { return yy_flex_debug; }
Packit f00812
  void set_debug( int flag )  { yy_flex_debug = flag; }
Packit f00812
Packit f00812
protected:
Packit f00812
  char* yytext;
Packit f00812
  int yyleng;
Packit f00812
  int yylineno;       // only maintained if you use %option yylineno
Packit f00812
  int yy_flex_debug;  // only has effect with -d or "%option debug"
Packit f00812
};
Packit f00812
Packit f00812
}
Packit f00812
#endif // FLEXLEXER_H
Packit f00812
Packit f00812
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
Packit f00812
// Either this is the first time through (yyFlexLexerOnce not defined),
Packit f00812
// or this is a repeated include to define a different flavor of
Packit f00812
// yyFlexLexer, as discussed in the flex manual.
Packit f00812
# define yyFlexLexerOnce
Packit f00812
Packit f00812
extern "C++" {
Packit f00812
Packit f00812
class yyFlexLexer : public FlexLexer {
Packit f00812
public:
Packit f00812
  // arg_yyin and arg_yyout default to the cin and cout, but we
Packit f00812
  // only make that assignment when initializing in yylex().
Packit f00812
  yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
Packit f00812
  yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
Packit f00812
private:
Packit f00812
  void ctor_common();
Packit f00812
Packit f00812
public:
Packit f00812
Packit f00812
  virtual ~yyFlexLexer();
Packit f00812
Packit f00812
  void yy_switch_to_buffer( yy_buffer_state* new_buffer );
Packit f00812
  yy_buffer_state* yy_create_buffer( std::istream* s, int size );
Packit f00812
  yy_buffer_state* yy_create_buffer( std::istream& s, int size );
Packit f00812
  void yy_delete_buffer( yy_buffer_state* b );
Packit f00812
  void yyrestart( std::istream* s );
Packit f00812
  void yyrestart( std::istream& s );
Packit f00812
Packit f00812
  void yypush_buffer_state( yy_buffer_state* new_buffer );
Packit f00812
  void yypop_buffer_state();
Packit f00812
Packit f00812
  virtual int yylex();
Packit f00812
  virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
Packit f00812
  virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
Packit f00812
  virtual int yywrap();
Packit f00812
Packit f00812
protected:
Packit f00812
  virtual int LexerInput( char* buf, int max_size );
Packit f00812
  virtual void LexerOutput( const char* buf, int size );
Packit f00812
  virtual void LexerError( const char* msg );
Packit f00812
Packit f00812
  void yyunput( int c, char* buf_ptr );
Packit f00812
  int yyinput();
Packit f00812
Packit f00812
  void yy_load_buffer_state();
Packit f00812
  void yy_init_buffer( yy_buffer_state* b, std::istream& s );
Packit f00812
  void yy_flush_buffer( yy_buffer_state* b );
Packit f00812
Packit f00812
  int yy_start_stack_ptr;
Packit f00812
  int yy_start_stack_depth;
Packit f00812
  int* yy_start_stack;
Packit f00812
Packit f00812
  void yy_push_state( int new_state );
Packit f00812
  void yy_pop_state();
Packit f00812
  int yy_top_state();
Packit f00812
Packit f00812
  yy_state_type yy_get_previous_state();
Packit f00812
  yy_state_type yy_try_NUL_trans( yy_state_type current_state );
Packit f00812
  int yy_get_next_buffer();
Packit f00812
Packit f00812
  std::istream yyin;  // input source for default LexerInput
Packit f00812
  std::ostream yyout; // output sink for default LexerOutput
Packit f00812
Packit f00812
  // yy_hold_char holds the character lost when yytext is formed.
Packit f00812
  char yy_hold_char;
Packit f00812
Packit f00812
  // Number of characters read into yy_ch_buf.
Packit f00812
  int yy_n_chars;
Packit f00812
Packit f00812
  // Points to current character in buffer.
Packit f00812
  char* yy_c_buf_p;
Packit f00812
Packit f00812
  int yy_init;                // whether we need to initialize
Packit f00812
  int yy_start;               // start state number
Packit f00812
Packit f00812
  // Flag which is used to allow yywrap()'s to do buffer switches
Packit f00812
  // instead of setting up a fresh yyin.  A bit of a hack ...
Packit f00812
  int yy_did_buffer_switch_on_eof;
Packit f00812
Packit f00812
Packit f00812
  size_t yy_buffer_stack_top; /**< index of top of stack. */
Packit f00812
  size_t yy_buffer_stack_max; /**< capacity of stack. */
Packit f00812
  yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
Packit f00812
  void yyensure_buffer_stack(void);
Packit f00812
Packit f00812
  // The following are not always needed, but may be depending
Packit f00812
  // on use of certain flex features (like REJECT or yymore()).
Packit f00812
Packit f00812
  yy_state_type yy_last_accepting_state;
Packit f00812
  char* yy_last_accepting_cpos;
Packit f00812
Packit f00812
  yy_state_type* yy_state_buf;
Packit f00812
  yy_state_type* yy_state_ptr;
Packit f00812
Packit f00812
  char* yy_full_match;
Packit f00812
  int* yy_full_state;
Packit f00812
  int yy_full_lp;
Packit f00812
Packit f00812
  int yy_lp;
Packit f00812
  int yy_looking_for_trail_begin;
Packit f00812
Packit f00812
  int yy_more_flag;
Packit f00812
  int yy_more_len;
Packit f00812
  int yy_more_offset;
Packit f00812
  int yy_prev_more_offset;
Packit f00812
};
Packit f00812
Packit f00812
}
Packit f00812
Packit f00812
#endif // yyFlexLexer || ! yyFlexLexerOnce