pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / flex-2.5.4 / FlexLexer.h
blob549177b8b9acb8a6beba8c6eb9e9f31ac72a7f5b
1 // $Header$
3 // FlexLexer.h -- define interfaces for lexical analyzer classes generated
4 // by flex
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.
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.
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.
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.
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:
35 // #undef yyFlexLexer
36 // #define yyFlexLexer xxFlexLexer
37 // #include <FlexLexer.h>
39 // #undef yyFlexLexer
40 // #define yyFlexLexer zzFlexLexer
41 // #include <FlexLexer.h>
42 // ...
44 #ifndef __FLEX_LEXER_H
45 // Never included before - need to define base class.
46 #define __FLEX_LEXER_H
47 #include <iostream.h>
49 extern "C++" {
51 struct yy_buffer_state;
52 typedef int yy_state_type;
54 class FlexLexer {
55 public:
56 virtual ~FlexLexer() { }
58 const char* YYText() { return yytext; }
59 int YYLeng() { return yyleng; }
61 virtual void
62 yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
63 virtual struct yy_buffer_state*
64 yy_create_buffer( istream* s, int size ) = 0;
65 virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
66 virtual void yyrestart( istream* s ) = 0;
68 virtual int yylex() = 0;
70 // Call yylex with new input/output sources.
71 int yylex( istream* new_in, ostream* new_out = 0 )
73 switch_streams( new_in, new_out );
74 return yylex();
77 // Switch to new input/output streams. A nil stream pointer
78 // indicates "keep the current one".
79 virtual void switch_streams( istream* new_in = 0,
80 ostream* new_out = 0 ) = 0;
82 int lineno() const { return yylineno; }
84 int debug() const { return yy_flex_debug; }
85 void set_debug( int flag ) { yy_flex_debug = flag; }
87 protected:
88 char* yytext;
89 int yyleng;
90 int yylineno; // only maintained if you use %option yylineno
91 int yy_flex_debug; // only has effect with -d or "%option debug"
95 #endif
97 #if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
98 // Either this is the first time through (yyFlexLexerOnce not defined),
99 // or this is a repeated include to define a different flavor of
100 // yyFlexLexer, as discussed in the flex man page.
101 #define yyFlexLexerOnce
103 class yyFlexLexer : public FlexLexer {
104 public:
105 // arg_yyin and arg_yyout default to the cin and cout, but we
106 // only make that assignment when initializing in yylex().
107 yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
109 virtual ~yyFlexLexer();
111 void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
112 struct yy_buffer_state* yy_create_buffer( istream* s, int size );
113 void yy_delete_buffer( struct yy_buffer_state* b );
114 void yyrestart( istream* s );
116 virtual int yylex();
117 virtual void switch_streams( istream* new_in, ostream* new_out );
119 protected:
120 virtual int LexerInput( char* buf, int max_size );
121 virtual void LexerOutput( const char* buf, int size );
122 virtual void LexerError( const char* msg );
124 void yyunput( int c, char* buf_ptr );
125 int yyinput();
127 void yy_load_buffer_state();
128 void yy_init_buffer( struct yy_buffer_state* b, istream* s );
129 void yy_flush_buffer( struct yy_buffer_state* b );
131 int yy_start_stack_ptr;
132 int yy_start_stack_depth;
133 int* yy_start_stack;
135 void yy_push_state( int new_state );
136 void yy_pop_state();
137 int yy_top_state();
139 yy_state_type yy_get_previous_state();
140 yy_state_type yy_try_NUL_trans( yy_state_type current_state );
141 int yy_get_next_buffer();
143 istream* yyin; // input source for default LexerInput
144 ostream* yyout; // output sink for default LexerOutput
146 struct yy_buffer_state* yy_current_buffer;
148 // yy_hold_char holds the character lost when yytext is formed.
149 char yy_hold_char;
151 // Number of characters read into yy_ch_buf.
152 int yy_n_chars;
154 // Points to current character in buffer.
155 char* yy_c_buf_p;
157 int yy_init; // whether we need to initialize
158 int yy_start; // start state number
160 // Flag which is used to allow yywrap()'s to do buffer switches
161 // instead of setting up a fresh yyin. A bit of a hack ...
162 int yy_did_buffer_switch_on_eof;
164 // The following are not always needed, but may be depending
165 // on use of certain flex features (like REJECT or yymore()).
167 yy_state_type yy_last_accepting_state;
168 char* yy_last_accepting_cpos;
170 yy_state_type* yy_state_buf;
171 yy_state_type* yy_state_ptr;
173 char* yy_full_match;
174 int* yy_full_state;
175 int yy_full_lp;
177 int yy_lp;
178 int yy_looking_for_trail_begin;
180 int yy_more_flag;
181 int yy_more_len;
182 int yy_more_offset;
183 int yy_prev_more_offset;
186 #endif