diff options
author | Manoj Srivastava <srivasta@debian.org> | 2016-01-22 13:51:30 -0800 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2016-01-22 13:51:30 -0800 |
commit | f753f2b7b6d97014110dbe418861353a2f3f445d (patch) | |
tree | 7f248ce2f59fbb79cab24b4727955e37e9a5ab81 /doc | |
parent | 306163051847aaaabe7ae0f4cfc7d23f15923f3a (diff) | |
parent | a646b6cd438dc4bd957c6c6afd89b5e8e59468fe (diff) |
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
# Conflicts:
# INSTALL
# Makefile.in
# aclocal.m4
# build-aux/compile
# build-aux/config.guess
# build-aux/config.sub
# build-aux/depcomp
# build-aux/install-sh
# build-aux/mdate-sh
# build-aux/texinfo.tex
# configure
# doc/Makefile.in
# doc/flex.1
# doc/flex.info
# doc/flex.info-1
# doc/flex.info-2
# doc/flex.pdf
# doc/stamp-vti
# doc/version.texi
# examples/Makefile.in
# examples/fastwc/Makefile.in
# examples/manual/Makefile.in
# src/config.h.in
# tests/Makefile.in
# tests/test-bison-nr/Makefile.am
# tests/test-bison-yylloc/Makefile.am
# tests/test-bison-yylval/Makefile.am
# tools/Makefile.in
Diffstat (limited to 'doc')
-rw-r--r-- | doc/Makefile.am | 4 | ||||
-rw-r--r-- | doc/flex.texi | 32 |
2 files changed, 22 insertions, 14 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am index 0e23dca..e776c18 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -23,9 +23,9 @@ CLEANFILES = \ flex.vr \ flex.vrs -$(dist_man_MANS): $(top_srcdir)/main.c +$(dist_man_MANS): $(top_srcdir)/configure.ac $(top_srcdir)/src/flex.skl $(top_srcdir)/src/options.c $(top_srcdir)/src/options.h for i in $(dist_man_MANS) ; do \ $(help2man) --name='$(PACKAGE_NAME)' \ --section=`echo $$i | sed -e 's/.*\.\([^.]*\)$$/\1/'` \ - ../flex$(EXEEXT) > $$i || rm -f $$i ; \ + $(top_srcdir)/src/flex$(EXEEXT) > $$i || rm -f $$i ; \ done diff --git a/doc/flex.texi b/doc/flex.texi index 07ce3ac..9b7d83f 100644 --- a/doc/flex.texi +++ b/doc/flex.texi @@ -895,7 +895,7 @@ And to match a sequence of zero or more repetitions of @samp{foo} and @cindex character classes in patterns In addition to characters and ranges of characters, character classes can also contain @dfn{character class expressions}. These are -expressions enclosed inside @samp{[}: and @samp{:]} delimiters (which +expressions enclosed inside @samp{[:} and @samp{:]} delimiters (which themselves must appear between the @samp{[} and @samp{]} of the character class. Other elements may occur inside the character class, too). The valid expressions are: @@ -1404,7 +1404,7 @@ example, the following is one way to eat up C comments: @verbatim %% "/*" { - register int c; + int c; for ( ; ; ) { @@ -1601,7 +1601,6 @@ Any rule whose pattern is prefixed with @samp{<sc>} will only be active when the scanner is in the @dfn{start condition} named @code{sc}. For example, -@c proofread edit stopped here @example @verbatim <STRING>[^"]* { /* eat up the string body ... */ @@ -1934,9 +1933,9 @@ condition @dfn{scope}. A start condition scope is begun with: @end verbatim @end example -where @code{SCs} is a list of one or more start conditions. Inside the +where @code{<SCs>} is a list of one or more start conditions. Inside the start condition scope, every rule automatically has the prefix -@code{SCs>} applied to it, until a @samp{@}} which matches the initial +@code{<SCs>} applied to it, until a @samp{@}} which matches the initial @samp{@{}. So, for example, @cindex extended scope of start conditions @@ -3765,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: @@ -3800,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) @@ -3814,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() @@ -3833,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 @@ -3894,7 +3897,7 @@ Here is an example of a simple C++ scanner: int mylineno = 0; %} - %option noyywrap + %option noyywrap c++ string \"[^\n"]+\" @@ -3939,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; @@ -4911,8 +4917,10 @@ custom allocator through @code{yyextra}. %option reentrant /* Initialize the allocator. */ +%{ #define YY_EXTRA_TYPE struct allocator* #define YY_USER_INIT yyextra = allocator_create(); +%} %% .|\n ; |