summaryrefslogtreecommitdiff
path: root/FlexLexer.h
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1994-12-17 18:40:50 +0000
committerVern Paxson <vern@ee.lbl.gov>1994-12-17 18:40:50 +0000
commit31fc7b21f52560531bbf69648b2ace98eaf26ead (patch)
treef0ab092a1e20c6a56d9b679e3ffa6439f0759171 /FlexLexer.h
parentafd99a7dfc68e72f16609af5e203d5c65a57b84a (diff)
-P fixes
constructor, destructor moved to flex.skl
Diffstat (limited to 'FlexLexer.h')
-rw-r--r--FlexLexer.h68
1 files changed, 23 insertions, 45 deletions
diff --git a/FlexLexer.h b/FlexLexer.h
index ae8e237..970abba 100644
--- a/FlexLexer.h
+++ b/FlexLexer.h
@@ -1,6 +1,7 @@
// $Header$
-// FlexLexer.h -- define classes for lexical analyzers generated by flex
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
// Copyright (c) 1993 The Regents of the University of California.
// All rights reserved.
@@ -22,19 +23,26 @@
// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#ifndef __FLEX_LEXER_H
-#define __FLEX_LEXER_H
-
-
-// This file defines two classes. The first, FlexLexer, is an abstract
-// class which specifies the external interface provided to flex C++
-// lexer objects. The second, yyFlexLexer, fills out most of the meat
-// of the lexer class; its internals may vary from lexer to lexer
-// depending on things like whether REJECT is used.
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
//
// If you want to create multiple lexer classes, you use the -P flag
-// to rename each yyFlexLexer to some other xxFlexLexer.
+// to rename each yyFlexLexer to some other xxFlexLexer. You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer xxFlexLexer
+// #include <FlexLexer.h>
+//
+// #undef yyFlexLexer
+// #define yyFlexLexer zzFlexLexer
+// #include <FlexLexer.h>
+// ...
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
#include <iostream.h>
extern "C++" {
@@ -63,42 +71,16 @@ protected:
int yyleng;
};
+}
+#endif
class yyFlexLexer : public FlexLexer {
public:
// arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex().
- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )
- {
- yyin = arg_yyin;
- yyout = arg_yyout;
- yy_c_buf_p = 0;
- yy_init = 1;
- yy_start = 0;
+ yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
- yy_did_buffer_switch_on_eof = 0;
-
- yy_looking_for_trail_begin = 0;
- yy_more_flag = 0;
- yy_more_len = 0;
-
- yy_start_stack_ptr = yy_start_stack_depth = 0;
- yy_start_stack = 0;
-
- yy_current_buffer = 0;
-
-#ifdef YY_USES_REJECT
- yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
-#else
- yy_state_buf = 0;
-#endif
- }
-
- virtual ~yyFlexLexer()
- {
- delete yy_state_buf;
- yy_delete_buffer( yy_current_buffer );
- }
+ virtual ~yyFlexLexer();
void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
struct yy_buffer_state* yy_create_buffer( istream* s, int size );
@@ -170,7 +152,3 @@ protected:
int yy_more_flag;
int yy_more_len;
};
-
-}
-
-#endif