summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMightyjo <mightyjo@gmail.com>2015-11-04 19:50:50 -0800
committerMightyjo <mightyjo@gmail.com>2015-11-07 23:28:09 -0800
commit1f4c0e67fefa05dfdad8ee815aa8bbbc0f0377f9 (patch)
tree773997f8c7c4ed4fa34bf0eb55adc4a9d84a5d37 /doc
parent336a1deaa57975f34cd732d656d1c0cbe3d5233a (diff)
Updated documentation to reflect the revisions to FlexLexer.h
Diffstat (limited to 'doc')
-rw-r--r--doc/flex.texi21
1 files changed, 14 insertions, 7 deletions
diff --git a/doc/flex.texi b/doc/flex.texi
index c7edce6..9b7d83f 100644
--- a/doc/flex.texi
+++ b/doc/flex.texi
@@ -3764,8 +3764,7 @@ defaults to generating the scanner to the file @file{lex.yy.cc} instead
of @file{lex.yy.c}. The generated scanner includes the header file
@file{FlexLexer.h}, which defines the interface to two C++ classes.
-The first class,
-@code{FlexLexer},
+The first class in @file{FlexLexer.h}, @code{FlexLexer},
provides an abstract base class defining the general scanner class
interface. It provides the following member functions:
@@ -3799,10 +3798,10 @@ returns the current setting of the debugging flag.
Also provided are member functions equivalent to
@code{yy_switch_to_buffer()}, @code{yy_create_buffer()} (though the
-first argument is an @code{istream*} object pointer and not a
+first argument is an @code{istream&} object reference and not a
@code{FILE*)}, @code{yy_flush_buffer()}, @code{yy_delete_buffer()}, and
-@code{yyrestart()} (again, the first argument is a @code{istream*}
-object pointer).
+@code{yyrestart()} (again, the first argument is a @code{istream&}
+object reference).
@tindex yyFlexLexer (C++ only)
@tindex FlexLexer (C++ only)
@@ -3813,9 +3812,12 @@ additional member functions:
@table @code
@findex yyFlexLexer constructor (C++ only)
@item yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )
+@item yyFlexLexer( istream& arg_yyin, ostream& arg_yyout )
constructs a @code{yyFlexLexer} object using the given streams for input
and output. If not specified, the streams default to @code{cin} and
-@code{cout}, respectively.
+@code{cout}, respectively. @code{yyFlexLexer} does not take ownership of
+its stream arguments. It's up to the user to ensure the streams pointed
+to remain alive at least as long as the @code{yyFlexLexer} instance.
@findex yylex (C++ version)
@item virtual int yylex()
@@ -3832,11 +3834,13 @@ instead of @code{yyFlexLexer}. In this case, rather than generating
@findex switch_streams (C++ only)
@item virtual void switch_streams(istream* new_in = 0, ostream* new_out = 0)
+@item virtual void switch_streams(istream& new_in, ostream& new_out)
reassigns @code{yyin} to @code{new_in} (if non-null) and @code{yyout} to
@code{new_out} (if non-null), deleting the previous input buffer if
@code{yyin} is reassigned.
@item int yylex( istream* new_in, ostream* new_out = 0 )
+@item int yylex( istream& new_in, ostream& new_out )
first switches the input streams via @code{switch_streams( new_in,
new_out )} and then returns the value of @code{yylex()}.
@end table
@@ -3893,7 +3897,7 @@ Here is an example of a simple C++ scanner:
int mylineno = 0;
%}
- %option noyywrap
+ %option noyywrap c++
string \"[^\n"]+\"
@@ -3938,6 +3942,9 @@ Here is an example of a simple C++ scanner:
%%
+ // This include is required if main() is an another source file.
+ //#include <FlexLexer.h>
+
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;