casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ds9FlexLexer.h
Go to the documentation of this file.
1 // -*-C++-*-
2 // FlexLexer.h -- define interfaces for lexical analyzer classes generated
3 // by flex
4 
5 // Copyright (c) 1993 The Regents of the University of California.
6 // All rights reserved.
7 //
8 // This code is derived from software contributed to Berkeley by
9 // Kent Williams and Tom Epperly.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions
13 // are met:
14 
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 
21 // Neither the name of the University nor the names of its contributors
22 // may be used to endorse or promote products derived from this software
23 // without specific prior written permission.
24 
25 // THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
26 // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
27 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE.
29 
30 // This file defines FlexLexer, an abstract class which specifies the
31 // external interface provided to flex C++ lexer objects, and yyFlexLexer,
32 // which defines a particular lexer class.
33 //
34 // If you want to create multiple lexer classes, you use the -P flag
35 // to rename each yyFlexLexer to some other xxFlexLexer. You then
36 // include <FlexLexer.h> in your other sources once per lexer class:
37 //
38 // #undef yyFlexLexer
39 // #define yyFlexLexer xxFlexLexer
40 // #include <FlexLexer.h>
41 //
42 // #undef yyFlexLexer
43 // #define yyFlexLexer zzFlexLexer
44 // #include <FlexLexer.h>
45 // ...
46 
47 #ifndef __FLEX_LEXER_H
48 // Never included before - need to define base class.
49 #define __FLEX_LEXER_H
50 
51 #include <iostream>
52 # ifndef FLEX_STD
53 # define FLEX_STD std::
54 # endif
55 
56 extern "C++" {
57 
58  struct yy_buffer_state;
59  typedef int yy_state_type;
60 
61  class FlexLexer {
62  public:
63  virtual ~FlexLexer() { }
64 
65  const char* YYText() const {
66  return yytext;
67  }
68  int YYLeng() const {
69  return yyleng;
70  }
71 
72  virtual void
73  yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
74  virtual struct yy_buffer_state*
75  yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
76  virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
77  virtual void yyrestart( FLEX_STD istream* s ) = 0;
78 
79  virtual int yylex() = 0;
80 
81  // Call yylex with new input/output sources.
82  int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ) {
83  switch_streams( new_in, new_out );
84  return yylex();
85  }
86 
87  // Switch to new input/output streams. A nil stream pointer
88  // indicates "keep the current one".
89  virtual void switch_streams( FLEX_STD istream* new_in = 0,
90  FLEX_STD ostream* new_out = 0 ) = 0;
91 
92  int lineno() const {
93  return yylineno;
94  }
95 
96  int debug() const {
97  return yy_flex_debug;
98  }
99  void set_debug( int flag ) {
100  yy_flex_debug = flag;
101  }
102 
103  protected:
104  char* yytext;
105  int yyleng;
106  int yylineno; // only maintained if you use %option yylineno
107  int yy_flex_debug; // only has effect with -d or "%option debug"
108  };
109 
110 }
111 #endif // FLEXLEXER_H
112 
113 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
114 // Either this is the first time through (yyFlexLexerOnce not defined),
115 // or this is a repeated include to define a different flavor of
116 // yyFlexLexer, as discussed in the flex manual.
117 #define yyFlexLexerOnce
118 
119 extern "C++" {
120 
121  class yyFlexLexer : public FlexLexer {
122  public:
123  // arg_yyin and arg_yyout default to the cin and cout, but we
124  // only make that assignment when initializing in yylex().
125  yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
126 
127  virtual ~yyFlexLexer();
128 
129  void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
130  struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
131  void yy_delete_buffer( struct yy_buffer_state* b );
132  void yyrestart( FLEX_STD istream* s );
133 
134  void yypush_buffer_state( struct yy_buffer_state* new_buffer );
135  void yypop_buffer_state();
136 
137  virtual int yylex();
138  virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 );
139  virtual int yywrap();
140 
141  protected:
142  virtual int LexerInput( char* buf, int max_size );
143  virtual void LexerOutput( const char* buf, int size );
144  virtual void LexerError( const char* msg );
145 
146  void yyunput( int c, char* buf_ptr );
147  int yyinput();
148 
149  void yy_load_buffer_state();
150  void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
151  void yy_flush_buffer( struct yy_buffer_state* b );
152 
156 
157  void yy_push_state( int new_state );
158  void yy_pop_state();
159  int yy_top_state();
160 
163  int yy_get_next_buffer();
164 
165  FLEX_STD istream* yyin; // input source for default LexerInput
166  FLEX_STD ostream* yyout; // output sink for default LexerOutput
167 
168  // yy_hold_char holds the character lost when yytext is formed.
170 
171  // Number of characters read into yy_ch_buf.
173 
174  // Points to current character in buffer.
175  char* yy_c_buf_p;
176 
177  int yy_init; // whether we need to initialize
178  int yy_start; // start state number
179 
180  // Flag which is used to allow yywrap()'s to do buffer switches
181  // instead of setting up a fresh yyin. A bit of a hack ...
183 
184 
187  struct yy_buffer_state ** yy_buffer_stack;
188  void yyensure_buffer_stack(void);
189 
190  // The following are not always needed, but may be depending
191  // on use of certain flex features (like REJECT or yymore()).
192 
195 
198 
202 
203  int yy_lp;
205 
210  };
211 
212 }
213 
214 #endif // yyFlexLexer || ! yyFlexLexerOnce
215 
virtual int yylex()
virtual void switch_streams(FLEX_STD istream *new_in, FLEX_STD ostream *new_out=0)
Switch to new input/output streams.
void yy_switch_to_buffer(struct yy_buffer_state *new_buffer)
int yy_flex_debug
Definition: ds9FlexLexer.h:107
virtual void switch_streams(FLEX_STD istream *new_in=0, FLEX_STD ostream *new_out=0)=0
Switch to new input/output streams.
void yypush_buffer_state(struct yy_buffer_state *new_buffer)
int yy_start_stack_ptr
Definition: ds9FlexLexer.h:153
int debug() const
Definition: ds9FlexLexer.h:96
yy_state_type * yy_state_ptr
Definition: ds9FlexLexer.h:197
void yy_push_state(int new_state)
yy_state_type yy_try_NUL_trans(yy_state_type current_state)
int YYLeng() const
Definition: ds9FlexLexer.h:68
size_t yy_buffer_stack_top
index of top of stack.
Definition: ds9FlexLexer.h:185
int yy_prev_more_offset
Definition: ds9FlexLexer.h:209
virtual void yy_switch_to_buffer(struct yy_buffer_state *new_buffer)=0
int * yy_start_stack
Definition: ds9FlexLexer.h:155
FLEX_STD istream * yyin
Definition: ds9FlexLexer.h:165
yy_state_type * yy_state_buf
Definition: ds9FlexLexer.h:196
void yy_flush_buffer(struct yy_buffer_state *b)
const char * YYText() const
Definition: ds9FlexLexer.h:65
char yy_hold_char
yy_hold_char holds the character lost when yytext is formed.
Definition: ds9FlexLexer.h:169
yy_state_type yy_last_accepting_state
The following are not always needed, but may be depending on use of certain flex features (like REJEC...
Definition: ds9FlexLexer.h:193
struct yy_buffer_state * yy_create_buffer(FLEX_STD istream *s, int size)
int yy_more_offset
Definition: ds9FlexLexer.h:208
virtual ~yyFlexLexer()
size_t size() const
void yyunput(int c, char *buf_ptr)
void yypop_buffer_state()
virtual void LexerError(const char *msg)
virtual int yylex()=0
char * yy_last_accepting_cpos
Definition: ds9FlexLexer.h:194
virtual ~FlexLexer()
Definition: ds9FlexLexer.h:63
void yy_load_buffer_state()
yyFlexLexer(FLEX_STD istream *arg_yyin=0, FLEX_STD ostream *arg_yyout=0)
arg_yyin and arg_yyout default to the cin and cout, but we only make that assignment when initializin...
int yy_looking_for_trail_begin
Definition: ds9FlexLexer.h:204
virtual struct yy_buffer_state * yy_create_buffer(FLEX_STD istream *s, int size)=0
char * yytext
Definition: ds9FlexLexer.h:104
size_t yy_buffer_stack_max
capacity of stack.
Definition: ds9FlexLexer.h:186
int yy_did_buffer_switch_on_eof
Flag which is used to allow yywrap()&#39;s to do buffer switches instead of setting up a fresh yyin...
Definition: ds9FlexLexer.h:182
char * yy_full_match
Definition: ds9FlexLexer.h:199
struct yy_buffer_state ** yy_buffer_stack
casacore::Stack as an array.
Definition: ds9FlexLexer.h:187
char * yy_c_buf_p
Points to current character in buffer.
Definition: ds9FlexLexer.h:175
int yy_get_next_buffer()
void yyensure_buffer_stack(void)
virtual void yyrestart(FLEX_STD istream *s)=0
int yylex(FLEX_STD istream *new_in, FLEX_STD ostream *new_out=0)
Call yylex with new input/output sources.
Definition: ds9FlexLexer.h:82
int * yy_full_state
Definition: ds9FlexLexer.h:200
virtual void LexerOutput(const char *buf, int size)
#define FLEX_STD
Definition: ds9FlexLexer.h:53
int lineno() const
Definition: ds9FlexLexer.h:92
virtual int LexerInput(char *buf, int max_size)
void yyrestart(FLEX_STD istream *s)
void yy_delete_buffer(struct yy_buffer_state *b)
int yy_n_chars
Number of characters read into yy_ch_buf.
Definition: ds9FlexLexer.h:172
void set_debug(int flag)
Definition: ds9FlexLexer.h:99
int yy_top_state()
FLEX_STD ostream * yyout
Definition: ds9FlexLexer.h:166
const Double c
Fundamental physical constants (SI units):
virtual void yy_delete_buffer(struct yy_buffer_state *b)=0
int yy_start_stack_depth
Definition: ds9FlexLexer.h:154
void yy_pop_state()
void yy_init_buffer(struct yy_buffer_state *b, FLEX_STD istream *s)
int yy_state_type
Definition: ds9FlexLexer.h:58
yy_state_type yy_get_previous_state()
virtual int yywrap()