OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimFlexLexer.h
Go to the documentation of this file.
1 // $Header$
2 
3 // FlexLexer.h -- define interfaces for lexical analyzer classes generated
4 // by flex
5 
6 // Copyright (c) 1993 The Regents of the University of California.
7 // All rights reserved.
8 //
9 // This code is derived from software contributed to Berkeley by
10 // Kent Williams and Tom Epperly.
11 //
12 // Redistribution and use in source and binary forms with or without
13 // modification are permitted provided that: (1) source distributions retain
14 // this entire copyright notice and comment, and (2) distributions including
15 // binaries display the following acknowledgement: ``This product includes
16 // software developed by the University of California, Berkeley and its
17 // contributors'' in the documentation or other materials provided with the
18 // distribution and in all advertising materials mentioning features or use
19 // of this software. Neither the name of the University nor the names of
20 // its contributors may be used to endorse or promote products derived from
21 // this software without specific prior written permission.
22 
23 // THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
24 // WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
25 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26 
27 // This file defines FlexLexer, an abstract class which specifies the
28 // external interface provided to flex C++ lexer objects, and yyFlexLexer,
29 // which defines a particular lexer class.
30 //
31 // If you want to create multiple lexer classes, you use the -P flag
32 // to rename each yyFlexLexer to some other xxFlexLexer. You then
33 // include <FlexLexer.h> in your other sources once per lexer class:
34 //
35 // #undef yyFlexLexer
36 // #define yyFlexLexer xxFlexLexer
37 /*#include <FlexLexer.h>*/
38 //
39 // #undef yyFlexLexer
40 // #define yyFlexLexer zzFlexLexer
41 /* #include <ossim/base/FlexLexer.h> */
42 // ...
43 
44 #ifndef OSSIM__FLEX_LEXER_H
45 // Never included before - need to define base class.
46 #define OSSIM__FLEX_LEXER_H
47 #include <iostream>
49 using namespace std;
50 
51 
52 extern "C++" {
53 
55 typedef int yy_state_type;
56 
58 public:
59  virtual ~FlexLexer() { }
60 
61  const char* YYText() { return yytext; }
62  int YYLeng() { return yyleng; }
63 
64  virtual void
65  yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
66  virtual struct yy_buffer_state*
67  yy_create_buffer( istream* s, int size ) = 0;
68  virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
69  virtual void yyrestart( istream* s ) = 0;
70 
71  virtual int yylex() = 0;
72 
73  // Call yylex with new input/output sources.
74  int yylex( istream* new_in, ostream* new_out = 0 )
75  {
76  switch_streams( new_in, new_out );
77  return yylex();
78  }
79 
80  // Switch to new input/output streams. A nil stream pointer
81  // indicates "keep the current one".
82  virtual void switch_streams( istream* new_in = 0,
83  ostream* new_out = 0 ) = 0;
84 
85  int lineno() const { return yylineno; }
86 
87  int debug() const { return yy_flex_debug; }
88  void set_debug( int flag ) { yy_flex_debug = flag; }
89 
90 protected:
91  char* yytext;
92  int yyleng;
93  int yylineno; // only maintained if you use %option yylineno
94  int yy_flex_debug; // only has effect with -d or "%option debug"
95 };
96 
97 }
98 #endif
99 
100 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
101 // Either this is the first time through (yyFlexLexerOnce not defined),
102 // or this is a repeated include to define a different flavor of
103 // yyFlexLexer, as discussed in the flex man page.
104 #define yyFlexLexerOnce
105 
107 public:
108  // arg_yyin and arg_yyout default to the cin and cout, but we
109  // only make that assignment when initializing in yylex().
110  yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
111 
112  virtual ~yyFlexLexer();
113 
114  void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
115  struct yy_buffer_state* yy_create_buffer( istream* s, int size );
116  void yy_delete_buffer( struct yy_buffer_state* b );
117  void yyrestart( istream* s );
118 
119  virtual int yylex();
120  virtual void switch_streams( istream* new_in, ostream* new_out );
121 
122 protected:
123  virtual int LexerInput( char* buf, int max_size );
124  virtual void LexerOutput( const char* buf, int size );
125  virtual void LexerError( const char* msg );
126 
127  void yyunput( int c, char* buf_ptr );
128  int yyinput();
129 
130  void yy_load_buffer_state();
131  void yy_init_buffer( struct yy_buffer_state* b, istream* s );
132  void yy_flush_buffer( struct yy_buffer_state* b );
133 
137 
138  void yy_push_state( int new_state );
139  void yy_pop_state();
140  int yy_top_state();
141 
142  yy_state_type yy_get_previous_state();
143  yy_state_type yy_try_NUL_trans( yy_state_type current_state );
144  int yy_get_next_buffer();
145 
146  istream* yyin; // input source for default LexerInput
147  ostream* yyout; // output sink for default LexerOutput
148 
150 
151  // yy_hold_char holds the character lost when yytext is formed.
153 
154  // Number of characters read into yy_ch_buf.
156 
157  // Points to current character in buffer.
158  char* yy_c_buf_p;
159 
160  int yy_init; // whether we need to initialize
161  int yy_start; // start state number
162 
163  // Flag which is used to allow yywrap()'s to do buffer switches
164  // instead of setting up a fresh yyin. A bit of a hack ...
166 
167  // The following are not always needed, but may be depending
168  // on use of certain flex features (like REJECT or yymore()).
169 
172 
175 
179 
180  int yy_lp;
182 
187 };
188 #endif
int yy_flex_debug
int yy_state_type
int yy_start_stack_ptr
yy_state_type * yy_state_ptr
#define OSSIMDLLEXPORT
int yy_prev_more_offset
int * yy_start_stack
istream * yyin
yy_state_type * yy_state_buf
#define yyFlexLexer
yy_state_type yy_last_accepting_state
int YYLeng()
const char * YYText()
ostream * yyout
char * yy_last_accepting_cpos
virtual ~FlexLexer()
yy_size_t size
int yy_looking_for_trail_begin
char * yytext
int yy_did_buffer_switch_on_eof
char * yy_full_match
int lineno() const
char * yy_c_buf_p
int yylex(istream *new_in, ostream *new_out=0)
int * yy_full_state
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
void set_debug(int flag)
int yyleng
int yy_start_stack_depth
struct yy_buffer_state * yy_current_buffer
int debug() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23