summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2016-01-22 13:36:58 -0800
committerManoj Srivastava <srivasta@debian.org>2016-01-22 13:36:58 -0800
commit426e91fa66c2a2341d46f977ee351bd24ef3331c (patch)
treeb4d506125335b5e5d748ac284b7239e10df96d21 /doc
parent26bb2525c89ecda0b0bc7b597ec8d1b792fc8662 (diff)
parent83d5d1695a2ab1d69ea4d8e7df27146c644876fc (diff)
Merge tag 'v2.6.0' into upstream
flex v2.6.0 release Signed-off-by: Manoj Srivastava <srivasta@debian.org> # gpg: Signature made Sat 05 Dec 2015 11:42:31 AM PST using RSA key ID 4F8BC9A4 # gpg: requesting key 4F8BC9A4 from hkp server pool.sks-keyservers.net # gpg: no valid OpenPGP data found. # gpg: Total number processed: 0 # gpg: keyserver communications error: key not found # gpg: keyserver communications error: bad public key # gpg: Can't check signature: public key not found # Conflicts: # Makefile.am # NEWS # autogen.sh # configure.ac # doc/Makefile.am # doc/flex.texi # examples/fastwc/mywc.c # lib/Makefile.am # lib/malloc.c # lib/realloc.c # po/POTFILES.in # po/ca.po # po/da.po # po/de.po # po/eo.po # po/es.po # po/fi.po # po/fr.po # po/ga.po # po/hr.po # po/ko.po # po/nl.po # po/pl.po # po/pt_BR.po # po/ro.po # po/ru.po # po/sr.po # po/sv.po # po/tr.po # po/vi.po # po/zh_CN.po # po/zh_TW.po # tests/Makefile.am # tests/README
Diffstat (limited to 'doc')
-rw-r--r--doc/.gitignore27
-rw-r--r--doc/Makefile.am4
-rw-r--r--doc/flex.texi676
3 files changed, 371 insertions, 336 deletions
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..83b0108
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,27 @@
+flex.aux
+flex.cp
+flex.cps
+flex.dvi
+flex.fn
+flex.fns
+flex.hk
+flex.hks
+flex.info*
+flex.ky
+flex.log
+flex.op
+flex.ops
+flex.pg
+flex.toc
+flex.tp
+flex.tps
+flex.vr
+flex.vrs
+Makefile
+Makefile.in
+flex.1
+flex.pdf
+flex.ps
+version.texi
+flex.html
+flex.t2p
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..6bca1c8 100644
--- a/doc/flex.texi
+++ b/doc/flex.texi
@@ -80,204 +80,204 @@ This edition of @cite{The flex Manual} documents @code{flex} version
This manual was written by @value{authors}.
@menu
-* Copyright::
-* Reporting Bugs::
-* Introduction::
-* Simple Examples::
-* Format::
-* Patterns::
-* Matching::
-* Actions::
-* Generated Scanner::
-* Start Conditions::
-* Multiple Input Buffers::
-* EOF::
-* Misc Macros::
-* User Values::
-* Yacc::
-* Scanner Options::
-* Performance::
-* Cxx::
-* Reentrant::
-* Lex and Posix::
-* Memory Management::
-* Serialized Tables::
-* Diagnostics::
-* Limitations::
-* Bibliography::
-* FAQ::
-* Appendices::
-* Indices::
+* Copyright::
+* Reporting Bugs::
+* Introduction::
+* Simple Examples::
+* Format::
+* Patterns::
+* Matching::
+* Actions::
+* Generated Scanner::
+* Start Conditions::
+* Multiple Input Buffers::
+* EOF::
+* Misc Macros::
+* User Values::
+* Yacc::
+* Scanner Options::
+* Performance::
+* Cxx::
+* Reentrant::
+* Lex and Posix::
+* Memory Management::
+* Serialized Tables::
+* Diagnostics::
+* Limitations::
+* Bibliography::
+* FAQ::
+* Appendices::
+* Indices::
@detailmenu
--- The Detailed Node Listing ---
Format of the Input File
-* Definitions Section::
-* Rules Section::
-* User Code Section::
-* Comments in the Input::
+* Definitions Section::
+* Rules Section::
+* User Code Section::
+* Comments in the Input::
Scanner Options
-* Options for Specifying Filenames::
-* Options Affecting Scanner Behavior::
-* Code-Level And API Options::
-* Options for Scanner Speed and Size::
-* Debugging Options::
-* Miscellaneous Options::
+* Options for Specifying Filenames::
+* Options Affecting Scanner Behavior::
+* Code-Level And API Options::
+* Options for Scanner Speed and Size::
+* Debugging Options::
+* Miscellaneous Options::
Reentrant C Scanners
-* Reentrant Uses::
-* Reentrant Overview::
-* Reentrant Example::
-* Reentrant Detail::
-* Reentrant Functions::
+* Reentrant Uses::
+* Reentrant Overview::
+* Reentrant Example::
+* Reentrant Detail::
+* Reentrant Functions::
The Reentrant API in Detail
-* Specify Reentrant::
-* Extra Reentrant Argument::
-* Global Replacement::
-* Init and Destroy Functions::
-* Accessor Methods::
-* Extra Data::
-* About yyscan_t::
+* Specify Reentrant::
+* Extra Reentrant Argument::
+* Global Replacement::
+* Init and Destroy Functions::
+* Accessor Methods::
+* Extra Data::
+* About yyscan_t::
Memory Management
-* The Default Memory Management::
-* Overriding The Default Memory Management::
-* A Note About yytext And Memory::
+* The Default Memory Management::
+* Overriding The Default Memory Management::
+* A Note About yytext And Memory::
Serialized Tables
-* Creating Serialized Tables::
-* Loading and Unloading Serialized Tables::
-* Tables File Format::
+* Creating Serialized Tables::
+* Loading and Unloading Serialized Tables::
+* Tables File Format::
FAQ
-* When was flex born?::
-* How do I expand backslash-escape sequences in C-style quoted strings?::
-* Why do flex scanners call fileno if it is not ANSI compatible?::
-* Does flex support recursive pattern definitions?::
-* How do I skip huge chunks of input (tens of megabytes) while using flex?::
-* Flex is not matching my patterns in the same order that I defined them.::
-* My actions are executing out of order or sometimes not at all.::
-* How can I have multiple input sources feed into the same scanner at the same time?::
-* Can I build nested parsers that work with the same input file?::
-* How can I match text only at the end of a file?::
-* How can I make REJECT cascade across start condition boundaries?::
-* Why cant I use fast or full tables with interactive mode?::
-* How much faster is -F or -f than -C?::
-* If I have a simple grammar cant I just parse it with flex?::
-* Why doesn't yyrestart() set the start state back to INITIAL?::
-* How can I match C-style comments?::
-* The period isn't working the way I expected.::
-* Can I get the flex manual in another format?::
-* Does there exist a "faster" NDFA->DFA algorithm?::
-* How does flex compile the DFA so quickly?::
-* How can I use more than 8192 rules?::
-* How do I abandon a file in the middle of a scan and switch to a new file?::
-* How do I execute code only during initialization (only before the first scan)?::
-* How do I execute code at termination?::
-* Where else can I find help?::
-* Can I include comments in the "rules" section of the file?::
-* I get an error about undefined yywrap().::
-* How can I change the matching pattern at run time?::
-* How can I expand macros in the input?::
-* How can I build a two-pass scanner?::
-* How do I match any string not matched in the preceding rules?::
-* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::
-* Is there a way to make flex treat NULL like a regular character?::
-* Whenever flex can not match the input it says "flex scanner jammed".::
-* Why doesn't flex have non-greedy operators like perl does?::
-* Memory leak - 16386 bytes allocated by malloc.::
-* How do I track the byte offset for lseek()?::
-* How do I use my own I/O classes in a C++ scanner?::
-* How do I skip as many chars as possible?::
-* deleteme00::
-* Are certain equivalent patterns faster than others?::
-* Is backing up a big deal?::
-* Can I fake multi-byte character support?::
-* deleteme01::
-* Can you discuss some flex internals?::
-* unput() messes up yy_at_bol::
-* The | operator is not doing what I want::
-* Why can't flex understand this variable trailing context pattern?::
-* The ^ operator isn't working::
-* Trailing context is getting confused with trailing optional patterns::
-* Is flex GNU or not?::
-* ERASEME53::
-* I need to scan if-then-else blocks and while loops::
-* ERASEME55::
-* ERASEME56::
-* ERASEME57::
-* Is there a repository for flex scanners?::
-* How can I conditionally compile or preprocess my flex input file?::
-* Where can I find grammars for lex and yacc?::
-* I get an end-of-buffer message for each character scanned.::
-* unnamed-faq-62::
-* unnamed-faq-63::
-* unnamed-faq-64::
-* unnamed-faq-65::
-* unnamed-faq-66::
-* unnamed-faq-67::
-* unnamed-faq-68::
-* unnamed-faq-69::
-* unnamed-faq-70::
-* unnamed-faq-71::
-* unnamed-faq-72::
-* unnamed-faq-73::
-* unnamed-faq-74::
-* unnamed-faq-75::
-* unnamed-faq-76::
-* unnamed-faq-77::
-* unnamed-faq-78::
-* unnamed-faq-79::
-* unnamed-faq-80::
-* unnamed-faq-81::
-* unnamed-faq-82::
-* unnamed-faq-83::
-* unnamed-faq-84::
-* unnamed-faq-85::
-* unnamed-faq-86::
-* unnamed-faq-87::
-* unnamed-faq-88::
-* unnamed-faq-90::
-* unnamed-faq-91::
-* unnamed-faq-92::
-* unnamed-faq-93::
-* unnamed-faq-94::
-* unnamed-faq-95::
-* unnamed-faq-96::
-* unnamed-faq-97::
-* unnamed-faq-98::
-* unnamed-faq-99::
-* unnamed-faq-100::
-* unnamed-faq-101::
+* When was flex born?::
+* How do I expand backslash-escape sequences in C-style quoted strings?::
+* Why do flex scanners call fileno if it is not ANSI compatible?::
+* Does flex support recursive pattern definitions?::
+* How do I skip huge chunks of input (tens of megabytes) while using flex?::
+* Flex is not matching my patterns in the same order that I defined them.::
+* My actions are executing out of order or sometimes not at all.::
+* How can I have multiple input sources feed into the same scanner at the same time?::
+* Can I build nested parsers that work with the same input file?::
+* How can I match text only at the end of a file?::
+* How can I make REJECT cascade across start condition boundaries?::
+* Why cant I use fast or full tables with interactive mode?::
+* How much faster is -F or -f than -C?::
+* If I have a simple grammar cant I just parse it with flex?::
+* Why doesn't yyrestart() set the start state back to INITIAL?::
+* How can I match C-style comments?::
+* The period isn't working the way I expected.::
+* Can I get the flex manual in another format?::
+* Does there exist a "faster" NDFA->DFA algorithm?::
+* How does flex compile the DFA so quickly?::
+* How can I use more than 8192 rules?::
+* How do I abandon a file in the middle of a scan and switch to a new file?::
+* How do I execute code only during initialization (only before the first scan)?::
+* How do I execute code at termination?::
+* Where else can I find help?::
+* Can I include comments in the "rules" section of the file?::
+* I get an error about undefined yywrap().::
+* How can I change the matching pattern at run time?::
+* How can I expand macros in the input?::
+* How can I build a two-pass scanner?::
+* How do I match any string not matched in the preceding rules?::
+* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::
+* Is there a way to make flex treat NULL like a regular character?::
+* Whenever flex can not match the input it says "flex scanner jammed".::
+* Why doesn't flex have non-greedy operators like perl does?::
+* Memory leak - 16386 bytes allocated by malloc.::
+* How do I track the byte offset for lseek()?::
+* How do I use my own I/O classes in a C++ scanner?::
+* How do I skip as many chars as possible?::
+* deleteme00::
+* Are certain equivalent patterns faster than others?::
+* Is backing up a big deal?::
+* Can I fake multi-byte character support?::
+* deleteme01::
+* Can you discuss some flex internals?::
+* unput() messes up yy_at_bol::
+* The | operator is not doing what I want::
+* Why can't flex understand this variable trailing context pattern?::
+* The ^ operator isn't working::
+* Trailing context is getting confused with trailing optional patterns::
+* Is flex GNU or not?::
+* ERASEME53::
+* I need to scan if-then-else blocks and while loops::
+* ERASEME55::
+* ERASEME56::
+* ERASEME57::
+* Is there a repository for flex scanners?::
+* How can I conditionally compile or preprocess my flex input file?::
+* Where can I find grammars for lex and yacc?::
+* I get an end-of-buffer message for each character scanned.::
+* unnamed-faq-62::
+* unnamed-faq-63::
+* unnamed-faq-64::
+* unnamed-faq-65::
+* unnamed-faq-66::
+* unnamed-faq-67::
+* unnamed-faq-68::
+* unnamed-faq-69::
+* unnamed-faq-70::
+* unnamed-faq-71::
+* unnamed-faq-72::
+* unnamed-faq-73::
+* unnamed-faq-74::
+* unnamed-faq-75::
+* unnamed-faq-76::
+* unnamed-faq-77::
+* unnamed-faq-78::
+* unnamed-faq-79::
+* unnamed-faq-80::
+* unnamed-faq-81::
+* unnamed-faq-82::
+* unnamed-faq-83::
+* unnamed-faq-84::
+* unnamed-faq-85::
+* unnamed-faq-86::
+* unnamed-faq-87::
+* unnamed-faq-88::
+* unnamed-faq-90::
+* unnamed-faq-91::
+* unnamed-faq-92::
+* unnamed-faq-93::
+* unnamed-faq-94::
+* unnamed-faq-95::
+* unnamed-faq-96::
+* unnamed-faq-97::
+* unnamed-faq-98::
+* unnamed-faq-99::
+* unnamed-faq-100::
+* unnamed-faq-101::
* What is the difference between YYLEX_PARAM and YY_DECL?::
* Why do I get "conflicting types for yylex" error?::
* How do I access the values set in a Flex action from within a Bison action?::
Appendices
-* Makefiles and Flex::
-* Bison Bridge::
-* M4 Dependency::
-* Common Patterns::
+* Makefiles and Flex::
+* Bison Bridge::
+* M4 Dependency::
+* Common Patterns::
Indices
-* Concept Index::
-* Index of Functions and Macros::
-* Index of Variables::
-* Index of Data Types::
-* Index of Hooks::
-* Index of Scanner Options::
+* Concept Index::
+* Index of Functions and Macros::
+* Index of Variables::
+* Index of Data Types::
+* Index of Hooks::
+* Index of Scanner Options::
@end detailmenu
@end menu
@@ -461,10 +461,10 @@ line containing only @samp{%%}.
@end example
@menu
-* Definitions Section::
-* Rules Section::
-* User Code Section::
-* Comments in the Input::
+* Definitions Section::
+* Rules Section::
+* User Code Section::
+* Comments in the Input::
@end menu
@node Definitions Section, Rules Section, Format, Format
@@ -542,7 +542,7 @@ themselves.
A @code{%top} block is similar to a @samp{%@{} ... @samp{%@}} block, except
that the code in a @code{%top} block is relocated to the @emph{top} of the
generated file, before any flex definitions @footnote{Actually,
-@code{yyIN_HEADER} is defined before the @samp{%top} block.}.
+@code{yyIN_HEADER} is defined before the @samp{%top} block.}.
The @code{%top} block is useful when you want certain preprocessor macros to be
defined or certain files to be included before the generated code.
The single characters, @samp{@{} and @samp{@}} are used to delimit the
@@ -759,7 +759,7 @@ Options may be zero or more of the characters @samp{i}, @samp{s}, or @samp{x}.
@samp{-s} alters the meaning of @samp{.} to match any byte except @samp{\n}.
@samp{x} ignores comments and whitespace in patterns. Whitespace is ignored unless
-it is backslash-escaped, contained within @samp{""}s, or appears inside a
+it is backslash-escaped, contained within @samp{""}s, or appears inside a
character class.
The following are all valid:
@@ -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:
@@ -930,7 +930,7 @@ For example, the following character classes are all equivalent:
@end verbatim
@end example
-A word of caution. Character classes are expanded immediately when seen in the @code{flex} input.
+A word of caution. Character classes are expanded immediately when seen in the @code{flex} input.
This means the character classes are sensitive to the locale in which @code{flex}
is executed, and the resulting scanner will not be sensitive to the runtime locale.
This may or may not be desirable.
@@ -1404,7 +1404,7 @@ example, the following is one way to eat up C comments:
@verbatim
%%
"/*" {
- register int c;
+ int c;
for ( ; ; )
{
@@ -1499,7 +1499,7 @@ definitions prevent us from using any standard data types smaller than
int (such as short, char, or bool) as function arguments. For this
reason, future versions of @code{flex} may generate standard C99 code
only, leaving K&R-style functions to the historians. Currently, if you
-do @strong{not} want @samp{C99} definitions, then you must use
+do @strong{not} want @samp{C99} definitions, then you must use
@code{%option noansi-definitions}.
@cindex stdin, default for yyin
@@ -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
@@ -2062,7 +2061,7 @@ This function pushes the new buffer state onto an internal stack. The pushed
state becomes the new current state. The stack is maintained by flex and will
grow as required. This function is intended to be used instead of
@code{yy_switch_to_buffer}, when you want to change states, but preserve the
-current state for later use.
+current state for later use.
@cindex popping an input buffer
@cindex stack, input buffer pop
@@ -2489,12 +2488,12 @@ The various @code{flex} options are categorized by function in the following
menu. If you want to lookup a particular option by name, @xref{Index of Scanner Options}.
@menu
-* Options for Specifying Filenames::
-* Options Affecting Scanner Behavior::
-* Code-Level And API Options::
-* Options for Scanner Speed and Size::
-* Debugging Options::
-* Miscellaneous Options::
+* Options for Specifying Filenames::
+* Options Affecting Scanner Behavior::
+* Code-Level And API Options::
+* Options for Scanner Speed and Size::
+* Debugging Options::
+* Miscellaneous Options::
@end menu
Even though there are many scanner options, a typical scanner might only
@@ -2624,7 +2623,7 @@ This option is for flex development. We document it here in case you stumble
upon it by accident or in case you suspect some inconsistency in the serialized
tables. Flex will serialize the scanner dfa tables but will also generate the
in-code tables as it normally does. At runtime, the scanner will verify that
-the serialized tables match the in-code tables, instead of loading them.
+the serialized tables match the in-code tables, instead of loading them.
@end table
@@ -2871,7 +2870,7 @@ is generated.
@opindex ---option-ansi-prototypes
@opindex ansi-prototypes
@item --ansi-prototypes, @code{%option ansi-prototypes}
-instructs flex to generate ANSI C99 prototypes for functions.
+instructs flex to generate ANSI C99 prototypes for functions.
This option is enabled by default.
If @code{noansi-prototypes} is specified, then
prototypes will have empty parameter lists.
@@ -2895,7 +2894,7 @@ is modified to take an additional parameter,
@opindex ---bison-locations
@opindex bison-locations
@item --bison-locations, @code{%option bison-locations}
-instruct flex that
+instruct flex that
@code{GNU bison} @code{%locations} are being used.
This means @code{yylex} will be passed
an additional parameter, @code{yylloc}. This option
@@ -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;
@@ -3986,11 +3992,11 @@ multi-threaded applications. Any thread may create and execute a reentrant
@code{flex} scanner without the need for synchronization with other threads.
@menu
-* Reentrant Uses::
-* Reentrant Overview::
-* Reentrant Example::
-* Reentrant Detail::
-* Reentrant Functions::
+* Reentrant Uses::
+* Reentrant Overview::
+* Reentrant Example::
+* Reentrant Detail::
+* Reentrant Functions::
@end menu
@node Reentrant Uses, Reentrant Overview, Reentrant, Reentrant
@@ -4121,13 +4127,13 @@ Here are the things you need to do or know to use the reentrant C API of
@code{flex}.
@menu
-* Specify Reentrant::
-* Extra Reentrant Argument::
-* Global Replacement::
-* Init and Destroy Functions::
-* Accessor Methods::
-* Extra Data::
-* About yyscan_t::
+* Specify Reentrant::
+* Extra Reentrant Argument::
+* Global Replacement::
+* Init and Destroy Functions::
+* Accessor Methods::
+* Extra Data::
+* About yyscan_t::
@end menu
@node Specify Reentrant, Extra Reentrant Argument, Reentrant Detail, Reentrant Detail
@@ -4363,7 +4369,7 @@ be accessed from within the very first yyalloc, used to allocate
the scanner itself.
By default, @code{YY_EXTRA_TYPE} is defined as type @code{void *}. You
-may redefine this type using @code{%option extra-type="your_type"} in
+may redefine this type using @code{%option extra-type="your_type"} in
the scanner:
@cindex YY_EXTRA_TYPE, defining your own type
@@ -4778,9 +4784,9 @@ This chapter describes how flex handles dynamic memory, and how you can
override the default behavior.
@menu
-* The Default Memory Management::
-* Overriding The Default Memory Management::
-* A Note About yytext And Memory::
+* The Default Memory Management::
+* Overriding The Default Memory Management::
+* A Note About yytext And Memory::
@end menu
@node The Default Memory Management, Overriding The Default Memory Management, Memory Management, Memory Management
@@ -4794,7 +4800,7 @@ buffer. As of version 2.5.9 Flex will clean up all memory when you call @code{yy
Flex allocates dynamic memory for four purposes, listed below @footnote{The
quantities given here are approximate, and may vary due to host architecture,
-compiler configuration, or due to future enhancements to flex.}
+compiler configuration, or due to future enhancements to flex.}
@table @asis
@@ -4809,7 +4815,7 @@ buffer is the length of the longest token expected, in bytes, plus a little more
extra bytes for housekeeping. Currently, to override the size of the input buffer
you must @code{#define YY_BUF_SIZE} to whatever number of bytes you want. We don't plan
to change this in the near future, but we reserve the right to do so if we ever add a more robust memory management
-API.
+API.
@item 64kb for the REJECT state. This will only be allocated if you use REJECT.
The size is large enough to hold the same number of states as characters in the input buffer. If you override the size of the
@@ -4911,8 +4917,10 @@ custom allocator through @code{yyextra}.
%option reentrant
/* Initialize the allocator. */
+n%{
#define YY_EXTRA_TYPE struct allocator*
#define YY_USER_INIT yyextra = allocator_create();
+%}
%%
.|\n ;
@@ -4927,7 +4935,7 @@ void * yyrealloc (void * ptr, size_t bytes, void* yyscanner) {
return allocator_realloc (yyextra, bytes);
}
-void yyfree (void * ptr, void * yyscanner) {
+void yyfree (void * ptr, void * yyscanner) {
/* Do nothing -- we leave it to the garbage collector. */
}
@@ -4975,9 +4983,9 @@ The serialization feature allows the tables to be loaded at runtime, before
scanning begins. The tables may be discarded when scanning is finished.
@menu
-* Creating Serialized Tables::
-* Loading and Unloading Serialized Tables::
-* Tables File Format::
+* Creating Serialized Tables::
+* Loading and Unloading Serialized Tables::
+* Tables File Format::
@end menu
@node Creating Serialized Tables, Loading and Unloading Serialized Tables, Serialized Tables, Serialized Tables
@@ -4998,7 +5006,7 @@ or
These options instruct flex to save the DFA tables to the file @var{FILE}. The tables
will @emph{not} be embedded in the generated scanner. The scanner will not
function on its own. The scanner will be dependent upon the serialized tables. You must
-load the tables from this file at runtime before you can scan anything.
+load the tables from this file at runtime before you can scan anything.
If you do not specify a filename to @code{--tables-file}, the tables will be
saved to @file{lex.yy.tables}, where @samp{yy} is the appropriate prefix.
@@ -5115,7 +5123,7 @@ and tables sections are padded to 64-bit boundaries. Below we describe each
field in detail. This format does not specify how the scanner will expand the
given data, i.e., data may be serialized as int8, but expanded to an int32
array at runtime. This is to reduce the size of the serialized data where
-possible. Remember, @emph{all integer values are in network byte order}.
+possible. Remember, @emph{all integer values are in network byte order}.
@noindent
Fields of a table header:
@@ -5407,105 +5415,105 @@ questions. Rather than repeat answers to well-understood problems, we
publish them here.
@menu
-* When was flex born?::
-* How do I expand backslash-escape sequences in C-style quoted strings?::
-* Why do flex scanners call fileno if it is not ANSI compatible?::
-* Does flex support recursive pattern definitions?::
-* How do I skip huge chunks of input (tens of megabytes) while using flex?::
-* Flex is not matching my patterns in the same order that I defined them.::
-* My actions are executing out of order or sometimes not at all.::
-* How can I have multiple input sources feed into the same scanner at the same time?::
-* Can I build nested parsers that work with the same input file?::
-* How can I match text only at the end of a file?::
-* How can I make REJECT cascade across start condition boundaries?::
-* Why cant I use fast or full tables with interactive mode?::
-* How much faster is -F or -f than -C?::
-* If I have a simple grammar cant I just parse it with flex?::
-* Why doesn't yyrestart() set the start state back to INITIAL?::
-* How can I match C-style comments?::
-* The period isn't working the way I expected.::
-* Can I get the flex manual in another format?::
-* Does there exist a "faster" NDFA->DFA algorithm?::
-* How does flex compile the DFA so quickly?::
-* How can I use more than 8192 rules?::
-* How do I abandon a file in the middle of a scan and switch to a new file?::
-* How do I execute code only during initialization (only before the first scan)?::
-* How do I execute code at termination?::
-* Where else can I find help?::
-* Can I include comments in the "rules" section of the file?::
-* I get an error about undefined yywrap().::
-* How can I change the matching pattern at run time?::
-* How can I expand macros in the input?::
-* How can I build a two-pass scanner?::
-* How do I match any string not matched in the preceding rules?::
-* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::
-* Is there a way to make flex treat NULL like a regular character?::
-* Whenever flex can not match the input it says "flex scanner jammed".::
-* Why doesn't flex have non-greedy operators like perl does?::
-* Memory leak - 16386 bytes allocated by malloc.::
-* How do I track the byte offset for lseek()?::
-* How do I use my own I/O classes in a C++ scanner?::
-* How do I skip as many chars as possible?::
-* deleteme00::
-* Are certain equivalent patterns faster than others?::
-* Is backing up a big deal?::
-* Can I fake multi-byte character support?::
-* deleteme01::
-* Can you discuss some flex internals?::
-* unput() messes up yy_at_bol::
-* The | operator is not doing what I want::
-* Why can't flex understand this variable trailing context pattern?::
-* The ^ operator isn't working::
-* Trailing context is getting confused with trailing optional patterns::
-* Is flex GNU or not?::
-* ERASEME53::
-* I need to scan if-then-else blocks and while loops::
-* ERASEME55::
-* ERASEME56::
-* ERASEME57::
-* Is there a repository for flex scanners?::
-* How can I conditionally compile or preprocess my flex input file?::
-* Where can I find grammars for lex and yacc?::
-* I get an end-of-buffer message for each character scanned.::
-* unnamed-faq-62::
-* unnamed-faq-63::
-* unnamed-faq-64::
-* unnamed-faq-65::
-* unnamed-faq-66::
-* unnamed-faq-67::
-* unnamed-faq-68::
-* unnamed-faq-69::
-* unnamed-faq-70::
-* unnamed-faq-71::
-* unnamed-faq-72::
-* unnamed-faq-73::
-* unnamed-faq-74::
-* unnamed-faq-75::
-* unnamed-faq-76::
-* unnamed-faq-77::
-* unnamed-faq-78::
-* unnamed-faq-79::
-* unnamed-faq-80::
-* unnamed-faq-81::
-* unnamed-faq-82::
-* unnamed-faq-83::
-* unnamed-faq-84::
-* unnamed-faq-85::
-* unnamed-faq-86::
-* unnamed-faq-87::
-* unnamed-faq-88::
-* unnamed-faq-90::
-* unnamed-faq-91::
-* unnamed-faq-92::
-* unnamed-faq-93::
-* unnamed-faq-94::
-* unnamed-faq-95::
-* unnamed-faq-96::
-* unnamed-faq-97::
-* unnamed-faq-98::
-* unnamed-faq-99::
-* unnamed-faq-100::
-* unnamed-faq-101::
+* When was flex born?::
+* How do I expand backslash-escape sequences in C-style quoted strings?::
+* Why do flex scanners call fileno if it is not ANSI compatible?::
+* Does flex support recursive pattern definitions?::
+* How do I skip huge chunks of input (tens of megabytes) while using flex?::
+* Flex is not matching my patterns in the same order that I defined them.::
+* My actions are executing out of order or sometimes not at all.::
+* How can I have multiple input sources feed into the same scanner at the same time?::
+* Can I build nested parsers that work with the same input file?::
+* How can I match text only at the end of a file?::
+* How can I make REJECT cascade across start condition boundaries?::
+* Why cant I use fast or full tables with interactive mode?::
+* How much faster is -F or -f than -C?::
+* If I have a simple grammar cant I just parse it with flex?::
+* Why doesn't yyrestart() set the start state back to INITIAL?::
+* How can I match C-style comments?::
+* The period isn't working the way I expected.::
+* Can I get the flex manual in another format?::
+* Does there exist a "faster" NDFA->DFA algorithm?::
+* How does flex compile the DFA so quickly?::
+* How can I use more than 8192 rules?::
+* How do I abandon a file in the middle of a scan and switch to a new file?::
+* How do I execute code only during initialization (only before the first scan)?::
+* How do I execute code at termination?::
+* Where else can I find help?::
+* Can I include comments in the "rules" section of the file?::
+* I get an error about undefined yywrap().::
+* How can I change the matching pattern at run time?::
+* How can I expand macros in the input?::
+* How can I build a two-pass scanner?::
+* How do I match any string not matched in the preceding rules?::
+* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::
+* Is there a way to make flex treat NULL like a regular character?::
+* Whenever flex can not match the input it says "flex scanner jammed".::
+* Why doesn't flex have non-greedy operators like perl does?::
+* Memory leak - 16386 bytes allocated by malloc.::
+* How do I track the byte offset for lseek()?::
+* How do I use my own I/O classes in a C++ scanner?::
+* How do I skip as many chars as possible?::
+* deleteme00::
+* Are certain equivalent patterns faster than others?::
+* Is backing up a big deal?::
+* Can I fake multi-byte character support?::
+* deleteme01::
+* Can you discuss some flex internals?::
+* unput() messes up yy_at_bol::
+* The | operator is not doing what I want::
+* Why can't flex understand this variable trailing context pattern?::
+* The ^ operator isn't working::
+* Trailing context is getting confused with trailing optional patterns::
+* Is flex GNU or not?::
+* ERASEME53::
+* I need to scan if-then-else blocks and while loops::
+* ERASEME55::
+* ERASEME56::
+* ERASEME57::
+* Is there a repository for flex scanners?::
+* How can I conditionally compile or preprocess my flex input file?::
+* Where can I find grammars for lex and yacc?::
+* I get an end-of-buffer message for each character scanned.::
+* unnamed-faq-62::
+* unnamed-faq-63::
+* unnamed-faq-64::
+* unnamed-faq-65::
+* unnamed-faq-66::
+* unnamed-faq-67::
+* unnamed-faq-68::
+* unnamed-faq-69::
+* unnamed-faq-70::
+* unnamed-faq-71::
+* unnamed-faq-72::
+* unnamed-faq-73::
+* unnamed-faq-74::
+* unnamed-faq-75::
+* unnamed-faq-76::
+* unnamed-faq-77::
+* unnamed-faq-78::
+* unnamed-faq-79::
+* unnamed-faq-80::
+* unnamed-faq-81::
+* unnamed-faq-82::
+* unnamed-faq-83::
+* unnamed-faq-84::
+* unnamed-faq-85::
+* unnamed-faq-86::
+* unnamed-faq-87::
+* unnamed-faq-88::
+* unnamed-faq-90::
+* unnamed-faq-91::
+* unnamed-faq-92::
+* unnamed-faq-93::
+* unnamed-faq-94::
+* unnamed-faq-95::
+* unnamed-faq-96::
+* unnamed-faq-97::
+* unnamed-faq-98::
+* unnamed-faq-99::
+* unnamed-faq-100::
+* unnamed-faq-101::
* What is the difference between YYLEX_PARAM and YY_DECL?::
* Why do I get "conflicting types for yylex" error?::
* How do I access the values set in a Flex action from within a Bison action?::
@@ -8154,10 +8162,10 @@ See @ref{Top, , , bison, the GNU Bison Manual}.
@appendix Appendices
@menu
-* Makefiles and Flex::
-* Bison Bridge::
-* M4 Dependency::
-* Common Patterns::
+* Makefiles and Flex::
+* Bison Bridge::
+* M4 Dependency::
+* Common Patterns::
@end menu
@node Makefiles and Flex, Bison Bridge, Appendices, Appendices
@@ -8387,13 +8395,13 @@ code from unwanted @code{m4} processing.
@itemize
@item Do not use symbols that begin with, @samp{m4_}, such as, @samp{m4_define},
-or @samp{m4_include}, since those are reserved for @code{m4} macro names. If for
+or @samp{m4_include}, since those are reserved for @code{m4} macro names. If for
some reason you need m4_ as a prefix, use a preprocessor #define to get your
symbol past m4 unmangled.
@item Do not use the strings @samp{[[} or @samp{]]} anywhere in your code. The
former is not valid in C, except within comments and strings, but the latter is valid in
-code such as @code{x[y[z]]}. The solution is simple. To get the literal string
+code such as @code{x[y[z]]}. The solution is simple. To get the literal string
@code{"]]"}, use @code{"]""]"}. To get the array notation @code{x[y[z]]},
use @code{x[y[z] ]}. Flex will attempt to detect these sequences in user code, and
escape them. However, it's best to avoid this complexity where possible, by
@@ -8412,10 +8420,10 @@ This appendix provides examples of common regular expressions you might use
in your scanner.
@menu
-* Numbers::
-* Identifiers::
-* Quoted Constructs::
-* Addresses::
+* Numbers::
+* Identifiers::
+* Quoted Constructs::
+* Addresses::
@end menu
@@ -8556,12 +8564,12 @@ to appear in a URI, including spaces and control characters. See
@unnumbered Indices
@menu
-* Concept Index::
-* Index of Functions and Macros::
-* Index of Variables::
-* Index of Data Types::
-* Index of Hooks::
-* Index of Scanner Options::
+* Concept Index::
+* Index of Functions and Macros::
+* Index of Variables::
+* Index of Data Types::
+* Index of Hooks::
+* Index of Scanner Options::
@end menu
@node Concept Index, Index of Functions and Macros, Indices, Indices