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