diff --git a/usr.bin/lex/FlexLexer.h b/usr.bin/lex/FlexLexer.h index e77b9b477798..2df54f69e193 100644 --- a/usr.bin/lex/FlexLexer.h +++ b/usr.bin/lex/FlexLexer.h @@ -1,4 +1,4 @@ -// $NetBSD: FlexLexer.h,v 1.8 1998/01/05 05:15:43 perry Exp $ +// $NetBSD: FlexLexer.h,v 1.9 2003/11/18 21:37:39 christos Exp $ // FlexLexer.h -- define interfaces for lexical analyzer classes generated // by flex @@ -43,7 +43,7 @@ #ifndef __FLEX_LEXER_H // Never included before - need to define base class. #define __FLEX_LEXER_H -#include +#include extern "C++" { @@ -60,14 +60,14 @@ public: virtual void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; virtual struct yy_buffer_state* - yy_create_buffer( istream* s, int size ) = 0; + yy_create_buffer( std::istream* s, int size ) = 0; virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; - virtual void yyrestart( istream* s ) = 0; + virtual void yyrestart( std::istream* s ) = 0; virtual int yylex() = 0; // Call yylex with new input/output sources. - int yylex( istream* new_in, ostream* new_out = 0 ) + int yylex( std::istream* new_in, std::ostream* new_out = 0 ) { switch_streams( new_in, new_out ); return yylex(); @@ -75,8 +75,8 @@ public: // Switch to new input/output streams. A nil stream pointer // indicates "keep the current one". - virtual void switch_streams( istream* new_in = 0, - ostream* new_out = 0 ) = 0; + virtual void switch_streams( std::istream* new_in = 0, + std::ostream* new_out = 0 ) = 0; int lineno() const { return yylineno; } @@ -103,17 +103,17 @@ 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 ); + yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 ); virtual ~yyFlexLexer(); void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( istream* s, int size ); + struct yy_buffer_state* yy_create_buffer( std::istream* s, int size ); void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( istream* s ); + void yyrestart( std::istream* s ); virtual int yylex(); - virtual void switch_streams( istream* new_in, ostream* new_out ); + virtual void switch_streams( std::istream* new_in, std::ostream* new_out ); protected: virtual int LexerInput( char* buf, int max_size ); @@ -124,7 +124,7 @@ protected: int yyinput(); void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, istream* s ); + void yy_init_buffer( struct yy_buffer_state* b, std::istream* s ); void yy_flush_buffer( struct yy_buffer_state* b ); int yy_start_stack_ptr; @@ -139,8 +139,8 @@ protected: yy_state_type yy_try_NUL_trans( yy_state_type current_state ); int yy_get_next_buffer(); - istream* yyin; // input source for default LexerInput - ostream* yyout; // output sink for default LexerOutput + std::istream* yyin; // input source for default LexerInput + std::ostream* yyout; // output sink for default LexerOutput struct yy_buffer_state* yy_current_buffer; diff --git a/usr.bin/lex/NEWS b/usr.bin/lex/NEWS index 5374e395b0fb..223295178d7e 100644 --- a/usr.bin/lex/NEWS +++ b/usr.bin/lex/NEWS @@ -65,7 +65,7 @@ Changes between release 2.5.2 (25Apr95) and release 2.5.1: - The .texi and .info files in MISC/texinfo/ have been updated, thanks also to Francois Pinard. - - The FlexLexer::yylex(istream* new_in, ostream* new_out) method + - The FlexLexer::yylex(std::istream* new_in, std::ostream* new_out) method now does not have a default for the first argument, to disambiguate it from FlexLexer::yylex(). @@ -371,14 +371,14 @@ Changes between release 2.5.1 (28Mar95) and release 2.4.7: - The FlexLexer class includes two new public member functions: - virtual void switch_streams( istream* new_in = 0, - ostream* new_out = 0 ) + virtual void switch_streams( std::istream* new_in = 0, + std::ostream* new_out = 0 ) reassigns yyin to new_in (if non-nil) and yyout to new_out (ditto), deleting the previous input buffer if yyin is reassigned. It is used by: - int yylex( istream* new_in = 0, ostream* new_out = 0 ) + int yylex( std::istream* new_in = 0, std::ostream* new_out = 0 ) which first calls switch_streams() and then returns the value of calling yylex(). diff --git a/usr.bin/lex/flex.1 b/usr.bin/lex/flex.1 index 59ecf85ccdc2..73c3a11ba96d 100644 --- a/usr.bin/lex/flex.1 +++ b/usr.bin/lex/flex.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: flex.1,v 1.15 2003/07/09 14:47:33 wiz Exp $ +.\" $NetBSD: flex.1,v 1.16 2003/11/18 21:37:39 christos Exp $ .\" .TH FLEX 1 "April 1995" "Version 2.5" .SH NAME @@ -3394,7 +3394,7 @@ Also provided are member functions equivalent to .B yy_switch_to_buffer(), .B yy_create_buffer() (though the first argument is an -.B istream* +.B std::istream* object pointer and not a .B FILE*), .B yy_flush_buffer(), @@ -3402,7 +3402,7 @@ object pointer and not a and .B yyrestart() (again, the first argument is a -.B istream* +.B std::istream* object pointer). .PP The second class defined in @@ -3414,7 +3414,7 @@ which is derived from It defines the following additional member functions: .TP .B -yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ) +yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 ) constructs a .B yyFlexLexer object using the given streams for input and output. @@ -3455,9 +3455,9 @@ that calls if called). .TP .B -virtual void switch_streams(istream* new_in = 0, +virtual void switch_streams(std::istream* new_in = 0, .B -ostream* new_out = 0) +std::ostream* new_out = 0) reassigns .B yyin to @@ -3472,7 +3472,7 @@ to is reassigned. .TP .B -int yylex( istream* new_in, ostream* new_out = 0 ) +int yylex( std::istream* new_in, std::ostream* new_out = 0 ) first switches the input streams via .B switch_streams( new_in, new_out ) and then returns the value of diff --git a/usr.bin/lex/flex.skl b/usr.bin/lex/flex.skl index 6905dd73aea5..e1ceec5b7e49 100644 --- a/usr.bin/lex/flex.skl +++ b/usr.bin/lex/flex.skl @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $NetBSD: flex.skl,v 1.17 2003/11/18 17:02:27 christos Exp $ + * $NetBSD: flex.skl,v 1.18 2003/11/18 21:37:39 christos Exp $ */ #define FLEX_SCANNER @@ -25,7 +25,7 @@ #include %+ -class std::istream; +#include %* #include @@ -480,14 +480,14 @@ YY_DECL %- yyin = stdin; %+ - yyin = &cin; + yyin = &std::cin; %* if ( ! yyout ) %- yyout = stdout; %+ - yyout = &cout; + yyout = &std::cout; %* if ( ! yy_current_buffer ) @@ -1446,7 +1446,7 @@ char msg[]; void yyFlexLexer::LexerError( yyconst char msg[] ) { - cerr << msg << '\n'; + std::cerr << msg << std::endl; exit( YY_EXIT_FAILURE ); } %* diff --git a/usr.bin/lex/gen.c b/usr.bin/lex/gen.c index ea1b72c33631..216a2d52d656 100644 --- a/usr.bin/lex/gen.c +++ b/usr.bin/lex/gen.c @@ -26,7 +26,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -/* $NetBSD: gen.c,v 1.16 2003/07/14 11:36:48 itojun Exp $ */ +/* $NetBSD: gen.c,v 1.17 2003/11/18 21:37:39 christos Exp $ */ #include "flexdef.h" @@ -1436,7 +1436,7 @@ void make_tables() indent_puts( "if ( yy_act == 0 )" ); indent_up(); indent_puts( C_plus_plus ? - "cerr << \"--scanner backing up\\n\";" : + "std::cerr << \"--scanner backing up\" << std:endl;" : "fprintf( stderr, \"--scanner backing up\\n\" );" ); indent_down(); @@ -1447,9 +1447,9 @@ void make_tables() if ( C_plus_plus ) { indent_puts( - "cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" ); + "std::cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" ); indent_puts( - " \"(\\\"\" << yytext << \"\\\")\\n\";" ); + " \"(\\\"\" << yytext << \"\\\")\" << std::endl;" ); } else { @@ -1469,7 +1469,7 @@ void make_tables() if ( C_plus_plus ) { indent_puts( -"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); +"std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\" << std::endl;" ); } else { @@ -1485,7 +1485,7 @@ void make_tables() indent_up(); indent_puts( C_plus_plus ? - "cerr << \"--(end of buffer or a NUL)\\n\";" : + "std::cerr << \"--(end of buffer or a NUL)\" << std::endl;" : "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); indent_down(); @@ -1497,7 +1497,7 @@ void make_tables() if ( C_plus_plus ) { indent_puts( - "cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); + "std::cerr << \"--EOF (start condition \" << YY_START << \")\" << std::endl;" ); } else {