Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
227e731b76 | ||
|
|
4d6089fc83 | ||
|
|
114cc57e7f | ||
|
|
957471b78e | ||
|
|
f17e4fd073 |
+23
@@ -0,0 +1,23 @@
|
||||
*.orig
|
||||
*.rej
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
*.tar.xz
|
||||
*~
|
||||
.deps
|
||||
.libs
|
||||
ABOUT-NLS
|
||||
ChangeLog
|
||||
INSTALL
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
flex-*/
|
||||
libtool
|
||||
stamp-*
|
||||
m4/
|
||||
build-aux/
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
--blank-lines-after-declarations
|
||||
--blank-lines-after-procedures
|
||||
-br /* open braces on same line */
|
||||
-nce /* start else on new line */
|
||||
-nbc /* vars on same line */
|
||||
-di8 /* line up var decl at col 8 */
|
||||
-brs /* struct brace on same line */
|
||||
-i8 /* indent 4 */
|
||||
-lp /* line up parens */
|
||||
-ts8 /* tab stop */
|
||||
-bbo /* break before && || */
|
||||
-hnl /* honor newlines */
|
||||
--space-special-semicolon
|
||||
--line-length75
|
||||
--dont-break-procedure-type
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
In 2001, Will Estes took over as maintainer of flex.
|
||||
|
||||
John Millaway is a co-author of the current version of flex. He has
|
||||
contributed a large number of new features, fixed a large number of
|
||||
outstanding bugs and has made significant contributions to the flex
|
||||
documentation.
|
||||
|
||||
Aaron Stone has contributed several bug fixes to the flex codebase.
|
||||
|
||||
Vern Paxson wrote flex with the help of many ideas and much
|
||||
inspiration from Van Jacobson. Original version by Jef Poskanzer.
|
||||
|
||||
The fast table representation is a partial implementation of a design
|
||||
done by Van Jacobson. The implementation was done by Kevin Gong and
|
||||
Vern Paxson.
|
||||
@@ -0,0 +1,107 @@
|
||||
This is a list of bugs still in the queue at lex.sf.net at the time we closed
|
||||
out the project and moved it to flex.sf.net.
|
||||
|
||||
-------------------------------------------------------------
|
||||
|
||||
Some strict compilers warn about a few internal flex variables signedness. They
|
||||
are bogus warnings and can be ignored, but people send in reports nonethless.
|
||||
|
||||
-------------------------------------------------------------
|
||||
|
||||
The initializer of the yy_transition array in the
|
||||
generated scanner
|
||||
contains fewer entries than the declared size of the array.
|
||||
|
||||
Examples include yy_transition[6504] with 6250 entries,
|
||||
yy_transition[13215] with 12961 entries. This looks
|
||||
like it
|
||||
is always 254 fewer entries than the declared size.
|
||||
|
||||
This bug is present in flex 2.5.4a as well. It appears to be harmless.
|
||||
|
||||
-------------------------------------------------------------
|
||||
The examples in the chapter "Generating C++ Scanners"
|
||||
contain suspicious code. Attached is a patch that
|
||||
corrects this, and after these
|
||||
modifications this example compiles and works.
|
||||
|
||||
-------------------------------------------------------------
|
||||
|
||||
C++ scanners derived from the yyFlexLexer base class
|
||||
will not compile with flex-2.5.31 because the
|
||||
<FlexLexer.h> automatically gets included into the
|
||||
scanner twice. Because yyFlexLexer is now defined by
|
||||
default even if no prefix is specified, including
|
||||
FlexLexer.h twice causes the class yyFlexLexer to be
|
||||
declared twice. In flex-2.5.4 because yyFlexLexer was
|
||||
not defined by flex in the scanner code, including
|
||||
FlexLexer.h more than once only declared yyFlexLexer
|
||||
once. I appreciate that this is because of the M4
|
||||
additions to flex, but I can not find a way to stop
|
||||
flex defining yyFlexLexer if it is not needed.
|
||||
|
||||
Here is an example of a class that will not compile:
|
||||
|
||||
derived_lexer.h:
|
||||
|
||||
#ifndef __derived_lexer__
|
||||
#define __derived_lexer__
|
||||
|
||||
#include <FlexLexer.h>
|
||||
|
||||
class derived_lexer : public yyFlexLexer
|
||||
{
|
||||
public:
|
||||
derived_lexer(std::istream* arg_yyin = 0) :
|
||||
yyFlexLexer(arg_yyin){}
|
||||
int yylex();
|
||||
int x;
|
||||
};
|
||||
#endif
|
||||
|
||||
derived_lexer.l:
|
||||
|
||||
%{
|
||||
#include "derived_lexer.h"
|
||||
%}
|
||||
|
||||
%option yyclass="derived_lexer"
|
||||
|
||||
%%
|
||||
[0-9]+ {
|
||||
x = atoi(yytext);
|
||||
}
|
||||
%%
|
||||
|
||||
main.cpp:
|
||||
|
||||
#include "derived_lexer.h"
|
||||
#include <fstream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ifstream input;
|
||||
input.open("input");
|
||||
derived_lexer lexer(&input);
|
||||
lexer.yylex();
|
||||
}
|
||||
|
||||
-------------------------------------------------------------
|
||||
|
||||
Hi, the anomally is that if I generate a c++ parser it will not make
|
||||
yy_scan_buffer and friends.
|
||||
this is happenning on flex version 2.5.4.
|
||||
Is this the intent, if so how do I make a c++ parser read from my buffer?
|
||||
|
||||
P.S. in c++ it will only generate:
|
||||
#ifndef YY_NO_SCAN_BUFFER
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef YY_NO_SCAN_STRING
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef YY_NO_SCAN_BYTES
|
||||
#endif
|
||||
-------------------------------------------------------------
|
||||
@@ -0,0 +1,42 @@
|
||||
Flex carries the copyright used for BSD software, slightly modified
|
||||
because it originated at the Lawrence Berkeley (not Livermore!) Laboratory,
|
||||
which operates under a contract with the Department of Energy:
|
||||
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The Flex Project.
|
||||
|
||||
Copyright (c) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
This basically says "do whatever you please with this software except
|
||||
remove this notice or take advantage of the University's (or the flex
|
||||
authors') name".
|
||||
|
||||
Note that the "flex.skl" scanner skeleton carries no copyright notice.
|
||||
You are free to do whatever you please with scanners generated using flex;
|
||||
for them, you are not even bound by the above copyright.
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
# This file is part of flex.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
|
||||
# Notes on building:
|
||||
|
||||
# Possible values for DEFS:
|
||||
#
|
||||
# By default, flex generates 8-bit scanners when using table compression,
|
||||
# and 7-bit scanners when using uncompressed tables (-f or -F options).
|
||||
# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
|
||||
# to DEFS.
|
||||
#
|
||||
# For Vax/VMS, add "-DVMS" to DEFS.
|
||||
#
|
||||
# For MS-DOS, add "-DMS_DOS" to DEFS. See the directory MISC/MSDOS for
|
||||
# additional info.
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
indent = @INDENT@
|
||||
|
||||
dist_doc_DATA = \
|
||||
AUTHORS \
|
||||
COPYING \
|
||||
NEWS \
|
||||
ONEWS \
|
||||
README
|
||||
|
||||
EXTRA_DIST = \
|
||||
.indent.pro \
|
||||
autogen.sh
|
||||
|
||||
SUBDIRS = \
|
||||
lib \
|
||||
src \
|
||||
doc \
|
||||
examples \
|
||||
po \
|
||||
tests \
|
||||
tools
|
||||
|
||||
# Create the ChangeLog, but only if we're inside a git working directory
|
||||
|
||||
ChangeLog: $(srcdir)/tools/git2cl
|
||||
if [ -d $(srcdir)/.git ] ; then \
|
||||
$(srcdir)/tools/git2cl > $@ \
|
||||
; fi
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && \
|
||||
$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
|
||||
|
||||
.PHONY: ChangeLog tags indent
|
||||
@@ -0,0 +1,534 @@
|
||||
This is the file NEWS for the flex package. It records user -visible
|
||||
changes between releases of flex.
|
||||
|
||||
See the file COPYING for copying conditions.
|
||||
|
||||
* version 2.6.0-pre
|
||||
|
||||
* flex version 2.5.39 released 2014-03-26
|
||||
|
||||
** no user visible changes in this release
|
||||
|
||||
* version 2.5.38 released 2014-02-14
|
||||
|
||||
** internationalization
|
||||
|
||||
*** add sr translation from the translation project
|
||||
|
||||
*** update da, es, ko, nl, pt_BR, ro, ru, sv, tr, vi, zh_CN translations from the translation project
|
||||
|
||||
*** rename zh_tw to its proper zh_TW name
|
||||
|
||||
* version 2.5.37 released 2012-08-03
|
||||
|
||||
** Import flex into git. See
|
||||
git://flex.git.sourceforge.net/gitroot/flex/flex.
|
||||
|
||||
** Fix make install target to not fail when the flex++ program is
|
||||
already installed
|
||||
|
||||
** New translations from the translation project: de, fi, pl, vi
|
||||
|
||||
* version 2.5.36 released 2012-07-20
|
||||
|
||||
** various portability fixes that quiet compiler warnings on 64-bit
|
||||
hosts
|
||||
|
||||
** various manual fixes, including correcting the name of a %option and
|
||||
updating some simple examples to use ANSI C syntax
|
||||
|
||||
** various bug fixes that prevent certain error conditions from
|
||||
persisting when they should not persist
|
||||
|
||||
** improvements to the test suite so it behaves better when linking
|
||||
compiled files
|
||||
|
||||
** new translations from the translation project: ca, da, es, fi, fr,
|
||||
ga, ko, pt_br, ro, ru, sv, tr, zh_cn
|
||||
|
||||
** the flex distribution is now built with automake 1.10.1 and automake
|
||||
2.61
|
||||
|
||||
* version 2.5.35 released 2008-02-26
|
||||
|
||||
** fixed bug that prevented flex from accepting certain comments in the
|
||||
scanner file (resolves bugs #1849809 and #1849805)
|
||||
|
||||
** fix bug that prevented headers for all functions from being generated
|
||||
(resolves bug #1628314)
|
||||
|
||||
** change yy_size_t to be size_t (resolves bug #1849812)
|
||||
|
||||
** new de, nl, pl, pt_br, vi translations from the translation project
|
||||
|
||||
* version 2.5.34 released 2007-12-12
|
||||
|
||||
** introduce yylex_init_extra; see the manual for details
|
||||
|
||||
** introduce %option extra-type="your_type *" (resolves bug #1744505)
|
||||
|
||||
** The flex program now parses multiple short concatenated options (resolves bug
|
||||
#1619820). Thanks to Petr Machata of Red Hat on this issue.
|
||||
|
||||
** better checking after yyalloc/yyrealloc (resolves bug #1595967)
|
||||
|
||||
** flex now provides for a libfl_pic.a compiled with position
|
||||
independent code. Particularly useful when including a flex scanner
|
||||
in a shared library and with more recent versions of gcc. Thanks to the Debian project for the idea.
|
||||
|
||||
** SourceForge feature request #1658379: Expose YY_BUF_SIZE in the
|
||||
header file.
|
||||
|
||||
** flex better escapes filenames with special characters in them
|
||||
(resolves bug #1623600)
|
||||
|
||||
** a memory leak was plugged(resolves bug #1601111)
|
||||
|
||||
** pattern language expanded; see the manual for details on the below
|
||||
highlights
|
||||
|
||||
*** pattern options added to specify patterns as case-insensitive or
|
||||
case-sensitive
|
||||
|
||||
*** pattern options to specify whether the "." character should match
|
||||
the newline character
|
||||
|
||||
*** pattern options added to allow ignoring of whitespace in patterns
|
||||
|
||||
*** POSIX character classes may be negated in patterns
|
||||
|
||||
*** patterns may now use set difference, union operators
|
||||
|
||||
** the manual now contains an appendix listing various common patterns
|
||||
which may be useful when writing scanners
|
||||
|
||||
** some memory leaks were removed from the C++ scanner (but the C++
|
||||
scanner is still experimental and may change radically without
|
||||
notice)
|
||||
|
||||
** c++ scanners can now use yywrap
|
||||
|
||||
** added new unit test for c++ and yywrap
|
||||
|
||||
** portability fixes to some unit tests
|
||||
|
||||
** flex man page and flex manual in pdf now distributed in the flex
|
||||
distribution
|
||||
|
||||
** new ca, vi, ga, nl translations from the translation project
|
||||
|
||||
** flex no longer comes with an rpm spec file
|
||||
|
||||
** flex development now happens with automake 1.9.6
|
||||
|
||||
* version 2.5.33 released 2006-2-20
|
||||
|
||||
** all flex resources are now to be found from the website at
|
||||
http://flex.sourceforge.net/
|
||||
|
||||
** there was no release 2.5.32 published
|
||||
|
||||
** numerous bug and security fixes
|
||||
|
||||
** new nl, vi, sv, ro, po, ga, ca, fr, tr translations from the translation project
|
||||
|
||||
** upgrade to use gettext 0.12 (this now makes the "pdf" and "ps"
|
||||
targets in the build system able to be run successfully)
|
||||
|
||||
* version 2.5.31 released 2003-4-1
|
||||
|
||||
** remove --enable-maintainer-mode configure option; none of the
|
||||
Makefiles were using it and it can be unduely confusing
|
||||
|
||||
* version 2.5.30 released 2003-4-1
|
||||
|
||||
** yylineno is per-buffer in reentrant scanners
|
||||
|
||||
** added %top directive for placing code at the top of the generated
|
||||
scanner; see manual for details
|
||||
|
||||
** flex now uses m4 to generate scanners; while this means that
|
||||
scanners are more readable, it means that flex requires m4 to be
|
||||
installed; see manual for details
|
||||
|
||||
* version 2.5.29 released 2003-3-5
|
||||
|
||||
** Automatic stack management for multiple input buffers in C and C++ scanners
|
||||
|
||||
** moved the flex documentation to a new doc/ subdirectory
|
||||
|
||||
** cleanups to the yy namespace
|
||||
|
||||
* version 2.5.28 released 2003-2-12
|
||||
|
||||
** flex is now hosted at sourceforge
|
||||
|
||||
** Fixed trailing slash bug in YY_INPUT macro def
|
||||
|
||||
** Flex now warns if always-interactive is specified with fast or full
|
||||
|
||||
* version 2.5.27 released 2003-1-21
|
||||
|
||||
** flex now works with recent bison versions
|
||||
|
||||
** new pt_br translation from the translation project
|
||||
|
||||
* version 2.5.26 released 2003-1-14
|
||||
|
||||
** Fixed table deserialization bug on big-endian archs. Patch sent from Bryce Nichols <bryce@bnichols.org>
|
||||
|
||||
** yyleng has proper declarations now; this caused flex to generate
|
||||
unusable scanners for some programs
|
||||
|
||||
** the flex distribution now includes a spec file suitable for use
|
||||
with rpm
|
||||
|
||||
** some more c++ fixes
|
||||
|
||||
** new es translation from the translation project
|
||||
|
||||
** slight tweeks to the flex_int*_t types
|
||||
|
||||
** flex now warns about pattern ranges that might be ambiguous when
|
||||
generating a case-insensitive scanner
|
||||
|
||||
|
||||
* version 2.5.25 released 2002-12-2
|
||||
|
||||
** flex now uses flex_int*_t types. For C99 systems, they are just the
|
||||
int*_t types; for non-C99 systems, we just make some typedefs
|
||||
|
||||
** new pt_br translation from the translation project
|
||||
|
||||
* version 2.5.24 released 2002-11-25
|
||||
|
||||
* more portability fixes
|
||||
|
||||
** the manual continues to be updated and edited, but it's still got a
|
||||
ways to go
|
||||
|
||||
** it is possible to have multiple c++ scanners in the same program again
|
||||
|
||||
** new turkish translation from the translation project
|
||||
|
||||
* version 2.5.23 released 2002-10-21
|
||||
|
||||
** more portability fixes
|
||||
|
||||
** the manual includes a title page and a table-of-contents when printed
|
||||
|
||||
** the test suite can be run with "make check" from the top-level
|
||||
directory
|
||||
|
||||
** configure now accepts the --enable-maintainer-mode option
|
||||
|
||||
** gettext functionality is now only available externally
|
||||
|
||||
** the constant FLEX_BETA is defined if flex is a beta release
|
||||
|
||||
** the script create-test was not included in the distribution and it
|
||||
should have been
|
||||
|
||||
* version 2.5.22 released 2002-10-10
|
||||
|
||||
** more portability fixes around how we get ahold of the integral
|
||||
types; there is a constant FLEX_NEED_INTEGRAL_TYPE_DEFINITIONS
|
||||
which you should define if you don't have the <inttypes.h> header
|
||||
file (after you complain to your C vendor for not providing a
|
||||
reasonable C environment)
|
||||
|
||||
** more test suite cleanups; in particular, the test suite should run
|
||||
correctly when build from a different directory
|
||||
|
||||
** upgraded automake to 1.7 and consequently autoconf to 2.54; this
|
||||
means, among other things, that there is some support for
|
||||
formatting the manual in postscript and pdf in the distributed
|
||||
Makefile.in (and therefore in the Makefile built by configure)
|
||||
|
||||
** the flex.1 manpage is generated by help2man; (this has been true
|
||||
for quite a while but was not listed here)
|
||||
|
||||
** flex now includes three defined constants to indicate which version
|
||||
of flex generated a scanner (YY_FLEX_{MAJOR,MINOR,SUBMINOR}_VERSION)
|
||||
|
||||
** flex tries its best to output only the relevant portions of the
|
||||
skeleton when generating a scanner, thus avoiding as much
|
||||
conditional compilation as possible
|
||||
|
||||
* version 2.5.21 released 2002-9-17
|
||||
|
||||
** one of the tests in the test suite broke the dist target
|
||||
|
||||
* version 2.5.20 released 2002-9-16
|
||||
|
||||
** A flex scanner has the ability to save the DFA tables to a file,
|
||||
and load them at runtime when needed; see the manual for details
|
||||
|
||||
** Added %option bison-bridge (--bison-bridge)
|
||||
|
||||
** Removed %option reentrant-bison/--reentrant-bison/-Rb
|
||||
|
||||
** yylineno is present in all scanners; Modified nasty performance
|
||||
penalty warning with yylineno in documentation
|
||||
|
||||
** test-table-opts is now run last in the test suite because it's so fat
|
||||
|
||||
** flex can, to some extent, diagnose where internal problems occur
|
||||
|
||||
** new translations from the translation project: fr, ca, de, ru, sv
|
||||
|
||||
**Flex generates C99 defs now; see YY_TRADITIONAL_FUNC_DEFS in the
|
||||
manual if that's not a good thing for you
|
||||
|
||||
* version 2.5.19 released 2002-9-5
|
||||
|
||||
** prevent segfault on input lines which are longer than the allocated
|
||||
space (problem report from Manoj Srivastava
|
||||
<srivasta@golden-gryphon.com>)
|
||||
|
||||
** Changed option 'header' to 'header-file'
|
||||
|
||||
* version 2.5.18 released 2002-9-4
|
||||
|
||||
** portability fixes for integer constants and in the way the test
|
||||
suite reports its results
|
||||
|
||||
** the test for bison was reporting bison missing when it was, in
|
||||
fact, found
|
||||
|
||||
** if we don't find GNU indent, we're more careful when we're not
|
||||
finding it
|
||||
|
||||
* version 2.5.17 released 2002-8-29
|
||||
|
||||
** more portability fixes
|
||||
|
||||
** updated config.sub and config.guess
|
||||
|
||||
** flex is indented by GNU indent (this was done earlier but not
|
||||
explicitly documented)
|
||||
|
||||
* version 2.5.16 released 2002-8-28
|
||||
|
||||
** c++ scanners compile again
|
||||
|
||||
** there is now an indent target in the top-level Makefile; configure
|
||||
checks for GNU indent which is required for proper operation of the
|
||||
indent target
|
||||
|
||||
** some more portability fixes were made
|
||||
|
||||
** %options and invocation sections of manual merged
|
||||
|
||||
** a c++ test was added to the test suite
|
||||
|
||||
** we're trying to clean up more files in the test suite's make clean
|
||||
targets
|
||||
|
||||
* version 2.5.15 released 2002-8-21
|
||||
|
||||
** reject-state buffer is now dynamically allocated and REJECT buffer
|
||||
variables are reentrant-safe
|
||||
|
||||
** manual now discusses memory usage
|
||||
|
||||
** skeleton now processed by m4 before mkskel.sh; (this only matters
|
||||
if you want to change the skeleton or if you're doing flex development)
|
||||
|
||||
** zh_cn translation added from translation project
|
||||
|
||||
** a bug that caused a segfault has now been fixed
|
||||
|
||||
** the test suite now respects the usual CFLAGS, etc. variables
|
||||
|
||||
** removed some warnings which some tests trigggered with the -s option
|
||||
|
||||
** the flex-generated header file now tries to be smarter about
|
||||
conditionally including start conditions
|
||||
|
||||
** tables code omitted from generated scanner when not used
|
||||
|
||||
* version 2.5.14 released 2002-8-15
|
||||
|
||||
** the tests using the reentrant c scanner as c++ were reworked
|
||||
slightly to be sure that the c++ was enforced
|
||||
|
||||
** de translation now included in the distribution
|
||||
|
||||
** various portability fixes regarding nls support, c++ include
|
||||
headers, etc.
|
||||
|
||||
* version 2.5.13 released 2002-8-15
|
||||
|
||||
** the header file output with %option header is now much smaller
|
||||
|
||||
** Fixed type mismatch in printf in scanner skeleton
|
||||
|
||||
** yylex_init now reports errors
|
||||
|
||||
* version 2.5.12 released 2002-8-8
|
||||
|
||||
** updated gettext support to 0.11.5
|
||||
|
||||
** new fr translation from the translation project
|
||||
|
||||
** bison is no longer needed to build flex; If you are building flex
|
||||
from a release (i.e., not from a cvs snapshot), then you don't need
|
||||
to have a pre-built lex around either (unless you modify scan.l, of
|
||||
course); (This has been true for some time, but was not mentioned
|
||||
here.)
|
||||
|
||||
* version 2.5.11 released 2002-7-31
|
||||
|
||||
** Fixed bug where yyless did not consider yylineno
|
||||
|
||||
** the yylineno performance hit is now gone
|
||||
|
||||
** fixed some typos in the manual and we now include texinfo.tex in
|
||||
the distribution
|
||||
|
||||
** traditional prototypes output for C scanners, controlled by a
|
||||
preprocessor symbol; see documentation for details
|
||||
|
||||
* version 2.5.10 released 2002-7-24
|
||||
|
||||
** yy_globals renamed to yyscanner and yy_globals_t renamed to
|
||||
yy_guts_t
|
||||
|
||||
** added dist-bzip2 option to Makefile.am so we now produce a bzip2'd
|
||||
archive in addition to the standard gzip archive
|
||||
|
||||
* version 2.5.9
|
||||
|
||||
** new tests in test suite: test-mem-{nr,r}, test-posix,
|
||||
test-posixly-correct, test-debug-{nr,r}
|
||||
|
||||
** made changes to work with gcc-3.2 development code
|
||||
|
||||
** ability to choose which memory functions are used in flex
|
||||
|
||||
** new yylex_destroy() function for the non-reentrant scanner
|
||||
|
||||
** new handling of POSIXLY_CORRECT environment variable
|
||||
|
||||
** the test suite now has its copyrights explicitly described
|
||||
|
||||
** new ca, de, fr, ru, sv, tr translations
|
||||
|
||||
* version 2.5.8
|
||||
|
||||
** a new --posix option generates scanners with posix-style abc{1,3}
|
||||
compatible parsing, see manual for the screwy details
|
||||
|
||||
* version 2.5.7
|
||||
|
||||
** configure.in now includes a call to AC_PREREQ to enforce the
|
||||
requirement for autoconf at least 2.50 (This only effects you if
|
||||
you're doing flex development.)
|
||||
|
||||
** configure now uses autoconf's versioning information and configure
|
||||
--help reports the bug-reporting address for flex
|
||||
|
||||
** test suite now only reports success versus failure; reporting
|
||||
skipped is problematic under the current setup
|
||||
|
||||
** compilation with --disable-nls now works
|
||||
|
||||
** flex can now be built in a separate directory
|
||||
|
||||
* version 2.5.6
|
||||
|
||||
** gettext support added (from gettext 0.11)
|
||||
|
||||
*** translations for ca, da, de, es, fr, ko, ru, sv, tr included
|
||||
|
||||
** distribution now built under automake 1.6 and autoconf 2.53
|
||||
|
||||
** command-line option parsing happens differently now:
|
||||
|
||||
*** Added long option parsing
|
||||
|
||||
*** Options -n and -c, previously deprecated, now simply do nothing
|
||||
|
||||
*** Options are now parsed left to right
|
||||
|
||||
** added a number of new options
|
||||
|
||||
*** All positive %options are now accessible from the command line
|
||||
|
||||
*** Added option -D, to define a preprocessor symbol
|
||||
|
||||
*** Added option --header=FILE to specify a C .h file to generate
|
||||
|
||||
*** added option --yywrap to call yywrap on EOF
|
||||
|
||||
*** added option --yylineno to track line count in yylineno
|
||||
|
||||
*** --yyclass=NAME name of C++ class when generating c++ scanners
|
||||
|
||||
*** for long option names which are associated with existing short
|
||||
options, see accompanying documentation
|
||||
|
||||
*** new %option nounistd or command-line --nounistd added to prevent
|
||||
flex from generating #include <unistd.h> on systems that don't
|
||||
have that include file
|
||||
|
||||
** Support for reentrant C scanners has been added
|
||||
|
||||
*** Updated the manual with the new reentrant API
|
||||
|
||||
*** Two new options %option reentrant (-R) and
|
||||
%option reentrant-bison (-Rb)
|
||||
|
||||
*** All globals optionally placed into struct yyglobals_t
|
||||
|
||||
*** All access to globals replaced by macro invocations
|
||||
|
||||
*** All functions optionally take one additional
|
||||
argument, yy_globals
|
||||
|
||||
*** New style for invoking reentrant scanner:
|
||||
yylex_init(void** scanner );
|
||||
yylex( scanner );
|
||||
yylex_destroy( scanner );
|
||||
|
||||
*** Added get/set functions for members of struct yy_globals_t
|
||||
e.g., yyget_text, yyget_leng, etc
|
||||
|
||||
*** Prefix substitution added for new functions
|
||||
|
||||
*** Macro shortcuts to the lengthy get/set functions
|
||||
provided for use in actions, e.g., yytext, yyleng, etc
|
||||
|
||||
*** Arbitrary, user-defined data, "yyextra", may be added to scanner
|
||||
|
||||
** %option nomain no longer implies %option yywrap
|
||||
But the inverse is still true
|
||||
|
||||
** Developer test suite added
|
||||
|
||||
*** TESTS/ directory has been added. Users can
|
||||
'make test' in the TESTS directory to execute the test suite
|
||||
|
||||
** Support for bison variables yylval and yylloc added
|
||||
|
||||
** automake support for the build process
|
||||
|
||||
** manual is now in texinfo/info format
|
||||
|
||||
*** flex.1 removed from distribution
|
||||
|
||||
** flex no longer generates C-language scanners with C++-style
|
||||
comments
|
||||
|
||||
** flex now generates scanners in c++ which are compatible with
|
||||
recent c++ compilers
|
||||
|
||||
** flex input scanner now recognizes '\r' as an EOL character
|
||||
|
||||
See the file ONEWS for changes in earlier releases.
|
||||
|
||||
Local Variables:
|
||||
mode: text
|
||||
mode: outline-minor
|
||||
end:
|
||||
@@ -0,0 +1,113 @@
|
||||
This is flex, the fast lexical analyzer generator.
|
||||
|
||||
flex is a tool for generating scanners: programs which recognize
|
||||
lexical patterns in text.
|
||||
|
||||
More information about flex as well as the latest official release of
|
||||
flex can be found at:
|
||||
|
||||
http://flex.sourceforge.net/
|
||||
|
||||
Bug reports should be submitted using the SourceForge Bug Tracker for
|
||||
flex at:
|
||||
|
||||
http://sourceforge.net/tracker/?group_id=97492&atid=618177
|
||||
|
||||
The flex codebase is kept in git at:
|
||||
|
||||
https://github.com/westes/flex
|
||||
|
||||
There are several mailing lists available as well:
|
||||
|
||||
flex-announce@lists.sourceforge.net - where posts will be made
|
||||
announcing new releases of flex.
|
||||
|
||||
flex-help@lists.sourceforge.net - where you can post questions about
|
||||
using flex
|
||||
|
||||
flex-devel@lists.sourceforge.net - where you can discuss development of
|
||||
flex itself
|
||||
|
||||
Find information on subscribing to the mailing lists at:
|
||||
|
||||
http://sourceforge.net/mail/?group_id=97492
|
||||
|
||||
The flex distribution contains the following files which may be of interest:
|
||||
|
||||
README - This file.
|
||||
|
||||
NEWS - current version number and list of user-visible changes.
|
||||
|
||||
INSTALL - basic installation information.
|
||||
|
||||
ABOUT-NLS - description of internationalization support in flex.
|
||||
|
||||
COPYING - flex's copyright and license.
|
||||
|
||||
doc/ - user documentation.
|
||||
|
||||
examples/ - containing examples of some possible flex scanners and a
|
||||
few other things. See the file examples/README for more details.
|
||||
|
||||
TODO - outstanding bug reports, desired features, etc.
|
||||
|
||||
tests/ - regression tests. See TESTS/README for details.
|
||||
|
||||
po/ - internationalization support files.
|
||||
|
||||
You need the following tools to build flex from the maintainer's
|
||||
repository:
|
||||
|
||||
compiler suite - flex is built with gcc
|
||||
bash, or a good Bourne-style shell
|
||||
m4 - m4 -p needs to work; GNU m4 and a few others are suitable
|
||||
GNU bison; to generate parse.c from parse.y
|
||||
autoconf 2.69; for handling the build system
|
||||
automake 1.12.2; for Makefile generation
|
||||
gettext 0.18; fori18n support
|
||||
help2man 1.36; to generate the flex man page
|
||||
tar, gzip, etc.; for packaging of the source distribution
|
||||
GNU texinfo 498; to build and test the flex manual
|
||||
GNU indent 2.8; for indenting the flex source the way we want it done
|
||||
|
||||
Once you have all the necessary tools installed, life becomes
|
||||
simple. To prepare the flex tree for building, run the script:
|
||||
|
||||
$ ./autogen.sh
|
||||
|
||||
in the top level of the flex source tree.
|
||||
This script calls the various tools needed to get flex ready for the
|
||||
GNU-style configure script to be able to work.
|
||||
|
||||
From this point on, building flex follows the usual configure, make,
|
||||
make install routine.
|
||||
|
||||
This file is part of flex.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
Vern had the following things to say:
|
||||
|
||||
Many thanks to the 2.5 beta-testers for finding bugs and helping test and
|
||||
increase portability: Stan Adermann, Scott David Daniels, Charles Elliott,
|
||||
Joe Gayda, Chris Meier, James Nordby, Terrence O'Kane, Karsten Pahnke,
|
||||
Francois Pinard, Pat Rankin, Andreas Scherer, Marc Wiese, Nathan Zelle.
|
||||
|
||||
Thanks to the many flex beta-testers, feedbackers, and contributors,
|
||||
especially Francois Pinard, Casey Leedom, Robert Abramovitz, Stan
|
||||
Adermann, Terry Allen, David Barker-Plummer, John Basrai, Neal Becker,
|
||||
Nelson H.F. Beebe, benson@odi.com, Karl Berry, Peter A. Bigot, Simon
|
||||
Blanchard, Keith Bostic, Frederic Brehm, Ian Brockbank, Kin Cho, Nick
|
||||
Christopher, Brian Clapper, J.T. Conklin, Jason Coughlin, Bill Cox,
|
||||
Nick Cropper, Dave Curtis, Scott David Daniels, Chris G. Demetriou,
|
||||
Theo Deraadt, Mike Donahue, Chuck Doucette, Tom Epperly, Leo Eskin,
|
||||
Chris Faylor, Chris Flatters, Jon Forrest, Jeffrey Friedl, Joe Gayda,
|
||||
Kaveh R. Ghazi, Wolfgang Glunz, Eric Goldman, Christopher M. Gould,
|
||||
Ulrich Grepel, Peer Griebel, Jan Hajic, Charles Hemphill, NORO Hideo,
|
||||
Jarkko Hietaniemi, Scott Hofmann, Jeff Honig, Dana Hudes, Eric Hughes,
|
||||
John Interrante, Ceriel Jacobs, Michal Jaegermann, Sakari Jalovaara,
|
||||
Jeffrey R. Jones, Henry Juengst, Klaus Kaempf, Jonathan I. Kamens,
|
||||
Terrence O Kane, Amir Katz, ken@ken.hilco.com, Kevin B. Kenny, Steve
|
||||
Kirsch, Winfried Koenig, Marq Kole, Ronald Lamprecht, Greg Lee, Rohan
|
||||
Lenard, Craig Leres, John Levine, Steve Liddle, David Loffredo, Mike
|
||||
Long, Mohamed el Lozy, Brian Madsen, Malte, Joe Marshall, Bengt
|
||||
Martensson, Chris Metcalf, Luke Mewburn, Jim Meyering, R. Alexander
|
||||
Milowski, Erik Naggum, G.T. Nicol, Landon Noll, James Nordby, Marc
|
||||
Nozell, Richard Ohnemus, Karsten Pahnke, Sven Panne, Roland Pesch,
|
||||
Walter Pelissero, Gaumond Pierre, Esmond Pitt, Jef Poskanzer, Joe
|
||||
Rahmeh, Jarmo Raiha, Frederic Raimbault, Pat Rankin, Rick Richardson,
|
||||
Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini, Andreas
|
||||
Scherer, Darrell Schiebel, Raf Schietekat, Doug Schmidt, Philippe
|
||||
Schnoebelen, Andreas Schwab, Larry Schwimmer, Alex Siegel, Eckehard
|
||||
Stolz, Jan-Erik Strvmquist, Mike Stump, Paul Stuart, Dave Tallman, Ian
|
||||
Lance Taylor, Chris Thewalt, Richard M. Timoney, Jodi Tsai, Paul
|
||||
Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams,
|
||||
Ken Yap, Ron Zellar, Nathan Zelle, David Zuhn, and those whose names
|
||||
have slipped my marginal mail-archiving skills but whose contributions
|
||||
are appreciated all the same.
|
||||
|
||||
Thanks to Keith Bostic, Jon Forrest, Noah Friedman,
|
||||
John Gilmore, Craig Leres, John Levine, Bob Mulcahy, G.T.
|
||||
Nicol, Francois Pinard, Rich Salz, and Richard Stallman for help with various
|
||||
distribution headaches.
|
||||
|
||||
Thanks to Esmond Pitt and Earle Horton for 8-bit character support; to
|
||||
Benson Margulies and Fred Burke for C++ support; to Kent Williams and Tom
|
||||
Epperly for C++ class support; to Ove Ewerlid for support of NUL's; and to
|
||||
Eric Hughes for support of multiple buffers.
|
||||
|
||||
This work was primarily done when I was with the Real Time Systems Group
|
||||
at the Lawrence Berkeley Laboratory in Berkeley, CA. Many thanks to all there
|
||||
for the support I received.
|
||||
@@ -0,0 +1,66 @@
|
||||
* the manual:
|
||||
|
||||
** do an end-to-end proofread of the manual (this is under way, but is
|
||||
going slowly)
|
||||
|
||||
** pretty up the dvi output; overflows, etc.
|
||||
|
||||
** faq
|
||||
|
||||
*** clean up the faqs section. The information is good; the texinfo
|
||||
could use some touching up.
|
||||
|
||||
*** index the faq entries
|
||||
|
||||
*** mention that it's possible to use a variable to scan matching
|
||||
brackets, nested comments etc.
|
||||
|
||||
*** include something about lexing/parsing fortran
|
||||
|
||||
** create a section on flex design, features, etc.
|
||||
|
||||
* getext
|
||||
|
||||
** make sure all flex modules use gettext translation facilities
|
||||
|
||||
*subdirectories
|
||||
|
||||
** in examples/manual, integrate the Makefile.examples into the
|
||||
Makefile.am
|
||||
|
||||
* test suite
|
||||
|
||||
** integrate the test suite into automake's framework (note that the
|
||||
test suite can be run from the top level directory with "make
|
||||
check". Still, we want to get it completely under automake's control.)
|
||||
|
||||
** make test suite more complete
|
||||
|
||||
* generic coding
|
||||
|
||||
** move as much skeleton code as possible out of gen.c and into
|
||||
flex.skl
|
||||
|
||||
** figure out whether we want to add the capability to have
|
||||
auto-generated backout rules
|
||||
|
||||
** token-type and token buffer support
|
||||
|
||||
** check if we still need to #undef macros at the end of a header
|
||||
|
||||
** merge yylineno into support for location tracking
|
||||
|
||||
** bug where yylineno is not decremented on REJECT
|
||||
|
||||
** bug where yylineno is counted in trailing context
|
||||
|
||||
* C++
|
||||
|
||||
** have a separate skeleton for c++
|
||||
|
||||
** revisit the C++ API. We get requests to make it more complete.
|
||||
|
||||
Local Variables:
|
||||
Mode: text
|
||||
mode: outline-minor
|
||||
End:
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This file is part of flex.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
|
||||
# If you see no configure script, then run ./autogen.sh to create it
|
||||
# and procede with the "normal" build procedures.
|
||||
|
||||
#if we pretend to have a ChangeLog, then automake is less
|
||||
#worried. (Don't worry, we *do* have a ChangeLog, we just need the
|
||||
#Makefile first.)
|
||||
|
||||
touch ChangeLog
|
||||
autoreconf --install --verbose --force
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# This file is part of flex.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
|
||||
# autoconf requirements and initialization
|
||||
|
||||
AC_INIT([the fast lexical analyser generator], [2.6.0-pre],
|
||||
[flex-help@lists.sourceforge.net], [flex])
|
||||
AC_CONFIG_SRCDIR([src/scan.l])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AM_INIT_AUTOMAKE([gnu check-news std-options dist-bzip2 dist-xz parallel-tests 1.14.1])
|
||||
AC_CONFIG_HEADER([src/config.h])
|
||||
AC_CONFIG_LIBOBJ_DIR([lib])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
LT_INIT
|
||||
SHARED_VERSION_INFO="2:0:0"
|
||||
AC_SUBST(SHARED_VERSION_INFO)
|
||||
|
||||
# checks for programs
|
||||
|
||||
AM_GNU_GETTEXT([external])
|
||||
AM_GNU_GETTEXT_VERSION([0.19])
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_AWK
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_PATH_PROG(BISON, bison,bison)
|
||||
AC_PATH_PROG(HELP2MAN, help2man, help2man)
|
||||
|
||||
# Check for a m4 that supports -P
|
||||
|
||||
AC_CACHE_CHECK([for m4 that supports -P], [ac_cv_path_M4],
|
||||
[AC_PATH_PROGS_FEATURE_CHECK([M4], [gm4 gnum4 m4],
|
||||
[[m4out=`echo 'm''4_divnum' | $ac_path_M4 -P`]
|
||||
[test "x$m4out" = x0 \
|
||||
&& ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
|
||||
[AC_MSG_ERROR([could not find m4 that supports -P])])])
|
||||
AC_SUBST([M4], [$ac_cv_path_M4])
|
||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the m4 executable name.])
|
||||
|
||||
AC_PATH_PROG(INDENT, indent, indent)
|
||||
# if INDENT is set to 'indent' then we didn't find indent
|
||||
if test "$INDENT" != indent ; then
|
||||
AC_MSG_CHECKING(if $INDENT is GNU indent)
|
||||
if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN($INDENT does not appear to be GNU indent.)
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN(no indent program found: make indent target will not function)
|
||||
fi
|
||||
|
||||
# checks for headers
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h regex.h stddef.h stdlib.h string.h strings.h unistd.h])
|
||||
|
||||
# checks for libraries
|
||||
|
||||
# The test test-pthread uses libpthread, so we check for it here, but
|
||||
# all we need is the preprocessor symbol defined since we don't need
|
||||
# LIBS to include libpthread for building flex.
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_mutex_lock,
|
||||
AC_DEFINE([HAVE_LIBPTHREAD], 1, [pthread library] ),
|
||||
AC_DEFINE([HAVE_LIBPTHREAD], 0, [pthread library] )
|
||||
)
|
||||
AC_CHECK_HEADERS([pthread.h])
|
||||
AM_CONDITIONAL([want_pthread], [test x$ac_cv_lib_pthread_pthread_mutex_lock = xyes])
|
||||
|
||||
AC_CHECK_LIB(m, log10)
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
AC_HEADER_STDBOOL
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# Checks for library functions.
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol])
|
||||
|
||||
AC_CONFIG_FILES(
|
||||
Makefile
|
||||
doc/Makefile
|
||||
examples/Makefile
|
||||
examples/fastwc/Makefile
|
||||
examples/manual/Makefile
|
||||
lib/Makefile
|
||||
po/Makefile.in
|
||||
src/Makefile
|
||||
tools/Makefile
|
||||
tests/Makefile
|
||||
)
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1 @@
|
||||
XBS-Destinations: sourceforge
|
||||
@@ -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
|
||||
@@ -0,0 +1,31 @@
|
||||
help2man = @HELP2MAN@
|
||||
|
||||
info_TEXINFOS = flex.texi
|
||||
dist_man_MANS = flex.1
|
||||
dist_doc_DATA= flex.pdf
|
||||
|
||||
CLEANFILES = \
|
||||
flex.aux \
|
||||
flex.cp \
|
||||
flex.cps \
|
||||
flex.fn \
|
||||
flex.fns \
|
||||
flex.hk \
|
||||
flex.hks \
|
||||
flex.ky \
|
||||
flex.log \
|
||||
flex.op \
|
||||
flex.ops \
|
||||
flex.pg \
|
||||
flex.toc \
|
||||
flex.tp \
|
||||
flex.tps \
|
||||
flex.vr \
|
||||
flex.vrs
|
||||
|
||||
$(dist_man_MANS): $(top_srcdir)/src/main.c
|
||||
for i in $(dist_man_MANS) ; do \
|
||||
$(help2man) --name='$(PACKAGE_NAME)' \
|
||||
--section=`echo $$i | sed -e 's/.*\.\([^.]*\)$$/\1/'` \
|
||||
$(top_srcdir)/src/flex$(EXEEXT) > $$i || rm -f $$i ; \
|
||||
done
|
||||
+8614
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
# This file is part of flex.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
|
||||
EXTRA_DIST = \
|
||||
testxxLexer.l \
|
||||
debflex.awk \
|
||||
README
|
||||
|
||||
SUBDIRS = \
|
||||
manual \
|
||||
fastwc
|
||||
@@ -0,0 +1,15 @@
|
||||
This directory contains some examples of what you can do with
|
||||
flex. These files are not tested regularly so you might have to tinker
|
||||
a bit before they work for you. Updates, new files and patches are welcome.
|
||||
|
||||
- debflex.awk, an awk script for anotating flex debug output.
|
||||
It presently only works with gawk and mawk, not with "old"
|
||||
or "new" awk.
|
||||
|
||||
- testxxLexer.l, a sample C++ program that uses flex's scanner
|
||||
class option ("-+").
|
||||
|
||||
- fastwc/, a subdirectory containing examples of how to use flex
|
||||
to write progressively higher-performance versions of the Unix
|
||||
"wc" utility. This certainly should work with 2.5, but hasn't
|
||||
been tested.
|
||||
@@ -0,0 +1,119 @@
|
||||
# Clarify the flex debug trace by substituting first line of each rule.
|
||||
# Francois Pinard <pinard@iro.umontreal.ca>, July 1990.
|
||||
#
|
||||
# Rewritten to process correctly \n's in scanner input.
|
||||
# BEGIN section modified to correct a collection of rules.
|
||||
# Michal Jaegermann <michal@phys.ualberta.ca>, December 1993
|
||||
#
|
||||
# Sample usage:
|
||||
# flex -d PROGRAM.l
|
||||
# gcc -o PROGRAM PROGRAM.c -lfl
|
||||
# PROGRAM 2>&1 | gawk -f debflex.awk PROGRAM.l
|
||||
#
|
||||
# (VP's note: this script presently does not work with either "old" or
|
||||
# "new" awk; fixes so it does will be welcome)
|
||||
|
||||
BEGIN {
|
||||
# Insure proper usage.
|
||||
|
||||
if (ARGC != 2) {
|
||||
print "usage: gawk -f debflex.awk FLEX_SOURCE <DEBUG_OUTPUT";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
# Remove and save the name of flex source.
|
||||
|
||||
source = ARGV[1];
|
||||
ARGC--;
|
||||
|
||||
# Swallow the flex source file.
|
||||
|
||||
line = 0;
|
||||
section = 1;
|
||||
while (getline <source) {
|
||||
|
||||
# Count the lines.
|
||||
|
||||
line++;
|
||||
|
||||
# Count the sections. When encountering section 3,
|
||||
# break out of the awk BEGIN block.
|
||||
|
||||
if (match ($0, /^%%/)) {
|
||||
section++;
|
||||
if (section == 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Only the lines in section 2 which do not begin in a
|
||||
# tab or space might be referred to by the flex debug
|
||||
# trace. Save only those lines.
|
||||
|
||||
if (section == 2 && match ($0, /^[^ \t]/)) {
|
||||
rules[line] = $0;
|
||||
}
|
||||
}
|
||||
}
|
||||
dashes = "-----------------------------------------------------------";
|
||||
collect = "";
|
||||
line = 0;
|
||||
}
|
||||
|
||||
# collect complete rule output from a scanner
|
||||
$0 !~ /^--/ {
|
||||
collect = collect "\n" $0;
|
||||
next;
|
||||
}
|
||||
# otherwise we have a new rule - process what we got so far
|
||||
{
|
||||
process();
|
||||
}
|
||||
# and the same thing if we hit EOF
|
||||
END {
|
||||
process();
|
||||
}
|
||||
|
||||
function process() {
|
||||
|
||||
# splitting this way we loose some double dashes and
|
||||
# left parentheses from echoed input - a small price to pay
|
||||
n = split(collect, field, "\n--|[(]");
|
||||
|
||||
# this loop kicks in only when we already collected something
|
||||
for (i = 1; i <= n; i++) {
|
||||
if (0 != line) {
|
||||
# we do not care for traces of newlines.
|
||||
if (0 == match(field[i], /\"\n+\"[)]/)) {
|
||||
if (rules[line]) {
|
||||
text = field[i];
|
||||
while ( ++i <= n) {
|
||||
text = text field[i];
|
||||
}
|
||||
printf("%s:%d: %-8s -- %s\n",
|
||||
source, line, text, rules[line]);
|
||||
}
|
||||
else {
|
||||
print;
|
||||
printf "%s:%d: *** No such rule.\n", source, line;
|
||||
}
|
||||
}
|
||||
line = 0;
|
||||
break;
|
||||
}
|
||||
if ("" != field[i]) {
|
||||
if ("end of buffer or a NUL)" == field[i]) {
|
||||
print dashes; # Simplify trace of buffer reloads
|
||||
continue;
|
||||
}
|
||||
if (match(field[i], /accepting rule at line /)) {
|
||||
# force interpretation of line as a number
|
||||
line = 0 + substr(field[i], RLENGTH);
|
||||
continue;
|
||||
}
|
||||
# echo everything else
|
||||
printf("--%s\n", field[i]);
|
||||
}
|
||||
}
|
||||
collect = "\n" $0; # ... and start next trace
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# This file is part of flex.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
|
||||
EXTRA_DIST = \
|
||||
wc5.l \
|
||||
wc4.l \
|
||||
wc3.l \
|
||||
wc2.l \
|
||||
wc1.l \
|
||||
mywc.c \
|
||||
README
|
||||
@@ -0,0 +1,56 @@
|
||||
This directory contains some examples illustrating techniques for extracting
|
||||
high-performance from flex scanners. Each program implements a simplified
|
||||
version of the Unix "wc" tool: read text from stdin and print the number of
|
||||
characters, words, and lines present in the text. All programs were compiled
|
||||
using gcc (version unavailable, sorry) with the -O flag, and run on a
|
||||
SPARCstation 1+. The input used was a PostScript file, mainly containing
|
||||
figures, with the following "wc" counts:
|
||||
|
||||
lines words characters
|
||||
214217 635954 2592172
|
||||
|
||||
|
||||
The basic principles illustrated by these programs are:
|
||||
|
||||
- match as much text with each rule as possible
|
||||
- adding rules does not slow you down!
|
||||
- avoid backing up
|
||||
|
||||
and the big caveat that comes with them is:
|
||||
|
||||
- you buy performance with decreased maintainability; make
|
||||
sure you really need it before applying the above techniques.
|
||||
|
||||
See the "Performance Considerations" section of flexdoc for more
|
||||
details regarding these principles.
|
||||
|
||||
|
||||
The different versions of "wc":
|
||||
|
||||
mywc.c
|
||||
a simple but fairly efficient C version
|
||||
|
||||
wc1.l a naive flex "wc" implementation
|
||||
|
||||
wc2.l somewhat faster; adds rules to match multiple tokens at once
|
||||
|
||||
wc3.l faster still; adds more rules to match longer runs of tokens
|
||||
|
||||
wc4.l fastest; still more rules added; hard to do much better
|
||||
using flex (or, I suspect, hand-coding)
|
||||
|
||||
wc5.l identical to wc3.l except one rule has been slightly
|
||||
shortened, introducing backing-up
|
||||
|
||||
Timing results (all times in user CPU seconds):
|
||||
|
||||
program time notes
|
||||
------- ---- -----
|
||||
wc1 16.4 default flex table compression (= -Cem)
|
||||
wc1 6.7 -Cf compression option
|
||||
/bin/wc 5.8 Sun's standard "wc" tool
|
||||
mywc 4.6 simple but better C implementation!
|
||||
wc2 4.6 as good as C implementation; built using -Cf
|
||||
wc3 3.8 -Cf
|
||||
wc4 3.3 -Cf
|
||||
wc5 5.7 -Cf; ouch, backing up is expensive
|
||||
@@ -0,0 +1,26 @@
|
||||
/* A simple but fairly efficient C version of the Unix "wc" tool */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
main()
|
||||
{
|
||||
int c, cc = 0, wc = 0, lc = 0;
|
||||
FILE *f = stdin;
|
||||
|
||||
while ((c = getc(f)) != EOF) {
|
||||
++cc;
|
||||
if (isgraph(c)) {
|
||||
++wc;
|
||||
do {
|
||||
c = getc(f);
|
||||
if (c == EOF)
|
||||
goto done;
|
||||
++cc;
|
||||
} while (isgraph(c));
|
||||
}
|
||||
if (c == '\n')
|
||||
++lc;
|
||||
}
|
||||
done: printf( "%8d%8d%8d\n", lc, wc, cc );
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/* First cut at a flex-based "wc" tool. */
|
||||
|
||||
ws [ \t]
|
||||
nonws [^ \t\n]
|
||||
|
||||
%option main noyywrap
|
||||
%%
|
||||
int cc = 0, wc = 0, lc = 0;
|
||||
|
||||
{nonws}+ cc += yyleng; ++wc;
|
||||
|
||||
{ws}+ cc += yyleng;
|
||||
|
||||
\n ++lc; ++cc;
|
||||
|
||||
<<EOF>> {
|
||||
printf( "%8d %8d %8d\n", lc, wc, cc );
|
||||
yyterminate();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/* Somewhat faster "wc" tool: match more text with each rule */
|
||||
|
||||
ws [ \t]
|
||||
nonws [^ \t\n]
|
||||
word {ws}*{nonws}+
|
||||
|
||||
%option main noyywrap
|
||||
%%
|
||||
int cc = 0, wc = 0, lc = 0;
|
||||
|
||||
{word}{ws}* cc += yyleng; ++wc;
|
||||
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
|
||||
|
||||
{ws}+ cc += yyleng;
|
||||
|
||||
\n+ cc += yyleng; lc += yyleng;
|
||||
|
||||
<<EOF>> {
|
||||
printf( "%8d %8d %8d\n", lc, wc, cc );
|
||||
yyterminate();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Somewhat faster still: potentially match a lot of text with each rule */
|
||||
|
||||
ws [ \t]
|
||||
nonws [^ \t\n]
|
||||
word {ws}*{nonws}+
|
||||
words {word}{ws}+
|
||||
|
||||
%option main noyywrap
|
||||
%%
|
||||
int cc = 0, wc = 0, lc = 0;
|
||||
|
||||
{word}{ws}* cc += yyleng; ++wc;
|
||||
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
|
||||
{words}{word}{ws}* cc += yyleng; wc += 2;
|
||||
{words}{2}{word}{ws}* cc += yyleng; wc += 3;
|
||||
{words}{3}{word}{ws}* cc += yyleng; wc += 4;
|
||||
|
||||
{ws}+ cc += yyleng;
|
||||
|
||||
\n+ cc += yyleng; lc += yyleng;
|
||||
|
||||
<<EOF>> {
|
||||
printf( "%8d %8d %8d\n", lc, wc, cc );
|
||||
yyterminate();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Fastest version of wc: add rules to pick up newlines, too */
|
||||
|
||||
ws [ \t]
|
||||
nonws [^ \t\n]
|
||||
word {ws}*{nonws}+
|
||||
words {word}{ws}+
|
||||
|
||||
%option main noyywrap
|
||||
%%
|
||||
int cc = 0, wc = 0, lc = 0;
|
||||
|
||||
{word}{ws}* ++wc; cc += yyleng;
|
||||
{word}{ws}*\n ++wc; cc += yyleng; ++lc;
|
||||
{words}{word}{ws}* wc += 2; cc += yyleng;
|
||||
{words}{word}{ws}*\n wc += 2; cc += yyleng; ++lc;
|
||||
{words}{2}{word}{ws}* wc += 3; cc += yyleng;
|
||||
{words}{2}{word}{ws}*\n wc += 3; cc += yyleng; ++lc;
|
||||
{words}{3}{word}{ws}* wc += 4; cc += yyleng;
|
||||
{words}{3}{word}{ws}*\n wc += 4; cc += yyleng; ++lc;
|
||||
|
||||
{ws}+ cc += yyleng;
|
||||
|
||||
\n+ cc += yyleng; lc += yyleng;
|
||||
|
||||
<<EOF>> {
|
||||
printf( "%8d %8d %8d\n", lc, wc, cc );
|
||||
yyterminate();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Oops; slight change from wc3.l introduces backtracking */
|
||||
|
||||
ws [ \t]
|
||||
nonws [^ \t\n]
|
||||
word {ws}*{nonws}+
|
||||
words {word}{ws}+
|
||||
|
||||
%option main noyywrap
|
||||
%%
|
||||
int cc = 0, wc = 0, lc = 0;
|
||||
|
||||
{word}{ws}* cc += yyleng; ++wc;
|
||||
{word}{ws}*\n cc += yyleng; ++wc; ++lc;
|
||||
{words}{word} cc += yyleng; wc += 2; /* oops */
|
||||
{words}{2}{word}{ws}* cc += yyleng; wc += 3;
|
||||
{words}{3}{word}{ws}* cc += yyleng; wc += 4;
|
||||
|
||||
{ws}+ cc += yyleng;
|
||||
|
||||
\n+ cc += yyleng; lc += yyleng;
|
||||
|
||||
<<EOF>> {
|
||||
printf( "%8d %8d %8d\n", lc, wc, cc );
|
||||
yyterminate();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
Tue Oct 5 21:51:59 1993 Vern Paxson
|
||||
|
||||
* Removed FILTER/ subdirectory.
|
||||
|
||||
* Removed alloca.c.
|
||||
|
||||
* Changed Makefile definition of CC to just "gcc -g", removed
|
||||
assumption of alloca being present.
|
||||
|
||||
* Added pointer to MISC/fastwc/ to wc.lex.
|
||||
|
||||
Tue Jun 8 15:47:39 1993 Gavin Thomas Nicol (nick at sillybugs)
|
||||
|
||||
* Changed main() in wc.lex extensively. The old version would not
|
||||
work correctly without the YY_NEW_FILE. (lex handles the older
|
||||
version OK though).
|
||||
|
||||
* Added a rule to expr.lex to handle whitespace. The old version
|
||||
reported an illegal character.
|
||||
|
||||
* Added -traditional to the gcc flags because the flex definition
|
||||
for free() clashes with some systems that have old header files.
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# This file is part of flex.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
|
||||
EXTRA_DIST = \
|
||||
ChangeLog \
|
||||
Makefile.examples \
|
||||
README \
|
||||
cat.lex \
|
||||
dates.lex \
|
||||
datetest.dat \
|
||||
eof_rules.lex \
|
||||
eof_test01.txt \
|
||||
eof_test02.txt \
|
||||
eof_test03.txt \
|
||||
expr.lex \
|
||||
expr.y \
|
||||
front.lex \
|
||||
front.y \
|
||||
j2t.lex \
|
||||
myname.lex \
|
||||
myname.txt \
|
||||
myname2.lex \
|
||||
numbers.lex \
|
||||
pas_include.lex \
|
||||
pascal.lex \
|
||||
reject.lex \
|
||||
replace.lex \
|
||||
string1.lex \
|
||||
string2.lex \
|
||||
strtest.dat \
|
||||
unput.lex \
|
||||
user_act.lex \
|
||||
userinit.lex \
|
||||
wc.lex \
|
||||
yymore.lex \
|
||||
yymore2.lex \
|
||||
yymoretest.dat
|
||||
@@ -0,0 +1,88 @@
|
||||
#############################################################
|
||||
#
|
||||
# Makefile : Makefile for Flex examples.
|
||||
# Author : G.T.Nicol
|
||||
# Last Updated : 1993/10/05
|
||||
#
|
||||
# If you use bison, you may have to supply an alloca
|
||||
#
|
||||
#############################################################
|
||||
|
||||
CC = gcc -g
|
||||
LEX = flex -i -I
|
||||
YACC = bison -d -y
|
||||
ALLOCA =
|
||||
|
||||
############################################################
|
||||
#
|
||||
# DO NOT CHANGE ANYTHING FROM HERE ON !!!!!!!!!
|
||||
#
|
||||
############################################################
|
||||
|
||||
all: expr front myname eof wc replace user_act string1\
|
||||
string2 yymore numbers dates cat
|
||||
|
||||
expr: expr.y expr.lex
|
||||
$(YACC) expr.y
|
||||
$(LEX) expr.lex
|
||||
$(CC) -o expr lex.yy.c y.tab.c $(ALLOCA) -ll -lm
|
||||
|
||||
front: front.y front.lex
|
||||
$(YACC) front.y
|
||||
$(LEX) front.lex
|
||||
$(CC) -o front lex.yy.c y.tab.c $(ALLOCA) -ll -lm
|
||||
|
||||
numbers: numbers.lex
|
||||
$(LEX) numbers.lex
|
||||
$(CC) lex.yy.c -o numbers
|
||||
|
||||
dates: dates.lex
|
||||
$(LEX) dates.lex
|
||||
$(CC) lex.yy.c -o dates -ll
|
||||
|
||||
yymore: yymore.lex
|
||||
$(LEX) yymore.lex
|
||||
$(CC) lex.yy.c -o yymore -ll
|
||||
|
||||
string1: string1.lex
|
||||
$(LEX) string1.lex
|
||||
$(CC) lex.yy.c -o string1 -ll
|
||||
|
||||
string2: string2.lex
|
||||
$(LEX) string2.lex
|
||||
$(CC) lex.yy.c -o string2 -ll
|
||||
|
||||
myname: myname.lex
|
||||
$(LEX) myname.lex
|
||||
$(CC) lex.yy.c -o myname -ll
|
||||
|
||||
myname2: myname2.lex
|
||||
$(LEX) myname2.lex
|
||||
$(CC) lex.yy.c -o myname2 -ll
|
||||
|
||||
eof: eof_rules.lex
|
||||
$(LEX) eof_rules.lex
|
||||
$(CC) lex.yy.c -o eof -ll
|
||||
|
||||
wc: wc.lex
|
||||
$(LEX) wc.lex
|
||||
$(CC) lex.yy.c -o wc -ll
|
||||
|
||||
cat: cat.lex
|
||||
$(LEX) cat.lex
|
||||
$(CC) lex.yy.c -o cat -ll
|
||||
|
||||
replace: replace.lex
|
||||
$(LEX) replace.lex
|
||||
$(CC) lex.yy.c -o replace -ll
|
||||
|
||||
user_act: expr.y expr.lex
|
||||
$(LEX) user_act.lex
|
||||
$(CC) -o user_act lex.yy.c -ll
|
||||
|
||||
clean:
|
||||
rm -f *.BAK *.o core *~* *.a
|
||||
rm -f *.tab.h *.tab.c
|
||||
rm -f myname expr lex.yy.c *.out eof wc yymore
|
||||
rm -f replace front user_act string1 string2
|
||||
rm -f dates numbers cat
|
||||
@@ -0,0 +1,12 @@
|
||||
This directory contains the example programs from the manual, and a
|
||||
few other things as well. To make all the programs, simply type "make
|
||||
-f Makefile.examples", and assuming you have flex and gcc, all will be
|
||||
well.
|
||||
|
||||
To build the programs individually, type
|
||||
|
||||
make -f Makefile.examples program_name
|
||||
|
||||
For example:
|
||||
|
||||
make -f Makefile.examples expr
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* cat.lex: A demonstration of YY_NEW_FILE.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
|
||||
char **names = NULL;
|
||||
int current = 1;
|
||||
%}
|
||||
|
||||
%%
|
||||
<<EOF>> {
|
||||
current += 1;
|
||||
if(names[current] != NULL){
|
||||
yyin = fopen(names[current],"r");
|
||||
if(yyin == NULL){
|
||||
fprintf(stderr,"cat: unable to open %s\n",
|
||||
names[current]);
|
||||
yyterminate();
|
||||
}
|
||||
YY_NEW_FILE;
|
||||
} else {
|
||||
yyterminate();
|
||||
}
|
||||
}
|
||||
%%
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc < 2){
|
||||
fprintf(stderr,"Usage: cat files....\n");
|
||||
exit(1);
|
||||
}
|
||||
names = argv;
|
||||
|
||||
yyin = fopen(names[current],"r");
|
||||
if(yyin == NULL){
|
||||
fprintf(stderr,"cat: unable to open %s\n",
|
||||
names[current]);
|
||||
yyterminate();
|
||||
}
|
||||
|
||||
yylex();
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* dates.lex: An example of using start states to
|
||||
* distinguish between different date formats.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <ctype.h>
|
||||
|
||||
char month[20],dow[20],day[20],year[20];
|
||||
|
||||
%}
|
||||
|
||||
skip of|the|[ \t,]*
|
||||
|
||||
mon (mon(day)?)
|
||||
tue (tue(sday)?)
|
||||
wed (wed(nesday)?)
|
||||
thu (thu(rsday)?)
|
||||
fri (fri(day)?)
|
||||
sat (sat(urday)?)
|
||||
sun (sun(day)?)
|
||||
|
||||
day_of_the_week ({mon}|{tue}|{wed}|{thu}|{fri}|{sat}|{sun})
|
||||
|
||||
jan (jan(uary)?)
|
||||
feb (feb(ruary)?)
|
||||
mar (mar(ch)?)
|
||||
apr (apr(il)?)
|
||||
may (may)
|
||||
jun (jun(e)?)
|
||||
jul (jul(y)?)
|
||||
aug (aug(ust)?)
|
||||
sep (sep(tember)?)
|
||||
oct (oct(ober)?)
|
||||
nov (nov(ember)?)
|
||||
dec (dec(ember)?)
|
||||
|
||||
first_half ({jan}|{feb}|{mar}|{apr}|{may}|{jun})
|
||||
second_half ({jul}|{aug}|{sep}|{oct}|{nov}|{dec})
|
||||
month {first_half}|{second_half}
|
||||
|
||||
nday [1-9]|[1-2][0-9]|3[0-1]
|
||||
nmonth [1-9]|1[0-2]
|
||||
nyear [0-9]{1,4}
|
||||
|
||||
year_ext (ad|AD|bc|BC)?
|
||||
day_ext (st|nd|rd|th)?
|
||||
|
||||
%s LONG SHORT
|
||||
%s DAY DAY_FIRST YEAR_FIRST YEAR_LAST YFMONTH YLMONTH
|
||||
|
||||
%%
|
||||
|
||||
/* the default is month-day-year */
|
||||
|
||||
<LONG>{day_of_the_week} strcpy(dow,yytext);
|
||||
<LONG>{month} strcpy(month,yytext); BEGIN(DAY);
|
||||
|
||||
/* handle the form: day-month-year */
|
||||
|
||||
<LONG>{nday}{day_ext} strcpy(day,yytext); BEGIN(DAY_FIRST);
|
||||
<DAY_FIRST>{month} strcpy(month,yytext); BEGIN(LONG);
|
||||
<DAY>{nday}{day_ext} strcpy(day,yytext); BEGIN(LONG);
|
||||
|
||||
<LONG>{nyear}{year_ext} {
|
||||
printf("Long:\n");
|
||||
printf(" DOW : %s \n",dow);
|
||||
printf(" Day : %s \n",day);
|
||||
printf(" Month : %s \n",month);
|
||||
printf(" Year : %s \n",yytext);
|
||||
strcpy(dow,"");
|
||||
strcpy(day,"");
|
||||
strcpy(month,"");
|
||||
}
|
||||
|
||||
/* handle dates of the form: day-month-year */
|
||||
|
||||
<SHORT>{nday} strcpy(day,yytext); BEGIN(YEAR_LAST);
|
||||
<YEAR_LAST>{nmonth} strcpy(month,yytext);BEGIN(YLMONTH);
|
||||
<YLMONTH>{nyear} strcpy(year,yytext); BEGIN(SHORT);
|
||||
|
||||
/* handle dates of the form: year-month-day */
|
||||
|
||||
<SHORT>{nyear} strcpy(year,yytext); BEGIN(YEAR_FIRST);
|
||||
<YEAR_FIRST>{nmonth} strcpy(month,yytext);BEGIN(YFMONTH);
|
||||
<YFMONTH>{nday} strcpy(day,yytext); BEGIN(SHORT);
|
||||
|
||||
|
||||
<SHORT>\n {
|
||||
printf("Short:\n");
|
||||
printf(" Day : %s \n",day);
|
||||
printf(" Month : %s \n",month);
|
||||
printf(" Year : %s \n",year);
|
||||
strcpy(year,"");
|
||||
strcpy(day,"");
|
||||
strcpy(month,"");
|
||||
}
|
||||
|
||||
long\n BEGIN(LONG);
|
||||
short\n BEGIN(SHORT);
|
||||
|
||||
{skip}*
|
||||
\n
|
||||
.
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
short
|
||||
1989:12:23
|
||||
1989:11:12
|
||||
23:12:1989
|
||||
11:12:1989
|
||||
1989/12/23
|
||||
1989/11/12
|
||||
23/12/1989
|
||||
11/12/1989
|
||||
1989-12-23
|
||||
1989-11-12
|
||||
23-12-1989
|
||||
11-12-1989
|
||||
long
|
||||
Friday the 5th of January, 1989
|
||||
Friday, 5th of January, 1989
|
||||
Friday, January 5th, 1989
|
||||
Fri, January 5th, 1989
|
||||
Fri, Jan 5th, 1989
|
||||
Fri, Jan 5, 1989
|
||||
FriJan 5, 1989
|
||||
FriJan5, 1989
|
||||
FriJan51989
|
||||
Jan51989
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* eof_rules.lex : An example of using multiple buffers
|
||||
* EOF rules, and start states
|
||||
*/
|
||||
|
||||
%{
|
||||
|
||||
#define MAX_NEST 10
|
||||
|
||||
YY_BUFFER_STATE include_stack[MAX_NEST];
|
||||
int include_count = -1;
|
||||
|
||||
%}
|
||||
|
||||
|
||||
%x INCLUDE
|
||||
|
||||
%%
|
||||
|
||||
^"#include"[ \t]*\" BEGIN(INCLUDE);
|
||||
<INCLUDE>\" BEGIN(INITIAL);
|
||||
<INCLUDE>[^\"]+ { /* get the include file name */
|
||||
if ( include_count >= MAX_NEST){
|
||||
fprintf( stderr, "Too many include files" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
include_stack[++include_count] = YY_CURRENT_BUFFER;
|
||||
|
||||
yyin = fopen( yytext, "r" );
|
||||
if ( ! yyin ){
|
||||
fprintf( stderr, "Unable to open \"%s\"\n",yytext);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
|
||||
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<INCLUDE><<EOF>>
|
||||
{
|
||||
fprintf( stderr, "EOF in include" );
|
||||
yyterminate();
|
||||
}
|
||||
<<EOF>> {
|
||||
if ( include_count <= 0 ){
|
||||
yyterminate();
|
||||
} else {
|
||||
yy_delete_buffer(include_stack[include_count--] );
|
||||
yy_switch_to_buffer(include_stack[include_count] );
|
||||
BEGIN(INCLUDE);
|
||||
}
|
||||
}
|
||||
[a-z]+ ECHO;
|
||||
.|\n ECHO;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
This is test file #1
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
We will now include test #2 in a standard way.
|
||||
|
||||
#include "eof_test02.txt"
|
||||
|
||||
-------------------------------------------------
|
||||
|
||||
And now we will include test # 2 with a different
|
||||
format
|
||||
|
||||
#include "eof_test02.txt"
|
||||
-------------------------------------------------
|
||||
|
||||
and this is the end of the test.
|
||||
@@ -0,0 +1,8 @@
|
||||
INCLUDE #2
|
||||
|
||||
This is the second file that will
|
||||
be included.
|
||||
|
||||
>>> Foo are GNU?
|
||||
|
||||
#include "eof_test03.txt"
|
||||
@@ -0,0 +1,7 @@
|
||||
INCLUDE #3
|
||||
|
||||
This is the third file that will
|
||||
be included.
|
||||
|
||||
>>> echo "I am `whoami`!!"
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* expr.lex : Scanner for a simple
|
||||
* expression parser.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include "y.tab.h"
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
[0-9]+ { yylval.val = atol(yytext);
|
||||
return(NUMBER);
|
||||
}
|
||||
[0-9]+\.[0-9]+ {
|
||||
sscanf(yytext,"%f",&yylval.val);
|
||||
return(NUMBER);
|
||||
}
|
||||
"+" return(PLUS);
|
||||
"-" return(MINUS);
|
||||
"*" return(MULT);
|
||||
"/" return(DIV);
|
||||
"^" return(EXPON);
|
||||
"(" return(LB);
|
||||
")" return(RB);
|
||||
\n return(EOL);
|
||||
[\t ]* /* throw away whitespace */
|
||||
. { yyerror("Illegal character");
|
||||
return(EOL);
|
||||
}
|
||||
%%
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* expr.y : A simple yacc expression parser
|
||||
* Based on the Bison manual example.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
float val;
|
||||
}
|
||||
|
||||
%token NUMBER
|
||||
%token PLUS MINUS MULT DIV EXPON
|
||||
%token EOL
|
||||
%token LB RB
|
||||
|
||||
%left MINUS PLUS
|
||||
%left MULT DIV
|
||||
%right EXPON
|
||||
|
||||
%type <val> exp NUMBER
|
||||
|
||||
%%
|
||||
input :
|
||||
| input line
|
||||
;
|
||||
|
||||
line : EOL
|
||||
| exp EOL { printf("%g\n",$1);}
|
||||
|
||||
exp : NUMBER { $$ = $1; }
|
||||
| exp PLUS exp { $$ = $1 + $3; }
|
||||
| exp MINUS exp { $$ = $1 - $3; }
|
||||
| exp MULT exp { $$ = $1 * $3; }
|
||||
| exp DIV exp { $$ = $1 / $3; }
|
||||
| MINUS exp %prec MINUS { $$ = -$2; }
|
||||
| exp EXPON exp { $$ = pow($1,$3);}
|
||||
| LB exp RB { $$ = $2; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
yyerror(char *message)
|
||||
{
|
||||
printf("%s\n",message);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
yyparse();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "y.tab.h" /* this comes from bison */
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define copy_and_return(token_type) { strcpy(yylval.name,yytext); \
|
||||
return(token_type); }
|
||||
|
||||
int yylexlinenum = 0; /* so we can count lines */
|
||||
%}
|
||||
|
||||
%%
|
||||
/* Lexical scanning rules begin from here. */
|
||||
|
||||
MEN|WOMEN|STOCKS|TREES copy_and_return(NOUN)
|
||||
MISTAKES|GNUS|EMPLOYEES copy_and_return(NOUN)
|
||||
LOSERS|USERS|CARS|WINDOWS copy_and_return(NOUN)
|
||||
|
||||
DATABASE|NETWORK|FSF|GNU copy_and_return(PROPER_NOUN)
|
||||
COMPANY|HOUSE|OFFICE|LPF copy_and_return(PROPER_NOUN)
|
||||
|
||||
THE|THIS|THAT|THOSE copy_and_return(DECLARATIVE)
|
||||
|
||||
ALL|FIRST|LAST copy_and_return(CONDITIONAL)
|
||||
|
||||
FIND|SEARCH|SORT|ERASE|KILL copy_and_return(VERB)
|
||||
ADD|REMOVE|DELETE|PRINT copy_and_return(VERB)
|
||||
|
||||
QUICKLY|SLOWLY|CAREFULLY copy_and_return(ADVERB)
|
||||
|
||||
IN|AT|ON|AROUND|INSIDE|ON copy_and_return(POSITIONAL)
|
||||
|
||||
"." return(PERIOD);
|
||||
"\n" yylexlinenum++; return(NEWLINE);
|
||||
.
|
||||
%%
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/* C code supplied at the beginning of the file. */
|
||||
|
||||
%{
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int yylexlinenum; /* these are in YYlex */
|
||||
extern char *yytext; /* current token */
|
||||
|
||||
|
||||
%}
|
||||
|
||||
/* Keywords and reserved words begin here. */
|
||||
|
||||
%union{ /* this is the data union */
|
||||
char name[128]; /* names */
|
||||
}
|
||||
|
||||
/*-------------------- the reserved words -----------------------------*/
|
||||
|
||||
%token PERIOD
|
||||
%token NEWLINE
|
||||
%token POSITIONAL
|
||||
|
||||
%token VERB
|
||||
%token ADVERB
|
||||
|
||||
%token PROPER_NOUN
|
||||
%token NOUN
|
||||
|
||||
%token DECLARATIVE
|
||||
%token CONDITIONAL
|
||||
|
||||
|
||||
%type <name> declarative
|
||||
%type <name> verb_phrase
|
||||
%type <name> noun_phrase
|
||||
%type <name> position_phrase
|
||||
%type <name> adverb
|
||||
|
||||
%type <name> POSITIONAL VERB ADVERB PROPER_NOUN
|
||||
%type <name> NOUN DECLARATIVE CONDITIONAL
|
||||
|
||||
%%
|
||||
|
||||
sentence_list : sentence
|
||||
| sentence_list NEWLINE sentence
|
||||
;
|
||||
|
||||
|
||||
sentence : verb_phrase noun_phrase position_phrase adverb period
|
||||
{
|
||||
printf("I understand that sentence.\n");
|
||||
printf("VP = %s \n",$1);
|
||||
printf("NP = %s \n",$2);
|
||||
printf("PP = %s \n",$3);
|
||||
printf("AD = %s \n",$4);
|
||||
}
|
||||
| { yyerror("That's a strange sentence !!"); }
|
||||
;
|
||||
|
||||
position_phrase : POSITIONAL declarative PROPER_NOUN
|
||||
{
|
||||
sprintf($$,"%s %s %s",$1,$2,$3);
|
||||
}
|
||||
| /* empty */ { strcpy($$,""); }
|
||||
;
|
||||
|
||||
|
||||
verb_phrase : VERB { strcpy($$,$1); strcat($$," "); }
|
||||
| adverb VERB
|
||||
{
|
||||
sprintf($$,"%s %s",$1,$2);
|
||||
}
|
||||
;
|
||||
|
||||
adverb : ADVERB { strcpy($$,$1); }
|
||||
| /* empty */ { strcpy($$,""); }
|
||||
;
|
||||
|
||||
noun_phrase : DECLARATIVE NOUN
|
||||
{
|
||||
sprintf($$,"%s %s",$1,$2);
|
||||
}
|
||||
| CONDITIONAL declarative NOUN
|
||||
{
|
||||
sprintf($$,"%s %s %s",$1,$2,$3);
|
||||
}
|
||||
| NOUN { strcpy($$,$1); strcat($$," "); }
|
||||
;
|
||||
|
||||
declarative : DECLARATIVE { strcpy($$,$1); }
|
||||
| /* empty */ { strcpy($$,""); }
|
||||
;
|
||||
|
||||
period : /* empty */
|
||||
| PERIOD
|
||||
;
|
||||
|
||||
|
||||
%%
|
||||
|
||||
/* Supplied main() and yyerror() functions. */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
yyparse(); /* parse the file */
|
||||
return(0);
|
||||
}
|
||||
|
||||
int yyerror(char *message)
|
||||
{
|
||||
extern FILE *yyout;
|
||||
|
||||
fprintf(yyout,"\nError at line %5d. (%s) \n",
|
||||
yylexlinenum,message);
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* j2t.lex : An example of the use (possibly abuse!)
|
||||
* of start states.
|
||||
*/
|
||||
|
||||
%{
|
||||
#define MAX_STATES 1024
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CHAPTER "@chapter"
|
||||
#define SECTION "@section"
|
||||
#define SSECTION "@subsection"
|
||||
#define SSSECTION "@subsubsection"
|
||||
|
||||
int states[MAX_STATES];
|
||||
int statep = 0;
|
||||
|
||||
int need_closing = FALSE;
|
||||
|
||||
char buffer[YY_BUF_SIZE];
|
||||
|
||||
extern char *yytext;
|
||||
|
||||
/*
|
||||
* set up the head of the *.texinfo file the program
|
||||
* will produce. This is a standard texinfo header.
|
||||
*/
|
||||
|
||||
void print_header(void)
|
||||
{
|
||||
printf("\\input texinfo @c -*-texinfo-*-\n");
|
||||
printf("@c %c**start of header\n",'%');
|
||||
printf("@setfilename jargon.info\n");
|
||||
printf("@settitle The New Hackers Dictionary\n");
|
||||
printf("@synindex fn cp\n");
|
||||
printf("@synindex vr cp\n");
|
||||
printf("@c %c**end of header\n",'%');
|
||||
printf("@setchapternewpage odd\n");
|
||||
printf("@finalout\n");
|
||||
printf("@c @smallbook\n");
|
||||
printf("\n");
|
||||
printf("@c ==========================================================\n\n");
|
||||
printf("@c This file was produced by j2t. Any mistakes are *not* the\n");
|
||||
printf("@c fault of the jargon file editors. \n");
|
||||
printf("@c ==========================================================\n\n");
|
||||
printf("@titlepage\n");
|
||||
printf("@title The New Hackers Dictionary\n");
|
||||
printf("@subtitle Version 2.9.10\n");
|
||||
printf("@subtitle Generated by j2t\n");
|
||||
printf("@author Eric S. Raymond, Guy L. Steel, Mark Crispin et al.\n");
|
||||
printf("@end titlepage\n");
|
||||
printf("@page\n");
|
||||
printf("\n@c ==========================================================\n");
|
||||
printf("\n\n");
|
||||
printf("@unnumbered Preface\n");
|
||||
printf("@c *******\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* create the tail of the texinfo file produced.
|
||||
*/
|
||||
|
||||
void print_trailer(void)
|
||||
{
|
||||
printf("\n@c ==========================================================\n");
|
||||
printf("@contents\n"); /* print the table of contents */
|
||||
printf("@bye\n\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* write an underline under a section
|
||||
* or chapter so we can find it later.
|
||||
*/
|
||||
|
||||
void write_underline(int len, int space, char ch)
|
||||
{
|
||||
int loop;
|
||||
|
||||
printf("@c ");
|
||||
|
||||
for(loop=3; loop<space; loop++){
|
||||
printf(" ");
|
||||
}
|
||||
|
||||
while(len--){
|
||||
printf("%c",ch);
|
||||
}
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* check for texinfo special characters
|
||||
* and escape them
|
||||
*/
|
||||
|
||||
char *check_and_convert(char *string)
|
||||
{
|
||||
int buffpos = 0;
|
||||
int len,loop;
|
||||
|
||||
len = strlen(string);
|
||||
for(loop=0; loop<len; loop++){
|
||||
if(string[loop] == '@' || string[loop] == '{' || string[loop] == '}'){
|
||||
buffer[buffpos++] = '@';
|
||||
buffer[buffpos++] = string[loop];
|
||||
} else {
|
||||
buffer[buffpos++] = string[loop];
|
||||
}
|
||||
}
|
||||
buffer[buffpos] = '\0';
|
||||
return(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* write out a chapter,section, or subsection
|
||||
* header
|
||||
*/
|
||||
|
||||
void write_block_header(char *type)
|
||||
{
|
||||
int loop;
|
||||
int len;
|
||||
|
||||
(void)check_and_convert(yytext);
|
||||
len = strlen(buffer);
|
||||
for(loop=0; buffer[loop] != '\n';loop++)
|
||||
;
|
||||
buffer[loop] = '\0';
|
||||
printf("%s %s\n",type,buffer);
|
||||
write_underline(strlen(buffer),strlen(type)+1,'*');
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/*
|
||||
* the flex description starts here
|
||||
*/
|
||||
|
||||
%x HEADING EXAMPLE ENUM EXAMPLE2
|
||||
%x BITEM BITEM_ITEM
|
||||
%s LITEM LITEM2
|
||||
|
||||
%%
|
||||
|
||||
^#[^#]*"#" /* skip the header & trailer */
|
||||
/* chapters have asterisks under them
|
||||
* and are terminated by a colon
|
||||
*/
|
||||
^[^\n:]+\n[*]+\n write_block_header(CHAPTER);
|
||||
|
||||
^"= "[A-Z]" ="\n"="* { /* we create a seciton for each category */
|
||||
if(need_closing == TRUE){
|
||||
printf("@end table\n\n\n");
|
||||
}
|
||||
need_closing = TRUE;
|
||||
write_block_header(SECTION);
|
||||
printf("\n\n@table @b\n");
|
||||
}
|
||||
|
||||
"Examples:"[^\.]+ ECHO;
|
||||
|
||||
"*"[^*\n]+"*" { /* @emph{}(emphasized) text */
|
||||
yytext[yyleng-1] = '\0';
|
||||
(void)check_and_convert(&yytext[1]);
|
||||
printf("@i{%s}",buffer);
|
||||
}
|
||||
|
||||
"{{"[^}]+"}}" { /* special emphasis */
|
||||
yytext[yyleng-2] = '\0';
|
||||
(void)check_and_convert(&yytext[2]);
|
||||
printf("@b{%s}",buffer);
|
||||
}
|
||||
|
||||
"{"[^}]+"}" { /* special emphasis */
|
||||
yytext[yyleng-1] = '\0';
|
||||
(void)check_and_convert(&yytext[1]);
|
||||
printf("@b{%s}",buffer);
|
||||
}
|
||||
|
||||
/* escape some special texinfo characters */
|
||||
<INITIAL,LITEM,LITEM2,BITEM,ENUM,EXAMPLE,EXAMPLE2>"@" printf("@@");
|
||||
<INITIAL,LITEM,LITEM2,BITEM,ENUM,EXAMPLE,EXAMPLE2>"{" printf("@{");
|
||||
<INITIAL,LITEM,LITEM2,BITEM,ENUM,EXAMPLE,EXAMPLE2>"}" printf("@}");
|
||||
|
||||
/*
|
||||
* reproduce @example code
|
||||
*/
|
||||
|
||||
":"\n+[^\n0-9*]+\n" "[^ ] {
|
||||
int loop;
|
||||
int len;
|
||||
int cnt;
|
||||
|
||||
printf(":\n\n@example \n");
|
||||
strcpy(buffer,yytext);
|
||||
len = strlen(buffer);
|
||||
cnt = 0;
|
||||
for(loop=len; loop > 0;loop--){
|
||||
if(buffer[loop] == '\n')
|
||||
cnt++;
|
||||
if(cnt == 2)
|
||||
break;
|
||||
}
|
||||
yyless(loop+1);
|
||||
statep++;
|
||||
states[statep] = EXAMPLE2;
|
||||
BEGIN(EXAMPLE2);
|
||||
}
|
||||
<EXAMPLE,EXAMPLE2>^\n {
|
||||
printf("@end example\n\n");
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
|
||||
/*
|
||||
* repoduce @enumerate lists
|
||||
*/
|
||||
|
||||
":"\n+[ \t]*[0-9]+"." {
|
||||
int loop;
|
||||
int len;
|
||||
|
||||
printf(":\n\n@enumerate \n");
|
||||
strcpy(buffer,yytext);
|
||||
len = strlen(buffer);
|
||||
for(loop=len; loop > 0;loop--){
|
||||
if(buffer[loop] == '\n')
|
||||
break;
|
||||
}
|
||||
yyless(loop);
|
||||
statep++;
|
||||
states[statep] = ENUM;
|
||||
BEGIN(ENUM);
|
||||
}
|
||||
|
||||
<ENUM>"@" printf("@@");
|
||||
<ENUM>":"\n+" "[^0-9] {
|
||||
printf(":\n\n@example\n");
|
||||
statep++;
|
||||
states[statep] = EXAMPLE;
|
||||
BEGIN(EXAMPLE);
|
||||
}
|
||||
|
||||
|
||||
<ENUM>\n[ \t]+[0-9]+"." {
|
||||
printf("\n\n@item ");
|
||||
}
|
||||
<ENUM>^[^ ] |
|
||||
<ENUM>\n\n\n[ \t]+[^0-9] {
|
||||
printf("\n\n@end enumerate\n\n");
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
|
||||
/*
|
||||
* reproduce one kind of @itemize list
|
||||
*/
|
||||
|
||||
":"\n+":" {
|
||||
int loop;
|
||||
int len;
|
||||
|
||||
printf(":\n\n@itemize @bullet \n");
|
||||
yyless(2);
|
||||
statep++;
|
||||
states[statep] = LITEM2;
|
||||
BEGIN(LITEM2);
|
||||
}
|
||||
<LITEM2>^":".+":" {
|
||||
(void)check_and_convert(&yytext[1]);
|
||||
buffer[strlen(buffer)-1]='\0';
|
||||
printf("@item @b{%s:}\n",buffer);
|
||||
}
|
||||
|
||||
<LITEM2>\n\n\n+[^:\n] {
|
||||
printf("\n\n@end itemize\n\n");
|
||||
ECHO;
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
|
||||
/*
|
||||
* create a list out of the revision history part.
|
||||
* We need the "Version" for this because it
|
||||
* clashes with other rules otherwise.
|
||||
*/
|
||||
|
||||
:[\n]+"Version"[^:\n*]+":" {
|
||||
int loop;
|
||||
int len;
|
||||
|
||||
printf(":\n\n@itemize @bullet \n");
|
||||
strcpy(buffer,yytext);
|
||||
len = strlen(buffer);
|
||||
for(loop=len; loop > 0;loop--){
|
||||
if(buffer[loop] == '\n')
|
||||
break;
|
||||
}
|
||||
yyless(loop);
|
||||
statep++;
|
||||
states[statep] = LITEM;
|
||||
BEGIN(LITEM);
|
||||
}
|
||||
<LITEM>^.+":" {
|
||||
(void)check_and_convert(yytext);
|
||||
buffer[strlen(buffer)-1]='\0';
|
||||
printf("@item @b{%s}\n\n",buffer);
|
||||
}
|
||||
|
||||
<LITEM>^[^:\n]+\n\n[^:\n]+\n {
|
||||
int loop;
|
||||
|
||||
strcpy(buffer,yytext);
|
||||
for(loop=0; buffer[loop] != '\n'; loop++);
|
||||
buffer[loop] = '\0';
|
||||
printf("%s\n",buffer);
|
||||
printf("@end itemize\n\n");
|
||||
printf("%s",&buffer[loop+1]);
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
|
||||
/*
|
||||
* reproduce @itemize @bullet lists
|
||||
*/
|
||||
|
||||
":"\n[ ]*"*" {
|
||||
int loop;
|
||||
int len;
|
||||
|
||||
printf(":\n\n@itemize @bullet \n");
|
||||
len = strlen(buffer);
|
||||
for(loop=0; loop < len;loop++){
|
||||
if(buffer[loop] == '\n')
|
||||
break;
|
||||
}
|
||||
yyless((len-loop)+2);
|
||||
statep++;
|
||||
states[statep] = BITEM;
|
||||
BEGIN(BITEM);
|
||||
}
|
||||
|
||||
<BITEM>^" "*"*" {
|
||||
printf("@item");
|
||||
statep++;
|
||||
states[statep] = BITEM_ITEM;
|
||||
BEGIN(BITEM_ITEM);
|
||||
}
|
||||
<BITEM>"@" printf("@@");
|
||||
<BITEM>^\n {
|
||||
printf("@end itemize\n\n");
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
<BITEM_ITEM>[^\:]* {
|
||||
printf(" @b{%s}\n\n",check_and_convert(yytext));
|
||||
}
|
||||
<BITEM_ITEM>":" {
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
|
||||
/*
|
||||
* recreate @chapter, @section etc.
|
||||
*/
|
||||
|
||||
^:[^:]* {
|
||||
(void)check_and_convert(&yytext[1]);
|
||||
statep++;
|
||||
states[statep] = HEADING;
|
||||
BEGIN(HEADING);
|
||||
}
|
||||
<HEADING>:[^\n] {
|
||||
printf("@item @b{%s}\n",buffer);
|
||||
write_underline(strlen(buffer),6,'~');
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
<HEADING>:\n"*"* {
|
||||
if(need_closing == TRUE){
|
||||
printf("@end table\n\n\n");
|
||||
need_closing = FALSE;
|
||||
}
|
||||
printf("@chapter %s\n",buffer);
|
||||
write_underline(strlen(buffer),9,'*');
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
<HEADING>:\n"="* {
|
||||
if(need_closing == TRUE){
|
||||
printf("@end table\n\n\n");
|
||||
need_closing = FALSE;
|
||||
}
|
||||
printf("@section %s\n",buffer);
|
||||
write_underline(strlen(buffer),9,'=');
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
<HEADING>"@" printf("@@");
|
||||
<HEADING>:\n"-"* {
|
||||
if(need_closing == TRUE){
|
||||
printf("@end table\n\n\n");
|
||||
need_closing = FALSE;
|
||||
}
|
||||
printf("@subsection %s\n",buffer);
|
||||
write_underline(strlen(buffer),12,'-');
|
||||
statep--;
|
||||
BEGIN(states[statep]);
|
||||
}
|
||||
|
||||
/*
|
||||
* recreate @example text
|
||||
*/
|
||||
|
||||
^" " {
|
||||
printf("@example\n");
|
||||
statep++;
|
||||
states[statep] = EXAMPLE;
|
||||
BEGIN(EXAMPLE);
|
||||
}
|
||||
<EXAMPLE>^" "
|
||||
. ECHO;
|
||||
|
||||
%%
|
||||
|
||||
/*
|
||||
* initialise and go.
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
states[0] = INITIAL;
|
||||
statep = 0;
|
||||
print_header();
|
||||
yylex();
|
||||
print_trailer();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
*
|
||||
* myname.lex : A sample Flex program
|
||||
* that does token replacement.
|
||||
*/
|
||||
|
||||
%%
|
||||
|
||||
%NAME { printf("%s",getenv("LOGNAME")); }
|
||||
%HOST { printf("%s",getenv("HOST")); }
|
||||
%HOSTTYPE { printf("%s",getenv("HOSTTYPE"));}
|
||||
%HOME { printf("%s",getenv("HOME")); }
|
||||
|
||||
%%
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Hello, my name name is %NAME. Actually
|
||||
"%NAME" isn't my real name, it is the
|
||||
alias I use when I'm on %HOST, which
|
||||
is the %HOSTTYPE I use. My HOME
|
||||
directory is %HOME.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* myname2.lex : A sample Flex program
|
||||
* that does token replacement.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
%}
|
||||
|
||||
%x STRING
|
||||
%%
|
||||
\" ECHO; BEGIN(STRING);
|
||||
<STRING>[^\"\n]* ECHO;
|
||||
<STRING>\" ECHO; BEGIN(INITIAL);
|
||||
|
||||
%NAME { printf("%s",getenv("LOGNAME")); }
|
||||
%HOST { printf("%s",getenv("HOST")); }
|
||||
%HOSTTYPE { printf("%s",getenv("HOSTTYPE"));}
|
||||
%HOME { printf("%s",getenv("HOME")); }
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* numbers.lex : An example of the definitions and techniques
|
||||
* for scanning numbers
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
|
||||
#define UNSIGNED_LONG_SYM 1
|
||||
#define SIGNED_LONG_SYM 2
|
||||
#define UNSIGNED_SYM 3
|
||||
#define SIGNED_SYM 4
|
||||
#define LONG_DOUBLE_SYM 5
|
||||
#define FLOAT_SYM 6
|
||||
|
||||
union _yylval {
|
||||
long double ylong_double;
|
||||
float yfloat;
|
||||
unsigned long yunsigned_long;
|
||||
unsigned yunsigned;
|
||||
long ysigned_long;
|
||||
int ysigned;
|
||||
} yylval;
|
||||
|
||||
%}
|
||||
|
||||
digit [0-9]
|
||||
hex_digit [0-9a-fA-F]
|
||||
oct_digit [0-7]
|
||||
|
||||
exponent [eE][+-]?{digit}+
|
||||
i {digit}+
|
||||
float_constant ({i}\.{i}?|{i}?\.{i}){exponent}?
|
||||
hex_constant 0[xX]{hex_digit}+
|
||||
oct_constant 0{oct_digit}*
|
||||
int_constant {digit}+
|
||||
long_ext [lL]
|
||||
unsigned_ext [uU]
|
||||
float_ext [fF]
|
||||
ulong_ext {long_ext}{unsigned_ext}|{unsigned_ext}{long_ext}
|
||||
|
||||
%%
|
||||
|
||||
{hex_constant}{ulong_ext} { /* we need to skip the "0x" part */
|
||||
sscanf(&yytext[2],"%lx",&yylval.yunsigned_long);
|
||||
return(UNSIGNED_LONG_SYM);
|
||||
}
|
||||
{hex_constant}{long_ext} {
|
||||
sscanf(&yytext[2],"%lx",&yylval.ysigned_long);
|
||||
return(SIGNED_LONG_SYM);
|
||||
}
|
||||
{hex_constant}{unsigned_ext} {
|
||||
sscanf(&yytext[2],"%x",&yylval.yunsigned);
|
||||
return(UNSIGNED_SYM);
|
||||
}
|
||||
{hex_constant} { /* use %lx to protect against overflow */
|
||||
sscanf(&yytext[2],"%lx",&yylval.ysigned_long);
|
||||
return(SIGNED_LONG_SYM);
|
||||
}
|
||||
{oct_constant}{ulong_ext} {
|
||||
sscanf(yytext,"%lo",&yylval.yunsigned_long);
|
||||
return(UNSIGNED_LONG_SYM);
|
||||
}
|
||||
{oct_constant}{long_ext} {
|
||||
sscanf(yytext,"%lo",&yylval.ysigned_long);
|
||||
return(SIGNED_LONG_SYM);
|
||||
}
|
||||
{oct_constant}{unsigned_ext} {
|
||||
sscanf(yytext,"%o",&yylval.yunsigned);
|
||||
return(UNSIGNED_SYM);
|
||||
}
|
||||
{oct_constant} { /* use %lo to protect against overflow */
|
||||
sscanf(yytext,"%lo",&yylval.ysigned_long);
|
||||
return(SIGNED_LONG_SYM);
|
||||
}
|
||||
{int_constant}{ulong_ext} {
|
||||
sscanf(yytext,"%ld",&yylval.yunsigned_long);
|
||||
return(UNSIGNED_LONG_SYM);
|
||||
}
|
||||
{int_constant}{long_ext} {
|
||||
sscanf(yytext,"%ld",&yylval.ysigned_long);
|
||||
return(SIGNED_LONG_SYM);
|
||||
}
|
||||
{int_constant}{unsigned_ext} {
|
||||
sscanf(yytext,"%d",&yylval.yunsigned);
|
||||
return(UNSIGNED_SYM);
|
||||
}
|
||||
{int_constant} { /* use %ld to protect against overflow */
|
||||
sscanf(yytext,"%ld",&yylval.ysigned_long);
|
||||
return(SIGNED_LONG_SYM);
|
||||
}
|
||||
{float_constant}{long_ext} {
|
||||
sscanf(yytext,"%lf",&yylval.ylong_double);
|
||||
return(LONG_DOUBLE_SYM);
|
||||
}
|
||||
{float_constant}{float_ext} {
|
||||
sscanf(yytext,"%f",&yylval.yfloat);
|
||||
return(FLOAT_SYM);
|
||||
}
|
||||
{float_constant} { /* use %lf to protect against overflow */
|
||||
sscanf(yytext,"%lf",&yylval.ylong_double);
|
||||
return(LONG_DOUBLE_SYM);
|
||||
}
|
||||
%%
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int code;
|
||||
|
||||
while((code = yylex())){
|
||||
printf("yytext : %s\n",yytext);
|
||||
switch(code){
|
||||
case UNSIGNED_LONG_SYM:
|
||||
printf("Type of number : UNSIGNED LONG\n");
|
||||
printf("Value of number : %lu\n",yylval.yunsigned_long);
|
||||
break;
|
||||
case SIGNED_LONG_SYM:
|
||||
printf("Type of number : SIGNED LONG\n");
|
||||
printf("Value of number : %ld\n",yylval.ysigned_long);
|
||||
break;
|
||||
case UNSIGNED_SYM:
|
||||
printf("Type of number : UNSIGNED\n");
|
||||
printf("Value of number : %u\n",yylval.yunsigned);
|
||||
break;
|
||||
case SIGNED_SYM:
|
||||
printf("Type of number : SIGNED\n");
|
||||
printf("Value of number : %d\n",yylval.ysigned);
|
||||
break;
|
||||
case LONG_DOUBLE_SYM:
|
||||
printf("Type of number : LONG DOUBLE\n");
|
||||
printf("Value of number : %lf\n",yylval.ylong_double);
|
||||
break;
|
||||
case FLOAT_SYM:
|
||||
printf("Type of number : FLOAT\n");
|
||||
printf("Value of number : %f\n",yylval.yfloat);
|
||||
break;
|
||||
default:
|
||||
printf("Type of number : UNDEFINED\n");
|
||||
printf("Value of number : UNDEFINED\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* eof_rules.lex : An example of using multiple buffers
|
||||
* EOF rules, and start states
|
||||
*/
|
||||
|
||||
%{
|
||||
|
||||
#define MAX_NEST 10
|
||||
|
||||
YY_BUFFER_STATE include_stack[MAX_NEST];
|
||||
int include_count = -1;
|
||||
|
||||
%}
|
||||
|
||||
|
||||
%x INCLUDE
|
||||
%x COMMENT
|
||||
|
||||
|
||||
%%
|
||||
|
||||
"{" BEGIN(COMMENT);
|
||||
|
||||
<COMMENT>"}" BEGIN(INITIAL);
|
||||
<COMMENT>"$include"[ \t]*"(" BEGIN(INCLUDE);
|
||||
<COMMENT>[ \t]* /* skip whitespace */
|
||||
|
||||
<INCLUDE>")" BEGIN(COMMENT);
|
||||
<INCLUDE>[ \t]* /* skip whitespace */
|
||||
<INCLUDE>[^ \t\n() ]+ { /* get the include file name */
|
||||
if ( include_count >= MAX_NEST){
|
||||
fprintf( stderr, "Too many include files" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
include_stack[++include_count] = YY_CURRENT_BUFFER;
|
||||
|
||||
yyin = fopen( yytext, "r" );
|
||||
if ( ! yyin ){
|
||||
fprintf( stderr, "Unable to open %s",yytext);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
|
||||
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<INCLUDE><<EOF>>
|
||||
{
|
||||
fprintf( stderr, "EOF in include" );
|
||||
yyterminate();
|
||||
}
|
||||
<COMMENT><<EOF>>
|
||||
{
|
||||
fprintf( stderr, "EOF in comment" );
|
||||
yyterminate();
|
||||
}
|
||||
<<EOF>> {
|
||||
if ( include_count <= 0 ){
|
||||
yyterminate();
|
||||
} else {
|
||||
yy_delete_buffer(include_stack[include_count--] );
|
||||
yy_switch_to_buffer(include_stack[include_count] );
|
||||
BEGIN(INCLUDE);
|
||||
}
|
||||
}
|
||||
[a-z]+ ECHO;
|
||||
.|\n ECHO;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* pascal.lex: An example PASCAL scanner
|
||||
*
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include "y.tab.h"
|
||||
|
||||
int line_number = 0;
|
||||
|
||||
void yyerror(char *message);
|
||||
|
||||
%}
|
||||
|
||||
%x COMMENT1 COMMENT2
|
||||
|
||||
white_space [ \t]*
|
||||
digit [0-9]
|
||||
alpha [A-Za-z_]
|
||||
alpha_num ({alpha}|{digit})
|
||||
hex_digit [0-9A-F]
|
||||
identifier {alpha}{alpha_num}*
|
||||
unsigned_integer {digit}+
|
||||
hex_integer ${hex_digit}{hex_digit}*
|
||||
exponent e[+-]?{digit}+
|
||||
i {unsigned_integer}
|
||||
real ({i}\.{i}?|{i}?\.{i}){exponent}?
|
||||
string \'([^'\n]|\'\')+\'
|
||||
bad_string \'([^'\n]|\'\')+
|
||||
|
||||
%%
|
||||
|
||||
"{" BEGIN(COMMENT1);
|
||||
<COMMENT1>[^}\n]+
|
||||
<COMMENT1>\n ++line_number;
|
||||
<COMMENT1><<EOF>> yyerror("EOF in comment");
|
||||
<COMMENT1>"}" BEGIN(INITIAL);
|
||||
|
||||
"(*" BEGIN(COMMENT2);
|
||||
<COMMENT2>[^)*\n]+
|
||||
<COMMENT2>\n ++line_number;
|
||||
<COMMENT2><<EOF>> yyerror("EOF in comment");
|
||||
<COMMENT2>"*)" BEGIN(INITIAL);
|
||||
<COMMENT2>[*)]
|
||||
|
||||
/* note that FILE and BEGIN are already
|
||||
* defined in FLEX or C so they can't
|
||||
* be used. This can be overcome in
|
||||
* a cleaner way by defining all the
|
||||
* tokens to start with TOK_ or some
|
||||
* other prefix.
|
||||
*/
|
||||
|
||||
and return(AND);
|
||||
array return(ARRAY);
|
||||
begin return(_BEGIN);
|
||||
case return(CASE);
|
||||
const return(CONST);
|
||||
div return(DIV);
|
||||
do return(DO);
|
||||
downto return(DOWNTO);
|
||||
else return(ELSE);
|
||||
end return(END);
|
||||
file return(_FILE);
|
||||
for return(FOR);
|
||||
function return(FUNCTION);
|
||||
goto return(GOTO);
|
||||
if return(IF);
|
||||
in return(IN);
|
||||
label return(LABEL);
|
||||
mod return(MOD);
|
||||
nil return(NIL);
|
||||
not return(NOT);
|
||||
of return(OF);
|
||||
packed return(PACKED);
|
||||
procedure return(PROCEDURE);
|
||||
program return(PROGRAM);
|
||||
record return(RECORD);
|
||||
repeat return(REPEAT);
|
||||
set return(SET);
|
||||
then return(THEN);
|
||||
to return(TO);
|
||||
type return(TYPE);
|
||||
until return(UNTIL);
|
||||
var return(VAR);
|
||||
while return(WHILE);
|
||||
with return(WITH);
|
||||
|
||||
"<="|"=<" return(LEQ);
|
||||
"=>"|">=" return(GEQ);
|
||||
"<>" return(NEQ);
|
||||
"=" return(EQ);
|
||||
|
||||
".." return(DOUBLEDOT);
|
||||
|
||||
{unsigned_integer} return(UNSIGNED_INTEGER);
|
||||
{real} return(REAL);
|
||||
{hex_integer} return(HEX_INTEGER);
|
||||
{string} return{STRING};
|
||||
{bad_string} yyerror("Unterminated string");
|
||||
|
||||
{identifier} return(IDENTIFIER);
|
||||
|
||||
[*/+\-,^.;:()\[\]] return(yytext[0]);
|
||||
|
||||
{white_space} /* do nothing */
|
||||
\n line_number += 1;
|
||||
. yyerror("Illegal input");
|
||||
|
||||
%%
|
||||
|
||||
void yyerror(char *message)
|
||||
{
|
||||
fprintf(stderr,"Error: \"%s\" in line %d. Token = %s\n",
|
||||
message,line_number,yytext);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* reject.lex: An example of REJECT and unput()
|
||||
* misuse.
|
||||
*/
|
||||
|
||||
%%
|
||||
UNIX {
|
||||
unput('U'); unput('N'); unput('G'); unput('\0');
|
||||
REJECT;
|
||||
}
|
||||
GNU printf("GNU is Not Unix!\n");
|
||||
%%
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* replace.lex : A simple filter for renaming
|
||||
* parts of flex of bison generated
|
||||
* scanners or parsers.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
|
||||
char lower_replace[1024];
|
||||
char upper_replace[1024];
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
"yy" printf("%s",lower_replace);
|
||||
"YY" printf("%s",upper_replace);
|
||||
, ECHO;
|
||||
|
||||
%%
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(argc < 2){
|
||||
printf("Usage %s lower UPPER\n",argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(lower_replace,argv[1]);
|
||||
strcpy(upper_replace,argv[2]);
|
||||
yylex();
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* string1.lex: Handling strings by using input()
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <ctype.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define ALLOC_SIZE 32 /* for (re)allocating the buffer */
|
||||
|
||||
#define isodigit(x) ((x) >= '0' && (x) <= '7')
|
||||
#define hextoint(x) (isdigit((x)) ? (x) - '0' : ((x) - 'A') + 10)
|
||||
|
||||
void yyerror(char *message)
|
||||
{
|
||||
printf("\nError: %s\n",message);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
\" {
|
||||
int inch,count,max_size;
|
||||
char *buffer;
|
||||
int temp;
|
||||
|
||||
buffer = malloc(ALLOC_SIZE);
|
||||
max_size = ALLOC_SIZE;
|
||||
inch = input();
|
||||
count = 0;
|
||||
while(inch != EOF && inch != '"' && inch != '\n'){
|
||||
if(inch == '\\'){
|
||||
inch = input();
|
||||
switch(inch){
|
||||
case '\n': inch = input(); break;
|
||||
case 'b' : inch = '\b'; break;
|
||||
case 't' : inch = '\t'; break;
|
||||
case 'n' : inch = '\n'; break;
|
||||
case 'v' : inch = '\v'; break;
|
||||
case 'f' : inch = '\f'; break;
|
||||
case 'r' : inch = '\r'; break;
|
||||
case 'X' :
|
||||
case 'x' : inch = input();
|
||||
if(isxdigit(inch)){
|
||||
temp = hextoint(toupper(inch));
|
||||
inch = input();
|
||||
if(isxdigit(inch)){
|
||||
temp = (temp << 4) + hextoint(toupper(inch));
|
||||
} else {
|
||||
unput(inch);
|
||||
}
|
||||
inch = temp;
|
||||
} else {
|
||||
unput(inch);
|
||||
inch = 'x';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(isodigit(inch)){
|
||||
temp = inch - '0';
|
||||
inch = input();
|
||||
if(isodigit(inch)){
|
||||
temp = (temp << 3) + (inch - '0');
|
||||
} else {
|
||||
unput(inch);
|
||||
goto done;
|
||||
}
|
||||
inch = input();
|
||||
if(isodigit(inch)){
|
||||
temp = (temp << 3) + (inch - '0');
|
||||
} else {
|
||||
unput(inch);
|
||||
}
|
||||
done:
|
||||
inch = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer[count++] = inch;
|
||||
if(count >= max_size){
|
||||
buffer = realloc(buffer,max_size + ALLOC_SIZE);
|
||||
max_size += ALLOC_SIZE;
|
||||
}
|
||||
inch = input();
|
||||
}
|
||||
if(inch == EOF || inch == '\n'){
|
||||
yyerror("Unterminated string.");
|
||||
}
|
||||
buffer[count] = '\0';
|
||||
printf("String = \"%s\"\n",buffer);
|
||||
free(buffer);
|
||||
}
|
||||
.
|
||||
\n
|
||||
%%
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* string2.lex: An example of using scanning strings
|
||||
* by using start states.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <ctype.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define isodigit(x) ((x) >= '0' && (x) <= '7')
|
||||
#define hextoint(x) (isdigit((x)) ? (x) - '0' : ((x) - 'A') + 10)
|
||||
|
||||
char *buffer = NULL;
|
||||
int buffer_size = 0;
|
||||
|
||||
void yyerror(char *message)
|
||||
{
|
||||
printf("\nError: %s\n",message);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%x STRING
|
||||
|
||||
hex (x|X)[0-9a-fA-F]{1,2}
|
||||
oct [0-7]{1,3}
|
||||
|
||||
%%
|
||||
|
||||
\" {
|
||||
buffer = malloc(1);
|
||||
buffer_size = 1; strcpy(buffer,"");
|
||||
BEGIN(STRING);
|
||||
}
|
||||
<STRING>\n {
|
||||
yyerror("Unterminated string");
|
||||
free(buffer);
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<STRING><<EOF>> {
|
||||
yyerror("EOF in string");
|
||||
free(buffer);
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
<STRING>[^\\\n"] {
|
||||
buffer = realloc(buffer,buffer_size+yyleng+1);
|
||||
buffer_size += yyleng;
|
||||
strcat(buffer,yytext);
|
||||
}
|
||||
<STRING>\\\n /* ignore this */
|
||||
<STRING>\\{hex} {
|
||||
int temp =0,loop = 0;
|
||||
for(loop=yyleng-2; loop>0; loop--){
|
||||
temp <<= 4;
|
||||
temp += hextoint(toupper(yytext[yyleng-loop]));
|
||||
}
|
||||
buffer = realloc(buffer,buffer_size+1);
|
||||
buffer[buffer_size-1] = temp;
|
||||
buffer[buffer_size] = '\0';
|
||||
buffer_size += 1;
|
||||
}
|
||||
<STRING>\\{oct} {
|
||||
int temp =0,loop = 0;
|
||||
for(loop=yyleng-1; loop>0; loop--){
|
||||
temp <<= 3;
|
||||
temp += (yytext[yyleng-loop] - '0');
|
||||
}
|
||||
buffer = realloc(buffer,buffer_size+1);
|
||||
buffer[buffer_size-1] = temp;
|
||||
buffer[buffer_size] = '\0';
|
||||
buffer_size += 1;
|
||||
}
|
||||
<STRING>\\[^\n] {
|
||||
buffer = realloc(buffer,buffer_size+1);
|
||||
switch(yytext[yyleng-1]){
|
||||
case 'b' : buffer[buffer_size-1] = '\b'; break;
|
||||
case 't' : buffer[buffer_size-1] = '\t'; break;
|
||||
case 'n' : buffer[buffer_size-1] = '\n'; break;
|
||||
case 'v' : buffer[buffer_size-1] = '\v'; break;
|
||||
case 'f' : buffer[buffer_size-1] = '\f'; break;
|
||||
case 'r' : buffer[buffer_size-1] = '\r'; break;
|
||||
default : buffer[buffer_size-1] = yytext[yyleng-1];
|
||||
}
|
||||
buffer[buffer_size] = '\0';
|
||||
buffer_size += 1;
|
||||
}
|
||||
<STRING>\" {
|
||||
printf("string = \"%s\"",buffer);
|
||||
free(buffer);
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
%%
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"This is a string"
|
||||
"The next string will be empty"
|
||||
""
|
||||
"This is a string with a \b(\\b) in it"
|
||||
"This is a string with a \t(\\t) in it"
|
||||
"This is a string with a \n(\\n) in it"
|
||||
"This is a string with a \v(\\v) in it"
|
||||
"This is a string with a \f(\\f) in it"
|
||||
"This is a string with a \r(\\r) in it"
|
||||
"This is a string with a \"(\\\") in it"
|
||||
"This is a string with a \z(\\z) in it"
|
||||
"This is a string with a \X4a(\\X4a) in it"
|
||||
"This is a string with a \x4a(\\x4a) in it"
|
||||
"This is a string with a \x7(\\x7) in it"
|
||||
"This is a string with a \112(\\112) in it"
|
||||
"This is a string with a \043(\\043) in it"
|
||||
"This is a string with a \7(\\7) in it"
|
||||
"This is a multi-line \
|
||||
string"
|
||||
"This is an unterminated string
|
||||
"This is an unterminated string too
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* unput.l : An example of what *not*
|
||||
* to do with unput().
|
||||
*/
|
||||
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
|
||||
void putback_yytext(void);
|
||||
%}
|
||||
|
||||
%%
|
||||
foobar putback_yytext();
|
||||
raboof putback_yytext();
|
||||
%%
|
||||
|
||||
void putback_yytext(void)
|
||||
{
|
||||
int i;
|
||||
int l = strlen(yytext);
|
||||
char buffer[YY_BUF_SIZE];
|
||||
|
||||
strcpy(buffer,yytext);
|
||||
printf("Got: %s\n",yytext);
|
||||
for(i=0; i<l; i++){
|
||||
unput(buffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
%{
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
void user_action(void);
|
||||
|
||||
#define YY_USER_ACTION user_action();
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
.* ECHO;
|
||||
\n ECHO;
|
||||
|
||||
%%
|
||||
|
||||
void user_action(void)
|
||||
{
|
||||
int loop;
|
||||
|
||||
for(loop=0; loop<yyleng; loop++){
|
||||
if(islower(yytext[loop])){
|
||||
yytext[loop] = toupper(yytext[loop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
%{
|
||||
#define YY_USER_INIT open_input_file()
|
||||
|
||||
extern FILE *yyin;
|
||||
|
||||
void open_input_file(void)
|
||||
{
|
||||
char *file_name,buffer[1024];
|
||||
|
||||
yyin = NULL;
|
||||
|
||||
while(yyin == NULL){
|
||||
printf("Input file: ");
|
||||
file_name = fgets(buffer,1024,stdin);
|
||||
if(file_name){
|
||||
file_name[strlen(file_name)-1] = '\0';
|
||||
yyin = fopen(file_name,"r");
|
||||
if(yyin == NULL){
|
||||
printf("Unable to open \"%s\"\n",file_name);
|
||||
}
|
||||
} else {
|
||||
printf("stdin\n");
|
||||
yyin = stdin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
%%
|
||||
@@ -0,0 +1,122 @@
|
||||
%{
|
||||
|
||||
/*
|
||||
* wc.lex : A simple example of using FLEX
|
||||
* to create a wc-like utility.
|
||||
*
|
||||
* See MISC/fastwc/ in the flex distribution for examples
|
||||
* of how to write this scanner for maximum performance.
|
||||
*/
|
||||
|
||||
int numchars = 0;
|
||||
int numwords = 0;
|
||||
int numlines = 0;
|
||||
int totchars = 0;
|
||||
int totwords = 0;
|
||||
int totlines = 0;
|
||||
|
||||
/*
|
||||
* rules start from here
|
||||
*/
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
[\n] { numchars++; numlines++; }
|
||||
[\r] { numchars++; }
|
||||
[^ \t\n]+ { numwords++; numchars += yyleng; }
|
||||
. { numchars++; }
|
||||
|
||||
%%
|
||||
|
||||
/*
|
||||
* additional C code start from here. This supplies
|
||||
* all the argument processing etc.
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int loop,first=1;
|
||||
int lflag = 0; /* 1 if we count # of lines */
|
||||
int wflag = 0; /* 1 if we count # of words */
|
||||
int cflag = 0; /* 1 if we count # of characters */
|
||||
int fflag = 0; /* 1 if we have a file name */
|
||||
|
||||
for(loop=1; loop<argc; loop++){
|
||||
if(argv[loop][0] == '-'){
|
||||
switch(argv[loop][1]){
|
||||
case 'l':
|
||||
lflag = 1;
|
||||
break;
|
||||
case 'w':
|
||||
wflag = 1;
|
||||
break;
|
||||
case 'c':
|
||||
cflag = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"unknown option -%c\n",
|
||||
argv[loop][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(lflag == 0 && wflag == 0 && cflag == 0){
|
||||
lflag = wflag = cflag = 1; /* default to all on */
|
||||
}
|
||||
|
||||
for(loop=1; loop<argc; loop++){
|
||||
if(argv[loop][0] != '-'){
|
||||
fflag = 1;
|
||||
numlines = numchars = numwords = 0;
|
||||
if((yyin = fopen(argv[loop],"rb")) != NULL){
|
||||
if(first){
|
||||
first = 0;
|
||||
} else {
|
||||
YY_NEW_FILE;
|
||||
}
|
||||
(void) yylex();
|
||||
fclose(yyin);
|
||||
totwords += numwords;
|
||||
totchars += numchars;
|
||||
totlines += numlines;
|
||||
printf("file : %25s :",argv[loop]) ;
|
||||
if(lflag){
|
||||
fprintf(stdout,"lines %5d ",numlines);
|
||||
}
|
||||
if(cflag){
|
||||
fprintf(stdout,"characters %5d ",numchars);
|
||||
}
|
||||
if(wflag){
|
||||
fprintf(stdout,"words %5d ",numwords);
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
}else{
|
||||
fprintf(stderr,"wc : file not found %s\n",argv[loop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!fflag){
|
||||
fprintf(stderr,"usage : wc [-l -w -c] file [file...]\n");
|
||||
fprintf(stderr,"-l = count lines\n");
|
||||
fprintf(stderr,"-c = count characters\n");
|
||||
fprintf(stderr,"-w = count words\n");
|
||||
exit(1);
|
||||
}
|
||||
for(loop=0;loop<79; loop++){
|
||||
fprintf(stdout,"-");
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"total : %25s ","") ;
|
||||
if(lflag){
|
||||
fprintf(stdout,"lines %5d ",totlines);
|
||||
}
|
||||
if(cflag){
|
||||
fprintf(stdout,"characters %5d ",totchars);
|
||||
}
|
||||
if(wflag){
|
||||
fprintf(stdout,"words %5d ",totwords);
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* yymore.lex: An example of using yymore()
|
||||
* to good effect.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <memory.h>
|
||||
|
||||
void yyerror(char *message)
|
||||
{
|
||||
printf("Error: %s\n",message);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%x STRING
|
||||
|
||||
%%
|
||||
\" BEGIN(STRING);
|
||||
|
||||
<STRING>[^\\\n"]* yymore();
|
||||
<STRING><<EOF>> yyerror("EOF in string."); BEGIN(INITIAL);
|
||||
<STRING>\n yyerror("Unterminated string."); BEGIN(INITIAL);
|
||||
<STRING>\\\n yymore();
|
||||
<STRING>\" {
|
||||
yytext[yyleng-1] = '\0';
|
||||
printf("string = \"%s\"",yytext); BEGIN(INITIAL);
|
||||
}
|
||||
%%
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* yymore.lex: An example of using yymore()
|
||||
* to good effect.
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <memory.h>
|
||||
|
||||
void yyerror(char *message)
|
||||
{
|
||||
printf("Error: %s\n",message);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%x STRING
|
||||
|
||||
%%
|
||||
\" BEGIN(STRING);
|
||||
|
||||
<STRING>[^\\\n"]* yymore();
|
||||
<STRING><<EOF>> yyerror("EOF in string."); BEGIN(INITIAL);
|
||||
<STRING>\n yyerror("Unterminated string."); BEGIN(INITIAL);
|
||||
<STRING>\\\n {
|
||||
bcopy(yytext,yytext+2,yyleng-2);
|
||||
yytext += 2; yyleng -= 2;
|
||||
yymore();
|
||||
}
|
||||
<STRING>\" {
|
||||
yyleng -= 1; yytext[yyleng] = '\0';
|
||||
printf("string = \"%s\"",yytext); BEGIN(INITIAL);
|
||||
}
|
||||
%%
|
||||
@@ -0,0 +1,7 @@
|
||||
"This is a test \
|
||||
of multi-line string \
|
||||
scanning in flex. \
|
||||
This may be breaking some law \
|
||||
of usage though..."
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// An example of using the flex C++ scanner class.
|
||||
|
||||
%option C++ noyywrap
|
||||
|
||||
%{
|
||||
int mylineno = 0;
|
||||
%}
|
||||
|
||||
string \"[^\n"]+\"
|
||||
|
||||
ws [ \t]+
|
||||
|
||||
alpha [A-Za-z]
|
||||
dig [0-9]
|
||||
name ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)*
|
||||
num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)?
|
||||
num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
|
||||
number {num1}|{num2}
|
||||
|
||||
%%
|
||||
|
||||
{ws} /* skip blanks and tabs */
|
||||
|
||||
"/*" {
|
||||
int c;
|
||||
|
||||
while((c = yyinput()) != 0)
|
||||
{
|
||||
if(c == '\n')
|
||||
++mylineno;
|
||||
|
||||
else if(c == '*')
|
||||
{
|
||||
if((c = yyinput()) == '/')
|
||||
break;
|
||||
else
|
||||
unput(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{number} FLEX_STD cout << "number " << YYText() << '\n';
|
||||
|
||||
\n mylineno++;
|
||||
|
||||
{name} FLEX_STD cout << "name " << YYText() << '\n';
|
||||
|
||||
{string} FLEX_STD cout << "string " << YYText() << '\n';
|
||||
|
||||
%%
|
||||
|
||||
int main( int /* argc */, char** /* argv */ )
|
||||
{
|
||||
FlexLexer* lexer = new yyFlexLexer;
|
||||
while(lexer->yylex() != 0)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
@@ -0,0 +1,4 @@
|
||||
noinst_LTLIBRARIES = libcompat.la
|
||||
libcompat_la_SOURCES = lib.c
|
||||
libcompat_la_LIBADD = $(LTLIBOBJS)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/* Since building an empty library could cause problems, we provide a
|
||||
* function to go into the library. We could make this non-trivial by
|
||||
* moving something that flex treats as a library function into this
|
||||
* directory. */
|
||||
|
||||
void do_nothing(){ return;}
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#include <config.h>
|
||||
#undef malloc
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
void *malloc ();
|
||||
|
||||
/* Allocate an N-byte block of memory from the heap.
|
||||
If N is zero, allocate a 1-byte block. */
|
||||
|
||||
void *
|
||||
rpl_malloc (size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
return malloc (n);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#include <config.h>
|
||||
#undef realloc
|
||||
#undef malloc
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
void * rpl_realloc (void *p, size_t n)
|
||||
{
|
||||
void *result;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
n = 1;
|
||||
}
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
result = malloc (n);
|
||||
}
|
||||
else
|
||||
result = realloc (p, n);
|
||||
|
||||
if (result == NULL)
|
||||
errno = ENOMEM;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: A Note About yytext And Memory</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: A Note About yytext And Memory">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: A Note About yytext And Memory">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Memory-Management.html#Memory-Management" rel="up" title="Memory Management">
|
||||
<link href="Serialized-Tables.html#Serialized-Tables" rel="next" title="Serialized Tables">
|
||||
<link href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management" rel="prev" title="Overriding The Default Memory Management">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="A-Note-About-yytext-And-Memory"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Previous: <a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management" accesskey="p" rel="prev">Overriding The Default Memory Management</a>, Up: <a href="Memory-Management.html#Memory-Management" accesskey="u" rel="up">Memory Management</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="A-Note-About-yytext-And-Memory-1"></a>
|
||||
<h3 class="section">21.3 A Note About yytext And Memory</h3>
|
||||
|
||||
<a name="index-yytext_002c-memory-considerations"></a>
|
||||
|
||||
<p>When flex finds a match, <code>yytext</code> points to the first character of the
|
||||
match in the input buffer. The string itself is part of the input buffer, and
|
||||
is <em>NOT</em> allocated separately. The value of yytext will be overwritten the next
|
||||
time yylex() is called. In short, the value of yytext is only valid from within
|
||||
the matched rule’s action.
|
||||
</p>
|
||||
<p>Often, you want the value of yytext to persist for later processing, i.e., by a
|
||||
parser with non-zero lookahead. In order to preserve yytext, you will have to
|
||||
copy it with strdup() or a similar function. But this introduces some headache
|
||||
because your parser is now responsible for freeing the copy of yytext. If you
|
||||
use a yacc or bison parser, (commonly used with flex), you will discover that
|
||||
the error recovery mechanisms can cause memory to be leaked.
|
||||
</p>
|
||||
<p>To prevent memory leaks from strdup’d yytext, you will have to track the memory
|
||||
somehow. Our experience has shown that a garbage collection mechanism or a
|
||||
pooled memory mechanism will save you a lot of grief when writing parsers.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,112 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: About yyscan_t</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: About yyscan_t">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: About yyscan_t">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Reentrant-Detail.html#Reentrant-Detail" rel="up" title="Reentrant Detail">
|
||||
<link href="Reentrant-Functions.html#Reentrant-Functions" rel="next" title="Reentrant Functions">
|
||||
<link href="Extra-Data.html#Extra-Data" rel="prev" title="Extra Data">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="About-yyscan_005ft"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Previous: <a href="Extra-Data.html#Extra-Data" accesskey="p" rel="prev">Extra Data</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="About-yyscan_005ft-1"></a>
|
||||
<h4 class="subsection">19.4.7 About yyscan_t</h4>
|
||||
|
||||
<a name="index-yyscan_005ft-_0028reentrant-only_0029"></a>
|
||||
<p><code>yyscan_t</code> is defined as:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> typedef void* yyscan_t;
|
||||
</pre></div>
|
||||
|
||||
<p>It is initialized by <code>yylex_init()</code> to point to
|
||||
an internal structure. You should never access this value
|
||||
directly. In particular, you should never attempt to free it
|
||||
(use <code>yylex_destroy()</code> instead.)
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,134 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Accessor Methods</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Accessor Methods">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Accessor Methods">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Reentrant-Detail.html#Reentrant-Detail" rel="up" title="Reentrant Detail">
|
||||
<link href="Extra-Data.html#Extra-Data" rel="next" title="Extra Data">
|
||||
<link href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions" rel="prev" title="Init and Destroy Functions">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Accessor-Methods"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Extra-Data.html#Extra-Data" accesskey="n" rel="next">Extra Data</a>, Previous: <a href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions" accesskey="p" rel="prev">Init and Destroy Functions</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Accessing-Variables-with-Reentrant-Scanners"></a>
|
||||
<h4 class="subsection">19.4.5 Accessing Variables with Reentrant Scanners</h4>
|
||||
|
||||
<a name="index-reentrant_002c-accessor-functions"></a>
|
||||
<p>Accessor methods (get/set functions) provide access to common
|
||||
<code>flex</code> variables.
|
||||
</p>
|
||||
<p>Many scanners that you build will be part of a larger project. Portions
|
||||
of your project will need access to <code>flex</code> values, such as
|
||||
<code>yytext</code>. In a non-reentrant scanner, these values are global, so
|
||||
there is no problem accessing them. However, in a reentrant scanner, there are no
|
||||
global <code>flex</code> values. You can not access them directly. Instead,
|
||||
you must access <code>flex</code> values using accessor methods (get/set
|
||||
functions). Each accessor method is named <code>yyget_NAME</code> or
|
||||
<code>yyset_NAME</code>, where <code>NAME</code> is the name of the <code>flex</code>
|
||||
variable you want. For example:
|
||||
</p>
|
||||
<a name="index-accessor-functions_002c-use-of"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> /* Set the last character of yytext to NULL. */
|
||||
void chop ( yyscan_t scanner )
|
||||
{
|
||||
int len = yyget_leng( scanner );
|
||||
yyget_text( scanner )[len - 1] = '\0';
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<p>The above code may be called from within an action like this:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
.+\n { chop( yyscanner );}
|
||||
</pre></div>
|
||||
|
||||
<p>You may find that <code>%option header-file</code> is particularly useful for generating
|
||||
prototypes of all the accessor functions. See <a href="Options-for-Specifying-Filenames.html#option_002dheader">option-header</a>.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,392 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Actions</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Actions">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Actions">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="Generated-Scanner.html#Generated-Scanner" rel="next" title="Generated Scanner">
|
||||
<link href="Matching.html#Matching" rel="prev" title="Matching">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Actions"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Generated-Scanner.html#Generated-Scanner" accesskey="n" rel="next">Generated Scanner</a>, Previous: <a href="Matching.html#Matching" accesskey="p" rel="prev">Matching</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Actions-1"></a>
|
||||
<h2 class="chapter">8 Actions</h2>
|
||||
|
||||
<a name="index-actions"></a>
|
||||
<p>Each pattern in a rule has a corresponding <em>action</em>, which can be
|
||||
any arbitrary C statement. The pattern ends at the first non-escaped
|
||||
whitespace character; the remainder of the line is its action. If the
|
||||
action is empty, then when the pattern is matched the input token is
|
||||
simply discarded. For example, here is the specification for a program
|
||||
which deletes all occurrences of ‘<samp>zap me</samp>’ from its input:
|
||||
</p>
|
||||
<a name="index-deleting-lines-from-input"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
"zap me"
|
||||
</pre></div>
|
||||
|
||||
<p>This example will copy all other characters in the input to the output
|
||||
since they will be matched by the default rule.
|
||||
</p>
|
||||
<p>Here is a program which compresses multiple blanks and tabs down to a
|
||||
single blank, and throws away whitespace found at the end of a line:
|
||||
</p>
|
||||
<a name="index-whitespace_002c-compressing"></a>
|
||||
<a name="index-compressing-whitespace"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
[ \t]+ putchar( ' ' );
|
||||
[ \t]+$ /* ignore this token */
|
||||
</pre></div>
|
||||
|
||||
<a name="index-_0025_007b-and-_0025_007d_002c-in-Rules-Section"></a>
|
||||
<a name="index-actions_002c-use-of-_007b-and-_007d"></a>
|
||||
<a name="index-actions_002c-embedded-C-strings"></a>
|
||||
<a name="index-C_002dstrings_002c-in-actions"></a>
|
||||
<a name="index-comments_002c-in-actions"></a>
|
||||
<p>If the action contains a ‘<samp>{</samp>’, then the action spans till the
|
||||
balancing ‘<samp>}</samp>’ is found, and the action may cross multiple lines.
|
||||
<code>flex</code> knows about C strings and comments and won’t be fooled by
|
||||
braces found within them, but also allows actions to begin with
|
||||
‘<samp>%{</samp>’ and will consider the action to be all the text up to the
|
||||
next ‘<samp>%}</samp>’ (regardless of ordinary braces inside the action).
|
||||
</p>
|
||||
<a name="index-_007c_002c-in-actions"></a>
|
||||
<p>An action consisting solely of a vertical bar (‘<samp>|</samp>’) means “same as the
|
||||
action for the next rule”. See below for an illustration.
|
||||
</p>
|
||||
<p>Actions can include arbitrary C code, including <code>return</code> statements
|
||||
to return a value to whatever routine called <code>yylex()</code>. Each time
|
||||
<code>yylex()</code> is called it continues processing tokens from where it
|
||||
last left off until it either reaches the end of the file or executes a
|
||||
return.
|
||||
</p>
|
||||
<a name="index-yytext_002c-modification-of"></a>
|
||||
<p>Actions are free to modify <code>yytext</code> except for lengthening it
|
||||
(adding characters to its end–these will overwrite later characters in
|
||||
the input stream). This however does not apply when using <code>%array</code>
|
||||
(see <a href="Matching.html#Matching">Matching</a>). In that case, <code>yytext</code> may be freely modified
|
||||
in any way.
|
||||
</p>
|
||||
<a name="index-yyleng_002c-modification-of"></a>
|
||||
<a name="index-yymore_002c-and-yyleng"></a>
|
||||
<p>Actions are free to modify <code>yyleng</code> except they should not do so if
|
||||
the action also includes use of <code>yymore()</code> (see below).
|
||||
</p>
|
||||
<a name="index-preprocessor-macros_002c-for-use-in-actions"></a>
|
||||
<p>There are a number of special directives which can be included within an
|
||||
action:
|
||||
</p>
|
||||
<dl compact="compact">
|
||||
<dt><code>ECHO</code></dt>
|
||||
<dd><a name="index-ECHO"></a>
|
||||
<p>copies yytext to the scanner’s output.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>BEGIN</code></dt>
|
||||
<dd><a name="index-BEGIN"></a>
|
||||
<p>followed by the name of a start condition places the scanner in the
|
||||
corresponding start condition (see below).
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>REJECT</code></dt>
|
||||
<dd><a name="index-REJECT"></a>
|
||||
<p>directs the scanner to proceed on to the “second best” rule which
|
||||
matched the input (or a prefix of the input). The rule is chosen as
|
||||
described above in <a href="Matching.html#Matching">Matching</a>, and <code>yytext</code> and <code>yyleng</code>
|
||||
set up appropriately. It may either be one which matched as much text
|
||||
as the originally chosen rule but came later in the <code>flex</code> input
|
||||
file, or one which matched less text. For example, the following will
|
||||
both count the words in the input and call the routine <code>special()</code>
|
||||
whenever ‘<samp>frob</samp>’ is seen:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> int word_count = 0;
|
||||
%%
|
||||
|
||||
frob special(); REJECT;
|
||||
[^ \t\n]+ ++word_count;
|
||||
</pre></div>
|
||||
|
||||
<p>Without the <code>REJECT</code>, any occurrences of ‘<samp>frob</samp>’ in the input
|
||||
would not be counted as words, since the scanner normally executes only
|
||||
one action per token. Multiple uses of <code>REJECT</code> are allowed, each
|
||||
one finding the next best choice to the currently active rule. For
|
||||
example, when the following scanner scans the token ‘<samp>abcd</samp>’, it will
|
||||
write ‘<samp>abcdabcaba</samp>’ to the output:
|
||||
</p>
|
||||
<a name="index-REJECT_002c-calling-multiple-times"></a>
|
||||
<a name="index-_007c_002c-use-of"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
a |
|
||||
ab |
|
||||
abc |
|
||||
abcd ECHO; REJECT;
|
||||
.|\n /* eat up any unmatched character */
|
||||
</pre></div>
|
||||
|
||||
<p>The first three rules share the fourth’s action since they use the
|
||||
special ‘<samp>|</samp>’ action.
|
||||
</p>
|
||||
<p><code>REJECT</code> is a particularly expensive feature in terms of scanner
|
||||
performance; if it is used in <em>any</em> of the scanner’s actions it
|
||||
will slow down <em>all</em> of the scanner’s matching. Furthermore,
|
||||
<code>REJECT</code> cannot be used with the ‘<samp>-Cf</samp>’ or ‘<samp>-CF</samp>’ options
|
||||
(see <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>).
|
||||
</p>
|
||||
<p>Note also that unlike the other special actions, <code>REJECT</code> is a
|
||||
<em>branch</em>. Code immediately following it in the action will
|
||||
<em>not</em> be executed.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>yymore()</code></dt>
|
||||
<dd><a name="index-yymore_0028_0029"></a>
|
||||
<p>tells the scanner that the next time it matches a rule, the
|
||||
corresponding token should be <em>appended</em> onto the current value of
|
||||
<code>yytext</code> rather than replacing it. For example, given the input
|
||||
‘<samp>mega-kludge</samp>’ the following will write ‘<samp>mega-mega-kludge</samp>’ to
|
||||
the output:
|
||||
</p>
|
||||
<a name="index-yymore_0028_0029_002c-mega_002dkludge"></a>
|
||||
<a name="index-yymore_0028_0029-to-append-token-to-previous-token"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
mega- ECHO; yymore();
|
||||
kludge ECHO;
|
||||
</pre></div>
|
||||
|
||||
<p>First ‘<samp>mega-</samp>’ is matched and echoed to the output. Then ‘<samp>kludge</samp>’
|
||||
is matched, but the previous ‘<samp>mega-</samp>’ is still hanging around at the
|
||||
beginning of
|
||||
<code>yytext</code>
|
||||
so the
|
||||
<code>ECHO</code>
|
||||
for the ‘<samp>kludge</samp>’ rule will actually write ‘<samp>mega-kludge</samp>’.
|
||||
</p></dd>
|
||||
</dl>
|
||||
|
||||
<a name="index-yymore_002c-performance-penalty-of"></a>
|
||||
<p>Two notes regarding use of <code>yymore()</code>. First, <code>yymore()</code>
|
||||
depends on the value of <code>yyleng</code> correctly reflecting the size of
|
||||
the current token, so you must not modify <code>yyleng</code> if you are using
|
||||
<code>yymore()</code>. Second, the presence of <code>yymore()</code> in the
|
||||
scanner’s action entails a minor performance penalty in the scanner’s
|
||||
matching speed.
|
||||
</p>
|
||||
<a name="index-yyless_0028_0029"></a>
|
||||
<p><code>yyless(n)</code> returns all but the first <code>n</code> characters of the
|
||||
current token back to the input stream, where they will be rescanned
|
||||
when the scanner looks for the next match. <code>yytext</code> and
|
||||
<code>yyleng</code> are adjusted appropriately (e.g., <code>yyleng</code> will now
|
||||
be equal to <code>n</code>). For example, on the input ‘<samp>foobar</samp>’ the
|
||||
following will write out ‘<samp>foobarbar</samp>’:
|
||||
</p>
|
||||
<a name="index-yyless_0028_0029_002c-pushing-back-characters"></a>
|
||||
<a name="index-pushing-back-characters-with-yyless"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
foobar ECHO; yyless(3);
|
||||
[a-z]+ ECHO;
|
||||
</pre></div>
|
||||
|
||||
<p>An argument of 0 to <code>yyless()</code> will cause the entire current input
|
||||
string to be scanned again. Unless you’ve changed how the scanner will
|
||||
subsequently process its input (using <code>BEGIN</code>, for example), this
|
||||
will result in an endless loop.
|
||||
</p>
|
||||
<p>Note that <code>yyless()</code> is a macro and can only be used in the flex
|
||||
input file, not from other source files.
|
||||
</p>
|
||||
<a name="index-unput_0028_0029"></a>
|
||||
<a name="index-pushing-back-characters-with-unput"></a>
|
||||
<p><code>unput(c)</code> puts the character <code>c</code> back onto the input stream.
|
||||
It will be the next character scanned. The following action will take
|
||||
the current token and cause it to be rescanned enclosed in parentheses.
|
||||
</p>
|
||||
<a name="index-unput_0028_0029_002c-pushing-back-characters"></a>
|
||||
<a name="index-pushing-back-characters-with-unput_0028_0029"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> {
|
||||
int i;
|
||||
/* Copy yytext because unput() trashes yytext */
|
||||
char *yycopy = strdup( yytext );
|
||||
unput( ')' );
|
||||
for ( i = yyleng - 1; i >= 0; --i )
|
||||
unput( yycopy[i] );
|
||||
unput( '(' );
|
||||
free( yycopy );
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<p>Note that since each <code>unput()</code> puts the given character back at the
|
||||
<em>beginning</em> of the input stream, pushing back strings must be done
|
||||
back-to-front.
|
||||
</p>
|
||||
<a name="index-_0025pointer_002c-and-unput_0028_0029"></a>
|
||||
<a name="index-unput_0028_0029_002c-and-_0025pointer"></a>
|
||||
<p>An important potential problem when using <code>unput()</code> is that if you
|
||||
are using <code>%pointer</code> (the default), a call to <code>unput()</code>
|
||||
<em>destroys</em> the contents of <code>yytext</code>, starting with its
|
||||
rightmost character and devouring one character to the left with each
|
||||
call. If you need the value of <code>yytext</code> preserved after a call to
|
||||
<code>unput()</code> (as in the above example), you must either first copy it
|
||||
elsewhere, or build your scanner using <code>%array</code> instead
|
||||
(see <a href="Matching.html#Matching">Matching</a>).
|
||||
</p>
|
||||
<a name="index-pushing-back-EOF"></a>
|
||||
<a name="index-EOF_002c-pushing-back"></a>
|
||||
<p>Finally, note that you cannot put back ‘<samp>EOF</samp>’ to attempt to mark the
|
||||
input stream with an end-of-file.
|
||||
</p>
|
||||
<a name="index-input_0028_0029"></a>
|
||||
<p><code>input()</code> reads the next character from the input stream. For
|
||||
example, the following is one way to eat up C comments:
|
||||
</p>
|
||||
<a name="index-comments_002c-discarding"></a>
|
||||
<a name="index-discarding-C-comments"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %%
|
||||
"/*" {
|
||||
int c;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
while ( (c = input()) != '*' &&
|
||||
c != EOF )
|
||||
; /* eat up text of comment */
|
||||
|
||||
if ( c == '*' )
|
||||
{
|
||||
while ( (c = input()) == '*' )
|
||||
;
|
||||
if ( c == '/' )
|
||||
break; /* found the end */
|
||||
}
|
||||
|
||||
if ( c == EOF )
|
||||
{
|
||||
error( "EOF in comment" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<a name="index-input_0028_0029_002c-and-C_002b_002b"></a>
|
||||
<a name="index-yyinput_0028_0029"></a>
|
||||
<p>(Note that if the scanner is compiled using <code>C++</code>, then
|
||||
<code>input()</code> is instead referred to as <b>yyinput()</b>, in order to
|
||||
avoid a name clash with the <code>C++</code> stream by the name of
|
||||
<code>input</code>.)
|
||||
</p>
|
||||
<a name="index-flushing-the-internal-buffer"></a>
|
||||
<a name="index-YY_005fFLUSH_005fBUFFER"></a>
|
||||
<p><code>YY_FLUSH_BUFFER;</code> flushes the scanner’s internal buffer so that
|
||||
the next time the scanner attempts to match a token, it will first
|
||||
refill the buffer using <code>YY_INPUT()</code> (see <a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a>).
|
||||
This action is a special case of the more general
|
||||
<code>yy_flush_buffer;</code> function, described below (see <a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a>)
|
||||
</p>
|
||||
<a name="index-yyterminate_0028_0029"></a>
|
||||
<a name="index-terminating-with-yyterminate_0028_0029"></a>
|
||||
<a name="index-exiting-with-yyterminate_0028_0029"></a>
|
||||
<a name="index-halting-with-yyterminate_0028_0029"></a>
|
||||
<p><code>yyterminate()</code> can be used in lieu of a return statement in an
|
||||
action. It terminates the scanner and returns a 0 to the scanner’s
|
||||
caller, indicating “all done”. By default, <code>yyterminate()</code> is
|
||||
also called when an end-of-file is encountered. It is a macro and may
|
||||
be redefined.
|
||||
</p>
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Generated-Scanner.html#Generated-Scanner" accesskey="n" rel="next">Generated Scanner</a>, Previous: <a href="Matching.html#Matching" accesskey="p" rel="prev">Matching</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,135 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Addresses</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Addresses">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Addresses">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Common-Patterns.html#Common-Patterns" rel="up" title="Common Patterns">
|
||||
<link href="Indices.html#Indices" rel="next" title="Indices">
|
||||
<link href="Quoted-Constructs.html#Quoted-Constructs" rel="prev" title="Quoted Constructs">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Addresses"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Previous: <a href="Quoted-Constructs.html#Quoted-Constructs" accesskey="p" rel="prev">Quoted Constructs</a>, Up: <a href="Common-Patterns.html#Common-Patterns" accesskey="u" rel="up">Common Patterns</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Addresses-1"></a>
|
||||
<h4 class="subsection">A.4.4 Addresses</h4>
|
||||
|
||||
<dl compact="compact">
|
||||
<dt>IPv4 Address</dt>
|
||||
<dd><pre class="verbatim">dec-octet [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]
|
||||
IPv4address {dec-octet}\.{dec-octet}\.{dec-octet}\.{dec-octet}
|
||||
</pre>
|
||||
</dd>
|
||||
<dt>IPv6 Address</dt>
|
||||
<dd><pre class="verbatim">h16 [0-9A-Fa-f]{1,4}
|
||||
ls32 {h16}:{h16}|{IPv4address}
|
||||
IPv6address ({h16}:){6}{ls32}|
|
||||
::({h16}:){5}{ls32}|
|
||||
({h16})?::({h16}:){4}{ls32}|
|
||||
(({h16}:){0,1}{h16})?::({h16}:){3}{ls32}|
|
||||
(({h16}:){0,2}{h16})?::({h16}:){2}{ls32}|
|
||||
(({h16}:){0,3}{h16})?::{h16}:{ls32}|
|
||||
(({h16}:){0,4}{h16})?::{ls32}|
|
||||
(({h16}:){0,5}{h16})?::{h16}|
|
||||
(({h16}:){0,6}{h16})?::
|
||||
</pre>
|
||||
<p>See <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC 2373</a> for details.
|
||||
Note that you have to fold the definition of <code>IPv6address</code> into one
|
||||
line and that it also matches the “unspecified address” “::”.
|
||||
</p>
|
||||
</dd>
|
||||
<dt>URI</dt>
|
||||
<dd><p><code>(([^:/?#]+):)?("//"([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?</code>
|
||||
</p>
|
||||
<p>This pattern is nearly useless, since it allows just about any character
|
||||
to appear in a URI, including spaces and control characters. See
|
||||
<a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for details.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,111 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Appendices</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Appendices">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Appendices">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="Makefiles-and-Flex.html#Makefiles-and-Flex" rel="next" title="Makefiles and Flex">
|
||||
<link href="How-do-I-access-the-values-set-in-a-Flex-action-from-within-a-Bison-action_003f.html#How-do-I-access-the-values-set-in-a-Flex-action-from-within-a-Bison-action_003f" rel="prev" title="How do I access the values set in a Flex action from within a Bison action?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Appendices"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Indices.html#Indices" accesskey="n" rel="next">Indices</a>, Previous: <a href="FAQ.html#FAQ" accesskey="p" rel="prev">FAQ</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Appendices-1"></a>
|
||||
<h2 class="appendix">Appendix A Appendices</h2>
|
||||
|
||||
<table class="menu" border="0" cellspacing="0">
|
||||
<tr><td align="left" valign="top">• <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="1">Makefiles and Flex</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
<tr><td align="left" valign="top">• <a href="Bison-Bridge.html#Bison-Bridge" accesskey="2">Bison Bridge</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
<tr><td align="left" valign="top">• <a href="M4-Dependency.html#M4-Dependency" accesskey="3">M4 Dependency</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
<tr><td align="left" valign="top">• <a href="Common-Patterns.html#Common-Patterns" accesskey="4">Common Patterns</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,177 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Are certain equivalent patterns faster than others?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Are certain equivalent patterns faster than others?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Are certain equivalent patterns faster than others?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" rel="next" title="Is backing up a big deal?">
|
||||
<link href="deleteme00.html#deleteme00" rel="prev" title="deleteme00">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Are-certain-equivalent-patterns-faster-than-others_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" accesskey="n" rel="next">Is backing up a big deal?</a>, Previous: <a href="deleteme00.html#deleteme00" accesskey="p" rel="prev">deleteme00</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Are-certain-equivalent-patterns-faster-than-others_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Are certain equivalent patterns faster than others?</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: Adoram Rogel <adoram@orna.hybridge.com>
|
||||
Subject: Re: Flex 2.5.2 performance questions
|
||||
In-reply-to: Your message of Wed, 18 Sep 96 11:12:17 EDT.
|
||||
Date: Wed, 18 Sep 96 10:51:02 PDT
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
[Note, the most recent flex release is 2.5.4, which you can get from
|
||||
ftp.ee.lbl.gov. It has bug fixes over 2.5.2 and 2.5.3.]
|
||||
|
||||
> 1. Using the pattern
|
||||
> ([Ff](oot)?)?[Nn](ote)?(\.)?
|
||||
> instead of
|
||||
> (((F|f)oot(N|n)ote)|((N|n)ote)|((N|n)\.)|((F|f)(N|n)(\.)))
|
||||
> (in a very complicated flex program) caused the program to slow from
|
||||
> 300K+/min to 100K/min (no other changes were done).
|
||||
|
||||
These two are not equivalent. For example, the first can match "footnote."
|
||||
but the second can only match "footnote". This is almost certainly the
|
||||
cause in the discrepancy - the slower scanner run is matching more tokens,
|
||||
and/or having to do more backing up.
|
||||
|
||||
> 2. Which of these two are better: [Ff]oot or (F|f)oot ?
|
||||
|
||||
From a performance point of view, they're equivalent (modulo presumably
|
||||
minor effects such as memory cache hit rates; and the presence of trailing
|
||||
context, see below). From a space point of view, the first is slightly
|
||||
preferable.
|
||||
|
||||
> 3. I have a pattern that look like this:
|
||||
> pats {p1}|{p2}|{p3}|...|{p50} (50 patterns ORd)
|
||||
>
|
||||
> running yet another complicated program that includes the following rule:
|
||||
> <snext>{and}/{no4}{bb}{pats}
|
||||
>
|
||||
> gets me to "too complicated - over 32,000 states"...
|
||||
|
||||
I can't tell from this example whether the trailing context is variable-length
|
||||
or fixed-length (it could be the latter if {and} is fixed-length). If it's
|
||||
variable length, which flex -p will tell you, then this reflects a basic
|
||||
performance problem, and if you can eliminate it by restructuring your
|
||||
scanner, you will see significant improvement.
|
||||
|
||||
> so I divided {pats} to {pats1}, {pats2},..., {pats5} each consists of about
|
||||
> 10 patterns and changed the rule to be 5 rules.
|
||||
> This did compile, but what is the rule of thumb here ?
|
||||
|
||||
The rule is to avoid trailing context other than fixed-length, in which for
|
||||
a/b, either the 'a' pattern or the 'b' pattern have a fixed length. Use
|
||||
of the '|' operator automatically makes the pattern variable length, so in
|
||||
this case '[Ff]oot' is preferred to '(F|f)oot'.
|
||||
|
||||
> 4. I changed a rule that looked like this:
|
||||
> <snext8>{and}{bb}/{ROMAN}[^A-Za-z] { BEGIN...
|
||||
>
|
||||
> to the next 2 rules:
|
||||
> <snext8>{and}{bb}/{ROMAN}[A-Za-z] { ECHO;}
|
||||
> <snext8>{and}{bb}/{ROMAN} { BEGIN...
|
||||
>
|
||||
> Again, I understand the using [^...] will cause a great performance loss
|
||||
|
||||
Actually, it doesn't cause any sort of performance loss. It's a surprising
|
||||
fact about regular expressions that they always match in linear time
|
||||
regardless of how complex they are.
|
||||
|
||||
> but are there any specific rules about it ?
|
||||
|
||||
See the "Performance Considerations" section of the man page, and also
|
||||
the example in MISC/fastwc/.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" accesskey="n" rel="next">Is backing up a big deal?</a>, Previous: <a href="deleteme00.html#deleteme00" accesskey="p" rel="prev">deleteme00</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,122 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Bibliography</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Bibliography">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Bibliography">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="FAQ.html#FAQ" rel="next" title="FAQ">
|
||||
<link href="Limitations.html#Limitations" rel="prev" title="Limitations">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Bibliography"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="FAQ.html#FAQ" accesskey="n" rel="next">FAQ</a>, Previous: <a href="Limitations.html#Limitations" accesskey="p" rel="prev">Limitations</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Additional-Reading"></a>
|
||||
<h2 class="chapter">25 Additional Reading</h2>
|
||||
|
||||
<p>You may wish to read more about the following programs:
|
||||
</p><ul>
|
||||
<li> lex
|
||||
</li><li> yacc
|
||||
</li><li> sed
|
||||
</li><li> awk
|
||||
</li></ul>
|
||||
|
||||
<p>The following books may contain material of interest:
|
||||
</p>
|
||||
<p>John Levine, Tony Mason, and Doug Brown,
|
||||
<em>Lex & Yacc</em>,
|
||||
O’Reilly and Associates. Be sure to get the 2nd edition.
|
||||
</p>
|
||||
<p>M. E. Lesk and E. Schmidt,
|
||||
<em>LEX – Lexical Analyzer Generator</em>
|
||||
</p>
|
||||
<p>Alfred Aho, Ravi Sethi and Jeffrey Ullman, <em>Compilers: Principles,
|
||||
Techniques and Tools</em>, Addison-Wesley (1986). Describes the
|
||||
pattern-matching techniques used by <code>flex</code> (deterministic finite
|
||||
automata).
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,203 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Bison Bridge</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Bison Bridge">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Bison Bridge">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Appendices.html#Appendices" rel="up" title="Appendices">
|
||||
<link href="M4-Dependency.html#M4-Dependency" rel="next" title="M4 Dependency">
|
||||
<link href="Makefiles-and-Flex.html#Makefiles-and-Flex" rel="prev" title="Makefiles and Flex">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Bison-Bridge"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="M4-Dependency.html#M4-Dependency" accesskey="n" rel="next">M4 Dependency</a>, Previous: <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="p" rel="prev">Makefiles and Flex</a>, Up: <a href="Appendices.html#Appendices" accesskey="u" rel="up">Appendices</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="C-Scanners-with-Bison-Parsers"></a>
|
||||
<h3 class="section">A.2 C Scanners with Bison Parsers</h3>
|
||||
|
||||
<a name="index-bison_002c-bridging-with-flex"></a>
|
||||
<a name="index-yylval"></a>
|
||||
<a name="index-yylloc"></a>
|
||||
<a name="index-YYLTYPE"></a>
|
||||
<a name="index-YYSTYPE"></a>
|
||||
|
||||
<p>This section describes the <code>flex</code> features useful when integrating
|
||||
<code>flex</code> with <code>GNU bison</code><a name="DOCF7" href="#FOOT7"><sup>7</sup></a>.
|
||||
Skip this section if you are not using
|
||||
<code>bison</code> with your scanner. Here we discuss only the <code>flex</code>
|
||||
half of the <code>flex</code> and <code>bison</code> pair. We do not discuss
|
||||
<code>bison</code> in any detail. For more information about generating
|
||||
<code>bison</code> parsers, see <cite><a href="http://www.gnu.org/software/bison/manual/html_node/index.html#Top">the GNU Bison Manual</a></cite>.
|
||||
</p>
|
||||
<p>A compatible <code>bison</code> scanner is generated by declaring ‘<samp>%option
|
||||
bison-bridge</samp>’ or by supplying ‘<samp>--bison-bridge</samp>’ when invoking <code>flex</code>
|
||||
from the command line. This instructs <code>flex</code> that the macro
|
||||
<code>yylval</code> may be used. The data type for
|
||||
<code>yylval</code>, <code>YYSTYPE</code>,
|
||||
is typically defined in a header file, included in section 1 of the
|
||||
<code>flex</code> input file. For a list of functions and macros
|
||||
available, See <a href="Reentrant-Functions.html#bison_002dfunctions">bison-functions</a>.
|
||||
</p>
|
||||
<p>The declaration of yylex becomes,
|
||||
</p>
|
||||
<a name="index-yylex-_0028reentrant-version_0029"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> int yylex ( YYSTYPE * lvalp, yyscan_t scanner );
|
||||
</pre></div>
|
||||
|
||||
<p>If <code>%option bison-locations</code> is specified, then the declaration
|
||||
becomes,
|
||||
</p>
|
||||
<a name="index-yylex-_0028reentrant-version_0029-1"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> int yylex ( YYSTYPE * lvalp, YYLTYPE * llocp, yyscan_t scanner );
|
||||
</pre></div>
|
||||
|
||||
<p>Note that the macros <code>yylval</code> and <code>yylloc</code> evaluate to pointers.
|
||||
Support for <code>yylloc</code> is optional in <code>bison</code>, so it is optional in
|
||||
<code>flex</code> as well. The following is an example of a <code>flex</code> scanner that
|
||||
is compatible with <code>bison</code>.
|
||||
</p>
|
||||
<a name="index-bison_002c-scanner-to-be-called-from-bison"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> /* Scanner for "C" assignment statements... sort of. */
|
||||
%{
|
||||
#include "y.tab.h" /* Generated by bison. */
|
||||
%}
|
||||
|
||||
%option bison-bridge bison-locations
|
||||
%
|
||||
|
||||
[[:digit:]]+ { yylval->num = atoi(yytext); return NUMBER;}
|
||||
[[:alnum:]]+ { yylval->str = strdup(yytext); return STRING;}
|
||||
"="|";" { return yytext[0];}
|
||||
. {}
|
||||
%
|
||||
</pre></div>
|
||||
|
||||
<p>As you can see, there really is no magic here. We just use
|
||||
<code>yylval</code> as we would any other variable. The data type of
|
||||
<code>yylval</code> is generated by <code>bison</code>, and included in the file
|
||||
<samp>y.tab.h</samp>. Here is the corresponding <code>bison</code> parser:
|
||||
</p>
|
||||
<a name="index-bison_002c-parser"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> /* Parser to convert "C" assignments to lisp. */
|
||||
%{
|
||||
/* Pass the argument to yyparse through to yylex. */
|
||||
#define YYPARSE_PARAM scanner
|
||||
#define YYLEX_PARAM scanner
|
||||
%}
|
||||
%locations
|
||||
%pure_parser
|
||||
%union {
|
||||
int num;
|
||||
char* str;
|
||||
}
|
||||
%token <str> STRING
|
||||
%token <num> NUMBER
|
||||
%%
|
||||
assignment:
|
||||
STRING '=' NUMBER ';' {
|
||||
printf( "(setf %s %d)", $1, $3 );
|
||||
}
|
||||
;
|
||||
</pre></div>
|
||||
|
||||
<div class="footnote">
|
||||
<hr>
|
||||
<h4 class="footnotes-heading">Footnotes</h4>
|
||||
|
||||
<h3><a name="FOOT7" href="#DOCF7">(7)</a></h3>
|
||||
<p>The features described here are
|
||||
purely optional, and are by no means the only way to use flex with bison.
|
||||
We merely provide some glue to ease development of your parser-scanner pair.</p>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="M4-Dependency.html#M4-Dependency" accesskey="n" rel="next">M4 Dependency</a>, Previous: <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="p" rel="prev">Makefiles and Flex</a>, Up: <a href="Appendices.html#Appendices" accesskey="u" rel="up">Appendices</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,110 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I build nested parsers that work with the same input file?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I build nested parsers that work with the same input file?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I build nested parsers that work with the same input file?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="How-can-I-match-text-only-at-the-end-of-a-file_003f.html#How-can-I-match-text-only-at-the-end-of-a-file_003f" rel="next" title="How can I match text only at the end of a file?">
|
||||
<link href="How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f.html#How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f" rel="prev" title="How can I have multiple input sources feed into the same scanner at the same time?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Can-I-build-nested-parsers-that-work-with-the-same-input-file_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="How-can-I-match-text-only-at-the-end-of-a-file_003f.html#How-can-I-match-text-only-at-the-end-of-a-file_003f" accesskey="n" rel="next">How can I match text only at the end of a file?</a>, Previous: <a href="How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f.html#How-can-I-have-multiple-input-sources-feed-into-the-same-scanner-at-the-same-time_003f" accesskey="p" rel="prev">How can I have multiple input sources feed into the same scanner at the same time?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Can-I-build-nested-parsers-that-work-with-the-same-input-file_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Can I build nested parsers that work with the same input file?</h3>
|
||||
|
||||
<p>This is not going to work without some additional effort. The reason is
|
||||
that <code>flex</code> block-buffers the input it reads from <code>yyin</code>. This means that the
|
||||
“outermost” <code>yylex()</code>, when called, will automatically slurp up the first 8K
|
||||
of input available on yyin, and subsequent calls to other <code>yylex()</code>’s won’t
|
||||
see that input. You might be tempted to work around this problem by
|
||||
redefining <code>YY_INPUT</code> to only return a small amount of text, but it turns out
|
||||
that that approach is quite difficult. Instead, the best solution is to
|
||||
combine all of your scanners into one large scanner, using a different
|
||||
exclusive start condition for each.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,133 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I fake multi-byte character support?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I fake multi-byte character support?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I fake multi-byte character support?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="deleteme01.html#deleteme01" rel="next" title="deleteme01">
|
||||
<link href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" rel="prev" title="Is backing up a big deal?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Can-I-fake-multi_002dbyte-character-support_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="deleteme01.html#deleteme01" accesskey="n" rel="next">deleteme01</a>, Previous: <a href="Is-backing-up-a-big-deal_003f.html#Is-backing-up-a-big-deal_003f" accesskey="p" rel="prev">Is backing up a big deal?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Can-I-fake-multi_002dbyte-character-support_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Can I fake multi-byte character support?</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: Heeman_Lee@hp.com
|
||||
Subject: Re: flex - multi-byte support?
|
||||
In-reply-to: Your message of Thu, 03 Oct 1996 17:24:04 PDT.
|
||||
Date: Fri, 04 Oct 1996 11:42:18 PDT
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
> I assume as long as my *.l file defines the
|
||||
> range of expected character code values (in octal format), flex will
|
||||
> scan the file and read multi-byte characters correctly. But I have no
|
||||
> confidence in this assumption.
|
||||
|
||||
Your lack of confidence is justified - this won't work.
|
||||
|
||||
Flex has in it a widespread assumption that the input is processed
|
||||
one byte at a time. Fixing this is on the to-do list, but is involved,
|
||||
so it won't happen any time soon. In the interim, the best I can suggest
|
||||
(unless you want to try fixing it yourself) is to write your rules in
|
||||
terms of pairs of bytes, using definitions in the first section:
|
||||
|
||||
X \xfe\xc2
|
||||
...
|
||||
%%
|
||||
foo{X}bar found_foo_fe_c2_bar();
|
||||
|
||||
etc. Definitely a pain - sorry about that.
|
||||
|
||||
By the way, the email address you used for me is ancient, indicating you
|
||||
have a very old version of flex. You can get the most recent, 2.5.4, from
|
||||
ftp.ee.lbl.gov.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,104 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I get the flex manual in another format?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I get the flex manual in another format?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I get the flex manual in another format?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f.html#Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f" rel="next" title="Does there exist a "faster" NDFA->DFA algorithm?">
|
||||
<link href="The-period-isn_0027t-working-the-way-I-expected_002e.html#The-period-isn_0027t-working-the-way-I-expected_002e" rel="prev" title="The period isn't working the way I expected.">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Can-I-get-the-flex-manual-in-another-format_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f.html#Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f" accesskey="n" rel="next">Does there exist a "faster" NDFA->DFA algorithm?</a>, Previous: <a href="The-period-isn_0027t-working-the-way-I-expected_002e.html#The-period-isn_0027t-working-the-way-I-expected_002e" accesskey="p" rel="prev">The period isn't working the way I expected.</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Can-I-get-the-flex-manual-in-another-format_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Can I get the flex manual in another format?</h3>
|
||||
|
||||
<p>The <code>flex</code> source distribution includes a texinfo manual. You are
|
||||
free to convert that texinfo into whatever format you desire. The
|
||||
<code>texinfo</code> package includes tools for conversion to a number of formats.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,102 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the "rules" section of the file?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the "rules" section of the file?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the "rules" section of the file?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="I-get-an-error-about-undefined-yywrap_0028_0029_002e.html#I-get-an-error-about-undefined-yywrap_0028_0029_002e" rel="next" title="I get an error about undefined yywrap().">
|
||||
<link href="Where-else-can-I-find-help_003f.html#Where-else-can-I-find-help_003f" rel="prev" title="Where else can I find help?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Can-I-include-comments-in-the-_0022rules_0022-section-of-the-file_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="I-get-an-error-about-undefined-yywrap_0028_0029_002e.html#I-get-an-error-about-undefined-yywrap_0028_0029_002e" accesskey="n" rel="next">I get an error about undefined yywrap().</a>, Previous: <a href="Where-else-can-I-find-help_003f.html#Where-else-can-I-find-help_003f" accesskey="p" rel="prev">Where else can I find help?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Can-I-include-comments-in-the-_0022rules_0022-section-of-the-file_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Can I include comments in the "rules" section of the file?</h3>
|
||||
|
||||
<p>Yes, just about anywhere you want to. See the manual for the specific syntax.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,155 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Can you discuss some flex internals?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can you discuss some flex internals?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can you discuss some flex internals?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="unput_0028_0029-messes-up-yy_005fat_005fbol.html#unput_0028_0029-messes-up-yy_005fat_005fbol" rel="next" title="unput() messes up yy_at_bol">
|
||||
<link href="deleteme01.html#deleteme01" rel="prev" title="deleteme01">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Can-you-discuss-some-flex-internals_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="unput_0028_0029-messes-up-yy_005fat_005fbol.html#unput_0028_0029-messes-up-yy_005fat_005fbol" accesskey="n" rel="next">unput() messes up yy_at_bol</a>, Previous: <a href="deleteme01.html#deleteme01" accesskey="p" rel="prev">deleteme01</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Can-you-discuss-some-flex-internals_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Can you discuss some flex internals?</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: Johan Linde <jl@theophys.kth.se>
|
||||
Subject: Re: translation of flex
|
||||
In-reply-to: Your message of Sun, 10 Nov 1996 09:16:36 PST.
|
||||
Date: Mon, 11 Nov 1996 10:33:50 PST
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
> I'm working for the Swedish team translating GNU program, and I'm currently
|
||||
> working with flex. I have a few questions about some of the messages which
|
||||
> I hope you can answer.
|
||||
|
||||
All of the things you're wondering about, by the way, concerning flex
|
||||
internals - probably the only person who understands what they mean in
|
||||
English is me! So I wouldn't worry too much about getting them right.
|
||||
That said ...
|
||||
|
||||
> #: main.c:545
|
||||
> msgid " %d protos created\n"
|
||||
>
|
||||
> Does proto mean prototype?
|
||||
|
||||
Yes - prototypes of state compression tables.
|
||||
|
||||
> #: main.c:539
|
||||
> msgid " %d/%d (peak %d) template nxt-chk entries created\n"
|
||||
>
|
||||
> Here I'm mainly puzzled by 'nxt-chk'. I guess it means 'next-check'. (?)
|
||||
> However, 'template next-check entries' doesn't make much sense to me. To be
|
||||
> able to find a good translation I need to know a little bit more about it.
|
||||
|
||||
There is a scheme in the Aho/Sethi/Ullman compiler book for compressing
|
||||
scanner tables. It involves creating two pairs of tables. The first has
|
||||
"base" and "default" entries, the second has "next" and "check" entries.
|
||||
The "base" entry is indexed by the current state and yields an index into
|
||||
the next/check table. The "default" entry gives what to do if the state
|
||||
transition isn't found in next/check. The "next" entry gives the next
|
||||
state to enter, but only if the "check" entry verifies that this entry is
|
||||
correct for the current state. Flex creates templates of series of
|
||||
next/check entries and then encodes differences from these templates as a
|
||||
way to compress the tables.
|
||||
|
||||
> #: main.c:533
|
||||
> msgid " %d/%d base-def entries created\n"
|
||||
>
|
||||
> The same problem here for 'base-def'.
|
||||
|
||||
See above.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="unput_0028_0029-messes-up-yy_005fat_005fbol.html#unput_0028_0029-messes-up-yy_005fat_005fbol" accesskey="n" rel="next">unput() messes up yy_at_bol</a>, Previous: <a href="deleteme01.html#deleteme01" accesskey="p" rel="prev">deleteme01</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,309 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Code-Level And API Options</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Code-Level And API Options">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Code-Level And API Options">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Scanner-Options.html#Scanner-Options" rel="up" title="Scanner Options">
|
||||
<link href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" rel="next" title="Options for Scanner Speed and Size">
|
||||
<link href="Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior" rel="prev" title="Options Affecting Scanner Behavior">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Code_002dLevel-And-API-Options"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" accesskey="n" rel="next">Options for Scanner Speed and Size</a>, Previous: <a href="Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior" accesskey="p" rel="prev">Options Affecting Scanner Behavior</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Code_002dLevel-And-API-Options-1"></a>
|
||||
<h3 class="section">16.3 Code-Level And API Options</h3>
|
||||
|
||||
<dl compact="compact">
|
||||
<dd>
|
||||
<a name="option_002dansi_002ddefinitions"></a><a name="index-_002d_002d_002doption_002dansi_002ddefinitions"></a>
|
||||
<a name="index-ansi_002ddefinitions"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--ansi-definitions, <code>%option ansi-definitions</code></samp>’</dt>
|
||||
<dd><p>Deprecated, ignored
|
||||
</p>
|
||||
<a name="option_002dansi_002dprototypes"></a><a name="index-_002d_002d_002doption_002dansi_002dprototypes"></a>
|
||||
<a name="index-ansi_002dprototypes"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--ansi-prototypes, <code>%option ansi-prototypes</code></samp>’</dt>
|
||||
<dd><p>Deprecated, ignored
|
||||
</p>
|
||||
<a name="option_002dbison_002dbridge"></a><a name="index-_002d_002d_002dbison_002dbridge"></a>
|
||||
<a name="index-bison_002dbridge"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--bison-bridge, <code>%option bison-bridge</code></samp>’</dt>
|
||||
<dd><p>instructs flex to generate a C scanner that is
|
||||
meant to be called by a
|
||||
<code>GNU bison</code>
|
||||
parser. The scanner has minor API changes for
|
||||
<code>bison</code>
|
||||
compatibility. In particular, the declaration of
|
||||
<code>yylex</code>
|
||||
is modified to take an additional parameter,
|
||||
<code>yylval</code>.
|
||||
See <a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a>.
|
||||
</p>
|
||||
<a name="option_002dbison_002dlocations"></a><a name="index-_002d_002d_002dbison_002dlocations"></a>
|
||||
<a name="index-bison_002dlocations"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--bison-locations, <code>%option bison-locations</code></samp>’</dt>
|
||||
<dd><p>instruct flex that
|
||||
<code>GNU bison</code> <code>%locations</code> are being used.
|
||||
This means <code>yylex</code> will be passed
|
||||
an additional parameter, <code>yylloc</code>. This option
|
||||
implies <code>%option bison-bridge</code>.
|
||||
See <a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a>.
|
||||
</p>
|
||||
<a name="option_002dnoline"></a><a name="index-_002dL"></a>
|
||||
<a name="index-_002d_002d_002dnoline"></a>
|
||||
<a name="index-noline"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-L, --noline, <code>%option noline</code></samp>’</dt>
|
||||
<dd><p>instructs
|
||||
<code>flex</code>
|
||||
not to generate
|
||||
<code>#line</code>
|
||||
directives. Without this option,
|
||||
<code>flex</code>
|
||||
peppers the generated scanner
|
||||
with <code>#line</code> directives so error messages in the actions will be correctly
|
||||
located with respect to either the original
|
||||
<code>flex</code>
|
||||
input file (if the errors are due to code in the input file), or
|
||||
<samp>lex.yy.c</samp>
|
||||
(if the errors are
|
||||
<code>flex</code>’s
|
||||
fault – you should report these sorts of errors to the email address
|
||||
given in <a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>).
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dreentrant"></a><a name="index-_002dR"></a>
|
||||
<a name="index-_002d_002d_002dreentrant"></a>
|
||||
<a name="index-reentrant"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-R, --reentrant, <code>%option reentrant</code></samp>’</dt>
|
||||
<dd><p>instructs flex to generate a reentrant C scanner. The generated scanner
|
||||
may safely be used in a multi-threaded environment. The API for a
|
||||
reentrant scanner is different than for a non-reentrant scanner
|
||||
see <a href="Reentrant.html#Reentrant">Reentrant</a>). Because of the API difference between
|
||||
reentrant and non-reentrant <code>flex</code> scanners, non-reentrant flex
|
||||
code must be modified before it is suitable for use with this option.
|
||||
This option is not compatible with the ‘<samp>--c++</samp>’ option.
|
||||
</p>
|
||||
<p>The option ‘<samp>--reentrant</samp>’ does not affect the performance of
|
||||
the scanner.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dc_002b_002b"></a><a name="index-_002d_002b"></a>
|
||||
<a name="index-_002d_002d_002dc_002b_002b"></a>
|
||||
<a name="index-c_002b_002b"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-+, --c++, <code>%option c++</code></samp>’</dt>
|
||||
<dd><p>specifies that you want flex to generate a C++
|
||||
scanner class. See <a href="Cxx.html#Cxx">Cxx</a>, for
|
||||
details.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002darray"></a><a name="index-_002d_002d_002darray"></a>
|
||||
<a name="index-array"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--array, <code>%option array</code></samp>’</dt>
|
||||
<dd><p>specifies that you want yytext to be an array instead of a char*
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dpointer"></a><a name="index-_002d_002d_002dpointer"></a>
|
||||
<a name="index-pointer"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--pointer, <code>%option pointer</code></samp>’</dt>
|
||||
<dd><p>specify that <code>yytext</code> should be a <code>char *</code>, not an array.
|
||||
This default is <code>char *</code>.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dprefix"></a><a name="index-_002dP"></a>
|
||||
<a name="index-_002d_002d_002dprefix"></a>
|
||||
<a name="index-prefix"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-PPREFIX, --prefix=PREFIX, <code>%option prefix="PREFIX"</code></samp>’</dt>
|
||||
<dd><p>changes the default ‘<samp>yy</samp>’ prefix used by <code>flex</code> for all
|
||||
globally-visible variable and function names to instead be
|
||||
‘<samp>PREFIX</samp>’. For example, ‘<samp>--prefix=foo</samp>’ changes the name of
|
||||
<code>yytext</code> to <code>footext</code>. It also changes the name of the default
|
||||
output file from <samp>lex.yy.c</samp> to <samp>lex.foo.c</samp>. Here is a partial
|
||||
list of the names affected:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> yy_create_buffer
|
||||
yy_delete_buffer
|
||||
yy_flex_debug
|
||||
yy_init_buffer
|
||||
yy_flush_buffer
|
||||
yy_load_buffer_state
|
||||
yy_switch_to_buffer
|
||||
yyin
|
||||
yyleng
|
||||
yylex
|
||||
yylineno
|
||||
yyout
|
||||
yyrestart
|
||||
yytext
|
||||
yywrap
|
||||
yyalloc
|
||||
yyrealloc
|
||||
yyfree
|
||||
</pre></div>
|
||||
|
||||
<p>(If you are using a C++ scanner, then only <code>yywrap</code> and
|
||||
<code>yyFlexLexer</code> are affected.) Within your scanner itself, you can
|
||||
still refer to the global variables and functions using either version
|
||||
of their name; but externally, they have the modified name.
|
||||
</p>
|
||||
<p>This option lets you easily link together multiple
|
||||
<code>flex</code>
|
||||
programs into the same executable. Note, though, that using this
|
||||
option also renames
|
||||
<code>yywrap()</code>,
|
||||
so you now
|
||||
<em>must</em>
|
||||
either
|
||||
provide your own (appropriately-named) version of the routine for your
|
||||
scanner, or use
|
||||
<code>%option noyywrap</code>,
|
||||
as linking with
|
||||
‘<samp>-lfl</samp>’
|
||||
no longer provides one for you by default.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dmain"></a><a name="index-_002d_002d_002dmain"></a>
|
||||
<a name="index-main"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--main, <code>%option main</code></samp>’</dt>
|
||||
<dd><p>directs flex to provide a default <code>main()</code> program for the
|
||||
scanner, which simply calls <code>yylex()</code>. This option implies
|
||||
<code>noyywrap</code> (see below).
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dnounistd"></a><a name="index-_002d_002d_002dnounistd"></a>
|
||||
<a name="index-nounistd"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--nounistd, <code>%option nounistd</code></samp>’</dt>
|
||||
<dd><p>suppresses inclusion of the non-ANSI header file <samp>unistd.h</samp>. This option
|
||||
is meant to target environments in which <samp>unistd.h</samp> does not exist. Be aware
|
||||
that certain options may cause flex to generate code that relies on functions
|
||||
normally found in <samp>unistd.h</samp>, (e.g. <code>isatty()</code>, <code>read()</code>.)
|
||||
If you wish to use these functions, you will have to inform your compiler where
|
||||
to find them.
|
||||
See <a href="Options-Affecting-Scanner-Behavior.html#option_002dalways_002dinteractive">option-always-interactive</a>. See <a href="Options-for-Scanner-Speed-and-Size.html#option_002dread">option-read</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dyyclass"></a><a name="index-_002d_002d_002dyyclass"></a>
|
||||
<a name="index-yyclass"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--yyclass=NAME, <code>%option yyclass="NAME"</code></samp>’</dt>
|
||||
<dd><p>only applies when generating a C++ scanner (the ‘<samp>--c++</samp>’ option). It
|
||||
informs <code>flex</code> that you have derived <code>NAME</code> as a subclass of
|
||||
<code>yyFlexLexer</code>, so <code>flex</code> will place your actions in the member
|
||||
function <code>foo::yylex()</code> instead of <code>yyFlexLexer::yylex()</code>. It
|
||||
also generates a <code>yyFlexLexer::yylex()</code> member function that emits
|
||||
a run-time error (by invoking <code>yyFlexLexer::LexerError())</code> if
|
||||
called. See <a href="Cxx.html#Cxx">Cxx</a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" accesskey="n" rel="next">Options for Scanner Speed and Size</a>, Previous: <a href="Options-Affecting-Scanner-Behavior.html#Options-Affecting-Scanner-Behavior" accesskey="p" rel="prev">Options Affecting Scanner Behavior</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,148 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Comments in the Input</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Comments in the Input">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Comments in the Input">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Format.html#Format" rel="up" title="Format">
|
||||
<link href="Patterns.html#Patterns" rel="next" title="Patterns">
|
||||
<link href="User-Code-Section.html#User-Code-Section" rel="prev" title="User Code Section">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Comments-in-the-Input"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Previous: <a href="User-Code-Section.html#User-Code-Section" accesskey="p" rel="prev">User Code Section</a>, Up: <a href="Format.html#Format" accesskey="u" rel="up">Format</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Comments-in-the-Input-1"></a>
|
||||
<h3 class="section">5.4 Comments in the Input</h3>
|
||||
|
||||
<a name="index-comments_002c-syntax-of"></a>
|
||||
<p>Flex supports C-style comments, that is, anything between ‘<samp>/*</samp>’ and
|
||||
‘<samp>*/</samp>’ is
|
||||
considered a comment. Whenever flex encounters a comment, it copies the
|
||||
entire comment verbatim to the generated source code. Comments may
|
||||
appear just about anywhere, but with the following exceptions:
|
||||
</p>
|
||||
<ul>
|
||||
<li> <a name="index-comments_002c-in-rules-section"></a>
|
||||
Comments may not appear in the Rules Section wherever flex is expecting
|
||||
a regular expression. This means comments may not appear at the
|
||||
beginning of a line, or immediately following a list of scanner states.
|
||||
</li><li> Comments may not appear on an ‘<samp>%option</samp>’ line in the Definitions
|
||||
Section.
|
||||
</li></ul>
|
||||
|
||||
<p>If you want to follow a simple rule, then always begin a comment on a
|
||||
new line, with one or more whitespace characters before the initial
|
||||
‘<samp>/*</samp>’). This rule will work anywhere in the input file.
|
||||
</p>
|
||||
<p>All the comments in the following example are valid:
|
||||
</p>
|
||||
<a name="index-comments_002c-valid-uses-of"></a>
|
||||
<a name="index-comments-in-the-input"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim">%{
|
||||
/* code block */
|
||||
%}
|
||||
|
||||
/* Definitions Section */
|
||||
%x STATE_X
|
||||
|
||||
%%
|
||||
/* Rules Section */
|
||||
ruleA /* after regex */ { /* code block */ } /* after code block */
|
||||
/* Rules Section (indented) */
|
||||
<STATE_X>{
|
||||
ruleC ECHO;
|
||||
ruleD ECHO;
|
||||
%{
|
||||
/* code block */
|
||||
%}
|
||||
}
|
||||
%%
|
||||
/* User Code Section */
|
||||
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,116 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Common Patterns</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Common Patterns">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Common Patterns">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Appendices.html#Appendices" rel="up" title="Appendices">
|
||||
<link href="Numbers.html#Numbers" rel="next" title="Numbers">
|
||||
<link href="M4-Dependency.html#M4-Dependency" rel="prev" title="M4 Dependency">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Common-Patterns"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Previous: <a href="M4-Dependency.html#M4-Dependency" accesskey="p" rel="prev">M4 Dependency</a>, Up: <a href="Appendices.html#Appendices" accesskey="u" rel="up">Appendices</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Common-Patterns-1"></a>
|
||||
<h3 class="section">A.4 Common Patterns</h3>
|
||||
<a name="index-patterns_002c-common"></a>
|
||||
|
||||
<p>This appendix provides examples of common regular expressions you might use
|
||||
in your scanner.
|
||||
</p>
|
||||
<table class="menu" border="0" cellspacing="0">
|
||||
<tr><td align="left" valign="top">• <a href="Numbers.html#Numbers" accesskey="1">Numbers</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
<tr><td align="left" valign="top">• <a href="Identifiers.html#Identifiers" accesskey="2">Identifiers</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
<tr><td align="left" valign="top">• <a href="Quoted-Constructs.html#Quoted-Constructs" accesskey="3">Quoted Constructs</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
<tr><td align="left" valign="top">• <a href="Addresses.html#Addresses" accesskey="4">Addresses</a>:</td><td> </td><td align="left" valign="top">
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,576 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Concept Index</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Concept Index">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Concept Index">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Indices.html#Indices" rel="up" title="Indices">
|
||||
<link href="Index-of-Functions-and-Macros.html#Index-of-Functions-and-Macros" rel="next" title="Index of Functions and Macros">
|
||||
<link href="Indices.html#Indices" rel="prev" title="Indices">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Concept-Index"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Index-of-Functions-and-Macros.html#Index-of-Functions-and-Macros" accesskey="n" rel="next">Index of Functions and Macros</a>, Previous: <a href="Indices.html#Indices" accesskey="p" rel="prev">Indices</a>, Up: <a href="Indices.html#Indices" accesskey="u" rel="up">Indices</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Concept-Index-1"></a>
|
||||
<h3 class="unnumberedsec">Concept Index</h3>
|
||||
|
||||
<table><tr><th valign="top">Jump to: </th><td><a class="summary-letter" href="#Concept-Index_cp_symbol-1"><b>$</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-2"><b>%</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-3"><b><</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-4"><b>[</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-5"><b>^</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-6"><b>|</b></a>
|
||||
|
||||
<br>
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-K"><b>K</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-N"><b>N</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-Y"><b>Y</b></a>
|
||||
|
||||
</td></tr></table>
|
||||
<table class="index-cp" border="0">
|
||||
<tr><td></td><th align="left">Index Entry</th><td> </td><th align="left"> Section</th></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_symbol-1">$</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-_0024-as-normal-character-in-patterns">$ as normal character in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_symbol-2">%</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025array_002c-advantages-of">%array, advantages of</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025array_002c-use-of">%array, use of</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025array_002c-with-C_002b_002b">%array, with C++</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-_0025option-noyywrapp">%option noyywrapp</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-_0025pointer_002c-and-unput_0028_0029">%pointer, and unput()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-_0025pointer_002c-use-of">%pointer, use of</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-_0025top">%top</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-_0025_007b-and-_0025_007d_002c-in-Definitions-Section">%{ and %}, in Definitions Section</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-_0025_007b-and-_0025_007d_002c-in-Rules-Section">%{ and %}, in Rules Section</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_symbol-3"><</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="EOF.html#index-_003c_003cEOF_003e_003e_002c-use-of"><<EOF>>, use of</a>:</td><td> </td><td valign="top"><a href="EOF.html#EOF">EOF</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_symbol-4">[</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-_005b_005d-in-patterns">[] in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_symbol-5">^</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-_005e-as-non_002dspecial-character-in-patterns">^ as non-special character in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_symbol-6">|</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-_007c_002c-in-actions">|, in actions</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-_007c_002c-use-of">|, use of</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-A">A</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Accessor-Methods.html#index-accessor-functions_002c-use-of">accessor functions, use of</a>:</td><td> </td><td valign="top"><a href="Accessor-Methods.html#Accessor-Methods">Accessor Methods</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-actions">actions</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-actions_002c-embedded-C-strings">actions, embedded C strings</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-actions_002c-redefining-YY_005fBREAK">actions, redefining YY_BREAK</a>:</td><td> </td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-actions_002c-use-of-_007b-and-_007d">actions, use of { and }</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-aliases_002c-how-to-define">aliases, how to define</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Scanner-Options.html#index-arguments_002c-command_002dline">arguments, command-line</a>:</td><td> </td><td valign="top"><a href="Scanner-Options.html#Scanner-Options">Scanner Options</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="User-Values.html#index-array_002c-default-size-for-yytext">array, default size for yytext</a>:</td><td> </td><td valign="top"><a href="User-Values.html#User-Values">User Values</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-B">B</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-eliminating">backing up, eliminating</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-eliminating-by-adding-error-rules">backing up, eliminating by adding error rules</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-eliminating-with-catch_002dall-rule">backing up, eliminating with catch-all rule</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-backing-up_002c-example-of-eliminating">backing up, example of eliminating</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-BEGIN">BEGIN</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-BEGIN_002c-explanation">BEGIN, explanation</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-beginning-of-line_002c-in-patterns">beginning of line, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Bison-Bridge.html#index-bison_002c-bridging-with-flex">bison, bridging with flex</a>:</td><td> </td><td valign="top"><a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Bison-Bridge.html#index-bison_002c-parser">bison, parser</a>:</td><td> </td><td valign="top"><a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Bison-Bridge.html#index-bison_002c-scanner-to-be-called-from-bison">bison, scanner to be called from bison</a>:</td><td> </td><td valign="top"><a href="Bison-Bridge.html#Bison-Bridge">Bison Bridge</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-BOL_002c-checking-the-BOL-flag">BOL, checking the BOL flag</a>:</td><td> </td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-BOL_002c-in-patterns">BOL, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-BOL_002c-setting-it">BOL, setting it</a>:</td><td> </td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-braces-in-patterns">braces in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reporting-Bugs.html#index-bugs_002c-reporting">bugs, reporting</a>:</td><td> </td><td valign="top"><a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-C">C</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-C-code-in-flex-input">C code in flex input</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b">C++</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="User-Values.html#index-C_002b_002b-and-_0025array">C++ and %array</a>:</td><td> </td><td valign="top"><a href="User-Values.html#User-Values">User Values</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-C_002b_002b-I_002fO_002c-customizing">C++ I/O, customizing</a>:</td><td> </td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b-scanners_002c-including-multiple-scanners">C++ scanners, including multiple scanners</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b-scanners_002c-use-of">C++ scanners, use of</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-c_002b_002b_002c-experimental-form-of-scanner-class">c++, experimental form of scanner class</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-C_002b_002b_002c-multiple-different-scanners">C++, multiple different scanners</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-C_002dstrings_002c-in-actions">C-strings, in actions</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-case_002dinsensitive_002c-effect-on-character-classes">case-insensitive, effect on character classes</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-character-classes-in-patterns">character classes in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-character-classes-in-patterns_002c-syntax-of">character classes in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-character-classes_002c-equivalence-of">character classes, equivalence of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-clearing-an-input-buffer">clearing an input buffer</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Scanner-Options.html#index-command_002dline-options">command-line options</a>:</td><td> </td><td valign="top"><a href="Scanner-Options.html#Scanner-Options">Scanner Options</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-comments-in-flex-input">comments in flex input</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments-in-the-input">comments in the input</a>:</td><td> </td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-comments_002c-discarding">comments, discarding</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-comments_002c-example-of-scanning-C-comments">comments, example of scanning C comments</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-comments_002c-in-actions">comments, in actions</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments_002c-in-rules-section">comments, in rules section</a>:</td><td> </td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments_002c-syntax-of">comments, syntax of</a>:</td><td> </td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Comments-in-the-Input.html#index-comments_002c-valid-uses-of">comments, valid uses of</a>:</td><td> </td><td valign="top"><a href="Comments-in-the-Input.html#Comments-in-the-Input">Comments in the Input</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-compressing-whitespace">compressing whitespace</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-concatenation_002c-in-patterns">concatenation, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Copyright.html#index-copyright-of-flex">copyright of flex</a>:</td><td> </td><td valign="top"><a href="Copyright.html#Copyright">Copyright</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-counting-characters-and-lines">counting characters and lines</a>:</td><td> </td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-customizing-I_002fO-in-C_002b_002b-scanners">customizing I/O in C++ scanners</a>:</td><td> </td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-D">D</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-default-rule">default rule</a>:</td><td> </td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-default-rule-1">default rule</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-defining-pattern-aliases">defining pattern aliases</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-Definitions_002c-in-flex-input">Definitions, in flex input</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-deleting-lines-from-input">deleting lines from input</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-discarding-C-comments">discarding C comments</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Copyright.html#index-distributing-flex">distributing flex</a>:</td><td> </td><td valign="top"><a href="Copyright.html#Copyright">Copyright</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-E">E</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-ECHO">ECHO</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-ECHO_002c-and-yyout">ECHO, and yyout</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-embedding-C-code-in-flex-input">embedding C code in flex input</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-end-of-file_002c-in-patterns">end of file, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-end-of-line_002c-in-negated-character-classes">end of line, in negated character classes</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-end-of-line_002c-in-patterns">end of line, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-end_002dof_002dfile_002c-and-yyrestart_0028_0029">end-of-file, and yyrestart()</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-EOF-and-yyrestart_0028_0029">EOF and yyrestart()</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-EOF-in-patterns_002c-syntax-of">EOF in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-EOF_002c-example-using-multiple-input-buffers">EOF, example using multiple input buffers</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="EOF.html#index-EOF_002c-explanation">EOF, explanation</a>:</td><td> </td><td valign="top"><a href="EOF.html#EOF">EOF</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-EOF_002c-pushing-back">EOF, pushing back</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-EOL_002c-in-negated-character-classes">EOL, in negated character classes</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-EOL_002c-in-patterns">EOL, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-error-messages_002c-end-of-buffer-missed">error messages, end of buffer missed</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Diagnostics.html#index-error-reporting_002c-diagnostic-messages">error reporting, diagnostic messages</a>:</td><td> </td><td valign="top"><a href="Diagnostics.html#Diagnostics">Diagnostics</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-error-reporting_002c-in-C_002b_002b">error reporting, in C++</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-error-rules_002c-to-eliminate-backing-up">error rules, to eliminate backing up</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-escape-sequences-in-patterns_002c-syntax-of">escape sequences in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-exiting-with-yyterminate_0028_0029">exiting with yyterminate()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-experimental-form-of-c_002b_002b-scanner-class">experimental form of c++ scanner class</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-extended-scope-of-start-conditions">extended scope of start conditions</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-F">F</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Format.html#index-file-format">file format</a>:</td><td> </td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Tables-File-Format.html#index-file-format_002c-serialized-tables">file format, serialized tables</a>:</td><td> </td><td valign="top"><a href="Tables-File-Format.html#Tables-File-Format">Tables File Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-flushing-an-input-buffer">flushing an input buffer</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-flushing-the-internal-buffer">flushing the internal buffer</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Format.html#index-format-of-flex-input">format of flex input</a>:</td><td> </td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Format.html#index-format-of-input-file">format of input file</a>:</td><td> </td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-freeing-tables">freeing tables</a>:</td><td> </td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-G">G</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-getting-current-start-state-with-YY_005fSTART">getting current start state with YY_START</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-H">H</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-halting-with-yyterminate_0028_0029">halting with yyterminate()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-handling-include-files-with-multiple-input-buffers">handling include files with multiple input buffers</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-handling-include-files-with-multiple-input-buffers-1">handling include files with multiple input buffers</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-header-files_002c-with-C_002b_002b">header files, with C++</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-I">I</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-include-files_002c-with-C_002b_002b">include files, with C++</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-input-file_002c-Definitions-section">input file, Definitions section</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Rules-Section.html#index-input-file_002c-Rules-Section">input file, Rules Section</a>:</td><td> </td><td valign="top"><a href="Rules-Section.html#Rules-Section">Rules Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="User-Code-Section.html#index-input-file_002c-user-code-Section">input file, user code Section</a>:</td><td> </td><td valign="top"><a href="User-Code-Section.html#User-Code-Section">User Code Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-input_0028_0029">input()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-input_0028_0029_002c-and-C_002b_002b">input(), and C++</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Format.html#index-input_002c-format-of">input, format of</a>:</td><td> </td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-input_002c-matching">input, matching</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-K">K</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-keywords_002c-for-performance">keywords, for performance</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-L">L</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-lex-_0028traditional_0029-and-POSIX">lex (traditional) and POSIX</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-LexerInput_002c-overriding">LexerInput, overriding</a>:</td><td> </td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-LexerOutput_002c-overriding">LexerOutput, overriding</a>:</td><td> </td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Limitations.html#index-limitations-of-flex">limitations of flex</a>:</td><td> </td><td valign="top"><a href="Limitations.html#Limitations">Limitations</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-literal-text-in-patterns_002c-syntax-of">literal text in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-loading-tables-at-runtime">loading tables at runtime</a>:</td><td> </td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-M">M</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="M4-Dependency.html#index-m4">m4</a>:</td><td> </td><td valign="top"><a href="M4-Dependency.html#M4-Dependency">M4 Dependency</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Makefiles-and-Flex.html#index-Makefile_002c-example-of-implicit-rules">Makefile, example of implicit rules</a>:</td><td> </td><td valign="top"><a href="Makefiles-and-Flex.html#Makefiles-and-Flex">Makefiles and Flex</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Makefiles-and-Flex.html#index-Makefile_002c-explicit-example">Makefile, explicit example</a>:</td><td> </td><td valign="top"><a href="Makefiles-and-Flex.html#Makefiles-and-Flex">Makefiles and Flex</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Makefiles-and-Flex.html#index-Makefile_002c-syntax">Makefile, syntax</a>:</td><td> </td><td valign="top"><a href="Makefiles-and-Flex.html#Makefiles-and-Flex">Makefiles and Flex</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-matching-C_002dstyle-double_002dquoted-strings">matching C-style double-quoted strings</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-matching_002c-and-trailing-context">matching, and trailing context</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-matching_002c-length-of">matching, length of</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-matching_002c-multiple-matches">matching, multiple matches</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-member-functions_002c-C_002b_002b">member functions, C++</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Memory-Management.html#index-memory-management">memory management</a>:</td><td> </td><td valign="top"><a href="Memory-Management.html#Memory-Management">Memory Management</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-memory_002c-allocating-input-buffers">memory, allocating input buffers</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Init-and-Destroy-Functions.html#index-memory_002c-considerations-for-reentrant-scanners">memory, considerations for reentrant scanners</a>:</td><td> </td><td valign="top"><a href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions">Init and Destroy Functions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-memory_002c-deleting-input-buffers">memory, deleting input buffers</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-memory_002c-for-start-condition-stacks">memory, for start condition stacks</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Serialized-Tables.html#index-memory_002c-serialized-tables">memory, serialized tables</a>:</td><td> </td><td valign="top"><a href="Serialized-Tables.html#Serialized-Tables">Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-memory_002c-serialized-tables-1">memory, serialized tables</a>:</td><td> </td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Cxx.html#index-methods_002c-c_002b_002b">methods, c++</a>:</td><td> </td><td valign="top"><a href="Cxx.html#Cxx">Cxx</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-minimal-scanner">minimal scanner</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-multiple-input-streams">multiple input streams</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-N">N</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-name-definitions_002c-not-POSIX">name definitions, not POSIX</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-negating-ranges-in-patterns">negating ranges in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-newline_002c-matching-in-patterns">newline, matching in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-non_002dPOSIX-features-of-flex">non-POSIX features of flex</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-noyywrap_002c-_0025option">noyywrap, %option</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-NULL-character-in-patterns_002c-syntax-of">NULL character in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-O">O</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-octal-characters-in-patterns">octal characters in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Scanner-Options.html#index-options_002c-command_002dline">options, command-line</a>:</td><td> </td><td valign="top"><a href="Scanner-Options.html#Scanner-Options">Scanner Options</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-overriding-LexerInput">overriding LexerInput</a>:</td><td> </td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#index-overriding-LexerOutput">overriding LexerOutput</a>:</td><td> </td><td valign="top"><a href="How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f.html#How-do-I-use-my-own-I_002fO-classes-in-a-C_002b_002b-scanner_003f">How do I use my own I/O classes in a C++ scanner?</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-overriding-the-memory-routines">overriding the memory routines</a>:</td><td> </td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-P">P</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-Pascal_002dlike-language">Pascal-like language</a>:</td><td> </td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-pattern-aliases_002c-defining">pattern aliases, defining</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-pattern-aliases_002c-expansion-of">pattern aliases, expansion of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-pattern-aliases_002c-how-to-define">pattern aliases, how to define</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Definitions-Section.html#index-pattern-aliases_002c-use-of">pattern aliases, use of</a>:</td><td> </td><td valign="top"><a href="Definitions-Section.html#Definitions-Section">Definitions Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-patterns-and-actions-on-different-lines">patterns and actions on different lines</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-character-class-equivalence">patterns, character class equivalence</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Common-Patterns.html#index-patterns_002c-common">patterns, common</a>:</td><td> </td><td valign="top"><a href="Common-Patterns.html#Common-Patterns">Common Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-end-of-line">patterns, end of line</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-grouping-and-precedence">patterns, grouping and precedence</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-in-rules-section">patterns, in rules section</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-invalid-trailing-context">patterns, invalid trailing context</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-patterns_002c-matching">patterns, matching</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-precedence-of-operators">patterns, precedence of operators</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-repetitions-with-grouping">patterns, repetitions with grouping</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-special-characters-treated-as-non_002dspecial">patterns, special characters treated as non-special</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-syntax">patterns, syntax</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-syntax-1">patterns, syntax</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-patterns_002c-tuning-for-performance">patterns, tuning for performance</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-patterns_002c-valid-character-classes">patterns, valid character classes</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-performance-optimization_002c-matching-longer-tokens">performance optimization, matching longer tokens</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-performance-optimization_002c-recognizing-keywords">performance optimization, recognizing keywords</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-performance_002c-backing-up">performance, backing up</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-performance_002c-considerations">performance, considerations</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-performance_002c-using-keywords">performance, using keywords</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-popping-an-input-buffer">popping an input buffer</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-POSIX-and-lex">POSIX and lex</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-POSIX-comp_003bcompliance">POSIX comp;compliance</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-POSIX_002c-character-classes-in-patterns_002c-syntax-of">POSIX, character classes in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-preprocessor-macros_002c-for-use-in-actions">preprocessor macros, for use in actions</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-pushing-an-input-buffer">pushing an input buffer</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-characters-with-unput">pushing back characters with unput</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-characters-with-unput_0028_0029">pushing back characters with unput()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-characters-with-yyless">pushing back characters with yyless</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-pushing-back-EOF">pushing back EOF</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-R">R</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-ranges-in-patterns">ranges in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-ranges-in-patterns_002c-negating">ranges in patterns, negating</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-recognizing-C-comments">recognizing C comments</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reentrant-Uses.html#index-reentrant-scanners_002c-multiple-interleaved-scanners">reentrant scanners, multiple interleaved scanners</a>:</td><td> </td><td valign="top"><a href="Reentrant-Uses.html#Reentrant-Uses">Reentrant Uses</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reentrant-Uses.html#index-reentrant-scanners_002c-recursive-invocation">reentrant scanners, recursive invocation</a>:</td><td> </td><td valign="top"><a href="Reentrant-Uses.html#Reentrant-Uses">Reentrant Uses</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Global-Replacement.html#index-reentrant_002c-accessing-flex-variables">reentrant, accessing flex variables</a>:</td><td> </td><td valign="top"><a href="Global-Replacement.html#Global-Replacement">Global Replacement</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Accessor-Methods.html#index-reentrant_002c-accessor-functions">reentrant, accessor functions</a>:</td><td> </td><td valign="top"><a href="Accessor-Methods.html#Accessor-Methods">Accessor Methods</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reentrant-Overview.html#index-reentrant_002c-API-explanation">reentrant, API explanation</a>:</td><td> </td><td valign="top"><a href="Reentrant-Overview.html#Reentrant-Overview">Reentrant Overview</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Extra-Reentrant-Argument.html#index-reentrant_002c-calling-functions">reentrant, calling functions</a>:</td><td> </td><td valign="top"><a href="Extra-Reentrant-Argument.html#Extra-Reentrant-Argument">Extra Reentrant Argument</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reentrant-Example.html#index-reentrant_002c-example-of">reentrant, example of</a>:</td><td> </td><td valign="top"><a href="Reentrant-Example.html#Reentrant-Example">Reentrant Example</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reentrant.html#index-reentrant_002c-explanation">reentrant, explanation</a>:</td><td> </td><td valign="top"><a href="Reentrant.html#Reentrant">Reentrant</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Extra-Data.html#index-reentrant_002c-extra-data">reentrant, extra data</a>:</td><td> </td><td valign="top"><a href="Extra-Data.html#Extra-Data">Extra Data</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Init-and-Destroy-Functions.html#index-reentrant_002c-initialization">reentrant, initialization</a>:</td><td> </td><td valign="top"><a href="Init-and-Destroy-Functions.html#Init-and-Destroy-Functions">Init and Destroy Functions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-regular-expressions_002c-in-patterns">regular expressions, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-REJECT">REJECT</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-REJECT_002c-calling-multiple-times">REJECT, calling multiple times</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-REJECT_002c-performance-costs">REJECT, performance costs</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reporting-Bugs.html#index-reporting-bugs">reporting bugs</a>:</td><td> </td><td valign="top"><a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Lex-and-Posix.html#index-restarting-the-scanner">restarting the scanner</a>:</td><td> </td><td valign="top"><a href="Lex-and-Posix.html#Lex-and-Posix">Lex and Posix</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-RETURN_002c-within-actions">RETURN, within actions</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-rules_002c-default">rules, default</a>:</td><td> </td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Rules-Section.html#index-rules_002c-in-flex-input">rules, in flex input</a>:</td><td> </td><td valign="top"><a href="Rules-Section.html#Rules-Section">Rules Section</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-S">S</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Introduction.html#index-scanner_002c-definition-of">scanner, definition of</a>:</td><td> </td><td valign="top"><a href="Introduction.html#Introduction">Introduction</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Format.html#index-sections-of-flex-input">sections of flex input</a>:</td><td> </td><td valign="top"><a href="Format.html#Format">Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Serialized-Tables.html#index-serialization">serialization</a>:</td><td> </td><td valign="top"><a href="Serialized-Tables.html#Serialized-Tables">Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Creating-Serialized-Tables.html#index-serialization-of-tables">serialization of tables</a>:</td><td> </td><td valign="top"><a href="Creating-Serialized-Tables.html#Creating-Serialized-Tables">Creating Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Creating-Serialized-Tables.html#index-serialized-tables_002c-multiple-scanners">serialized tables, multiple scanners</a>:</td><td> </td><td valign="top"><a href="Creating-Serialized-Tables.html#Creating-Serialized-Tables">Creating Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-stack_002c-input-buffer-pop">stack, input buffer pop</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-stack_002c-input-buffer-push">stack, input buffer push</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-stacks_002c-routines-for-manipulating">stacks, routines for manipulating</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-condition_002c-applying-to-multiple-patterns">start condition, applying to multiple patterns</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions">start conditions</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-behavior-of-default-rule">start conditions, behavior of default rule</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-exclusive">start conditions, exclusive</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-for-different-interpretations-of-same-input">start conditions, for different interpretations of same input</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-start-conditions_002c-in-patterns">start conditions, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-inclusive">start conditions, inclusive</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-inclusive-v_002es_002e-exclusive">start conditions, inclusive v.s. exclusive</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-integer-values">start conditions, integer values</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-multiple">start conditions, multiple</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-special-wildcard-condition">start conditions, special wildcard condition</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-use-of-a-stack">start conditions, use of a stack</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-use-of-wildcard-condition-_0028_003c_002a_003e_0029">start conditions, use of wildcard condition (<*>)</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-start-conditions_002c-using-BEGIN">start conditions, using BEGIN</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-stdin_002c-default-for-yyin">stdin, default for yyin</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-stdout_002c-as-default-for-yyout">stdout, as default for yyout</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-strings_002c-scanning-strings-instead-of-files">strings, scanning strings instead of files</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-T">T</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Creating-Serialized-Tables.html#index-tables_002c-creating-serialized">tables, creating serialized</a>:</td><td> </td><td valign="top"><a href="Creating-Serialized-Tables.html#Creating-Serialized-Tables">Creating Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Tables-File-Format.html#index-tables_002c-file-format">tables, file format</a>:</td><td> </td><td valign="top"><a href="Tables-File-Format.html#Tables-File-Format">Tables File Format</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-tables_002c-freeing">tables, freeing</a>:</td><td> </td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#index-tables_002c-loading-and-unloading">tables, loading and unloading</a>:</td><td> </td><td valign="top"><a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables">Loading and Unloading Serialized Tables</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-terminating-with-yyterminate_0028_0029">terminating with yyterminate()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-token">token</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-trailing-context_002c-in-patterns">trailing context, in patterns</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-trailing-context_002c-limits-of">trailing context, limits of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-trailing-context_002c-matching">trailing context, matching</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-trailing-context_002c-performance-costs">trailing context, performance costs</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-trailing-context_002c-variable-length">trailing context, variable length</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-U">U</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-unput_0028_0029">unput()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-unput_0028_0029_002c-and-_0025pointer">unput(), and %pointer</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-unput_0028_0029_002c-pushing-back-characters">unput(), pushing back characters</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="User-Code-Section.html#index-user-code_002c-in-flex-input">user code, in flex input</a>:</td><td> </td><td valign="top"><a href="User-Code-Section.html#User-Code-Section">User Code Section</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Simple-Examples.html#index-username-expansion">username expansion</a>:</td><td> </td><td valign="top"><a href="Simple-Examples.html#Simple-Examples">Simple Examples</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-using-integer-values-of-start-condition-names">using integer values of start condition names</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-V">V</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Patterns.html#index-verbatim-text-in-patterns_002c-syntax-of">verbatim text in patterns, syntax of</a>:</td><td> </td><td valign="top"><a href="Patterns.html#Patterns">Patterns</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-W">W</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Limitations.html#index-warning_002c-dangerous-trailing-context">warning, dangerous trailing context</a>:</td><td> </td><td valign="top"><a href="Limitations.html#Limitations">Limitations</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Diagnostics.html#index-warning_002c-rule-cannot-be-matched">warning, rule cannot be matched</a>:</td><td> </td><td valign="top"><a href="Diagnostics.html#Diagnostics">Diagnostics</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Diagnostics.html#index-warnings_002c-diagnostic-messages">warnings, diagnostic messages</a>:</td><td> </td><td valign="top"><a href="Diagnostics.html#Diagnostics">Diagnostics</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-whitespace_002c-compressing">whitespace, compressing</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
<tr><th><a name="Concept-Index_cp_letter-Y">Y</a></th><td></td><td></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Yacc.html#index-yacc-interface">yacc interface</a>:</td><td> </td><td valign="top"><a href="Yacc.html#Yacc">Yacc</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Yacc.html#index-yacc_002c-interface">yacc, interface</a>:</td><td> </td><td valign="top"><a href="Yacc.html#Yacc">Yacc</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-yyalloc_002c-overriding">yyalloc, overriding</a>:</td><td> </td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-yyfree_002c-overriding">yyfree, overriding</a>:</td><td> </td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yyin">yyin</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yyinput_0028_0029">yyinput()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-yyleng">yyleng</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yyleng_002c-modification-of">yyleng, modification of</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yyless_0028_0029">yyless()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yyless_0028_0029_002c-pushing-back-characters">yyless(), pushing back characters</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yylex_0028_0029_002c-in-generated-scanner">yylex(), in generated scanner</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yylex_0028_0029_002c-overriding">yylex(), overriding</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yylex_002c-overriding-the-prototype-of">yylex, overriding the prototype of</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Reentrant-Functions.html#index-yylineno_002c-in-a-reentrant-scanner">yylineno, in a reentrant scanner</a>:</td><td> </td><td valign="top"><a href="Reentrant-Functions.html#Reentrant-Functions">Reentrant Functions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Performance.html#index-yylineno_002c-performance-costs">yylineno, performance costs</a>:</td><td> </td><td valign="top"><a href="Performance.html#Performance">Performance</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_0028_0029">yymore()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_0028_0029-to-append-token-to-previous-token">yymore() to append token to previous token</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_0028_0029_002c-mega_002dkludge">yymore(), mega-kludge</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_002c-and-yyleng">yymore, and yyleng</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yymore_002c-performance-penalty-of">yymore, performance penalty of</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yyout">yyout</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#index-yyrealloc_002c-overriding">yyrealloc, overriding</a>:</td><td> </td><td valign="top"><a href="Overriding-The-Default-Memory-Management.html#Overriding-The-Default-Memory-Management">Overriding The Default Memory Management</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yyrestart_0028_0029">yyrestart()</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yyterminate_0028_0029">yyterminate()</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-yytext">yytext</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="User-Values.html#index-yytext_002c-default-array-size">yytext, default array size</a>:</td><td> </td><td valign="top"><a href="User-Values.html#User-Values">User Values</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="A-Note-About-yytext-And-Memory.html#index-yytext_002c-memory-considerations">yytext, memory considerations</a>:</td><td> </td><td valign="top"><a href="A-Note-About-yytext-And-Memory.html#A-Note-About-yytext-And-Memory">A Note About yytext And Memory</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-yytext_002c-modification-of">yytext, modification of</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Matching.html#index-yytext_002c-two-types-of">yytext, two types of</a>:</td><td> </td><td valign="top"><a href="Matching.html#Matching">Matching</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yywrap_0028_0029">yywrap()</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-yywrap_002c-default-for">yywrap, default for</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Multiple-Input-Buffers.html#index-YY_005fCURRENT_005fBUFFER_002c-and-multiple-buffers-Finally_002c-the-macro">YY_CURRENT_BUFFER, and multiple buffers Finally, the macro</a>:</td><td> </td><td valign="top"><a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers">Multiple Input Buffers</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Extra-Data.html#index-YY_005fEXTRA_005fTYPE_002c-defining-your-own-type">YY_EXTRA_TYPE, defining your own type</a>:</td><td> </td><td valign="top"><a href="Extra-Data.html#Extra-Data">Extra Data</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Actions.html#index-YY_005fFLUSH_005fBUFFER">YY_FLUSH_BUFFER</a>:</td><td> </td><td valign="top"><a href="Actions.html#Actions">Actions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-YY_005fINPUT">YY_INPUT</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Generated-Scanner.html#index-YY_005fINPUT_002c-overriding">YY_INPUT, overriding</a>:</td><td> </td><td valign="top"><a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Start-Conditions.html#index-YY_005fSTART_002c-example">YY_START, example</a>:</td><td> </td><td valign="top"><a href="Start-Conditions.html#Start-Conditions">Start Conditions</a></td></tr>
|
||||
<tr><td></td><td valign="top"><a href="Misc-Macros.html#index-YY_005fUSER_005fACTION-to-track-each-time-a-rule-is-matched">YY_USER_ACTION to track each time a rule is matched</a>:</td><td> </td><td valign="top"><a href="Misc-Macros.html#Misc-Macros">Misc Macros</a></td></tr>
|
||||
<tr><td colspan="4"> <hr></td></tr>
|
||||
</table>
|
||||
<table><tr><th valign="top">Jump to: </th><td><a class="summary-letter" href="#Concept-Index_cp_symbol-1"><b>$</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-2"><b>%</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-3"><b><</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-4"><b>[</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-5"><b>^</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_symbol-6"><b>|</b></a>
|
||||
|
||||
<br>
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-K"><b>K</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-N"><b>N</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
|
||||
|
||||
<a class="summary-letter" href="#Concept-Index_cp_letter-Y"><b>Y</b></a>
|
||||
|
||||
</td></tr></table>
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Index-of-Functions-and-Macros.html#Index-of-Functions-and-Macros" accesskey="n" rel="next">Index of Functions and Macros</a>, Previous: <a href="Indices.html#Indices" accesskey="p" rel="prev">Indices</a>, Up: <a href="Indices.html#Indices" accesskey="u" rel="up">Indices</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,142 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Copyright</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Copyright">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Copyright">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="Reporting-Bugs.html#Reporting-Bugs" rel="next" title="Reporting Bugs">
|
||||
<link href="index.html#Top" rel="prev" title="Top">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Copyright"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Reporting-Bugs.html#Reporting-Bugs" accesskey="n" rel="next">Reporting Bugs</a>, Previous: <a href="index.html#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Copyright-1"></a>
|
||||
<h2 class="chapter">1 Copyright</h2>
|
||||
|
||||
<a name="index-copyright-of-flex"></a>
|
||||
<a name="index-distributing-flex"></a>
|
||||
|
||||
<p>The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
</p>
|
||||
<p>Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
</p>
|
||||
<p>Copyright © 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
</p>
|
||||
<p>This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
</p>
|
||||
<p>The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
</p>
|
||||
<p>Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
</p>
|
||||
<ol>
|
||||
<li> Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
</li><li> Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
</li></ol>
|
||||
|
||||
<p>Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
</p>
|
||||
<p>THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,136 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Creating Serialized Tables</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Creating Serialized Tables">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Creating Serialized Tables">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Serialized-Tables.html#Serialized-Tables" rel="up" title="Serialized Tables">
|
||||
<link href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables" rel="next" title="Loading and Unloading Serialized Tables">
|
||||
<link href="Serialized-Tables.html#Serialized-Tables" rel="prev" title="Serialized Tables">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Creating-Serialized-Tables"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Loading-and-Unloading-Serialized-Tables.html#Loading-and-Unloading-Serialized-Tables" accesskey="n" rel="next">Loading and Unloading Serialized Tables</a>, Previous: <a href="Serialized-Tables.html#Serialized-Tables" accesskey="p" rel="prev">Serialized Tables</a>, Up: <a href="Serialized-Tables.html#Serialized-Tables" accesskey="u" rel="up">Serialized Tables</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Creating-Serialized-Tables-1"></a>
|
||||
<h3 class="section">22.1 Creating Serialized Tables</h3>
|
||||
<a name="index-tables_002c-creating-serialized"></a>
|
||||
<a name="index-serialization-of-tables"></a>
|
||||
|
||||
<p>You may create a scanner with serialized tables by specifying:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %option tables-file=FILE
|
||||
or
|
||||
--tables-file=FILE
|
||||
</pre></div>
|
||||
|
||||
<p>These options instruct flex to save the DFA tables to the file <var>FILE</var>. The tables
|
||||
will <em>not</em> 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.
|
||||
</p>
|
||||
<p>If you do not specify a filename to <code>--tables-file</code>, the tables will be
|
||||
saved to <samp>lex.yy.tables</samp>, where ‘<samp>yy</samp>’ is the appropriate prefix.
|
||||
</p>
|
||||
<p>If your project uses several different scanners, you can concatenate the
|
||||
serialized tables into one file, and flex will find the correct set of tables,
|
||||
using the scanner prefix as part of the lookup key. An example follows:
|
||||
</p>
|
||||
<a name="index-serialized-tables_002c-multiple-scanners"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim">$ flex --tables-file --prefix=cpp cpp.l
|
||||
$ flex --tables-file --prefix=c c.l
|
||||
$ cat lex.cpp.tables lex.c.tables > all.tables
|
||||
</pre></div>
|
||||
|
||||
<p>The above example created two scanners, ‘<samp>cpp</samp>’, and ‘<samp>c</samp>’. Since we did
|
||||
not specify a filename, the tables were serialized to <samp>lex.c.tables</samp> and
|
||||
<samp>lex.cpp.tables</samp>, respectively. Then, we concatenated the two files
|
||||
together into <samp>all.tables</samp>, which we will distribute with our project. At
|
||||
runtime, we will open the file and tell flex to load the tables from it. Flex
|
||||
will find the correct tables automatically. (See next section).
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
-357
@@ -1,357 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Cxx</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Cxx">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Cxx">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="Reentrant.html#Reentrant" rel="next" title="Reentrant">
|
||||
<link href="Performance.html#Performance" rel="prev" title="Performance">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Cxx"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Reentrant.html#Reentrant" accesskey="n" rel="next">Reentrant</a>, Previous: <a href="Performance.html#Performance" accesskey="p" rel="prev">Performance</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Generating-C_002b_002b-Scanners"></a>
|
||||
<h2 class="chapter">18 Generating C++ Scanners</h2>
|
||||
|
||||
<a name="index-c_002b_002b_002c-experimental-form-of-scanner-class"></a>
|
||||
<a name="index-experimental-form-of-c_002b_002b-scanner-class"></a>
|
||||
<p><strong>IMPORTANT</strong>: the present form of the scanning class is <em>experimental</em>
|
||||
and may change considerably between major releases.
|
||||
</p>
|
||||
<a name="index-C_002b_002b"></a>
|
||||
<a name="index-member-functions_002c-C_002b_002b"></a>
|
||||
<a name="index-methods_002c-c_002b_002b"></a>
|
||||
<p><code>flex</code> provides two different ways to generate scanners for use
|
||||
with C++. The first way is to simply compile a scanner generated by
|
||||
<code>flex</code> using a C++ compiler instead of a C compiler. You should
|
||||
not encounter any compilation errors (see <a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>). You can
|
||||
then use C++ code in your rule actions instead of C code. Note that the
|
||||
default input source for your scanner remains <samp>yyin</samp>, and default
|
||||
echoing is still done to <samp>yyout</samp>. Both of these remain <code>FILE
|
||||
*</code> variables and not C++ <em>streams</em>.
|
||||
</p>
|
||||
<p>You can also use <code>flex</code> to generate a C++ scanner class, using the
|
||||
‘<samp>-+</samp>’ option (or, equivalently, <code>%option c++)</code>, which is
|
||||
automatically specified if the name of the <code>flex</code> executable ends
|
||||
in a ’+’, such as <code>flex++</code>. When using this option, <code>flex</code>
|
||||
defaults to generating the scanner to the file <samp>lex.yy.cc</samp> instead
|
||||
of <samp>lex.yy.c</samp>. The generated scanner includes the header file
|
||||
<samp>FlexLexer.h</samp>, which defines the interface to two C++ classes.
|
||||
</p>
|
||||
<p>The first class in <samp>FlexLexer.h</samp>, <code>FlexLexer</code>,
|
||||
provides an abstract base class defining the general scanner class
|
||||
interface. It provides the following member functions:
|
||||
</p>
|
||||
<dl compact="compact">
|
||||
<dd><a name="index-YYText-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>const char* YYText()</code></dt>
|
||||
<dd><p>returns the text of the most recently matched token, the equivalent of
|
||||
<code>yytext</code>.
|
||||
</p>
|
||||
<a name="index-YYLeng-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>int YYLeng()</code></dt>
|
||||
<dd><p>returns the length of the most recently matched token, the equivalent of
|
||||
<code>yyleng</code>.
|
||||
</p>
|
||||
<a name="index-lineno-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>int lineno() const</code></dt>
|
||||
<dd><p>returns the current input line number (see <code>%option yylineno)</code>, or
|
||||
<code>1</code> if <code>%option yylineno</code> was not used.
|
||||
</p>
|
||||
<a name="index-set_005fdebug-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>void set_debug( int flag )</code></dt>
|
||||
<dd><p>sets the debugging flag for the scanner, equivalent to assigning to
|
||||
<code>yy_flex_debug</code> (see <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>). Note that you must build
|
||||
the scanner using <code>%option debug</code> to include debugging information
|
||||
in it.
|
||||
</p>
|
||||
<a name="index-debug-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>int debug() const</code></dt>
|
||||
<dd><p>returns the current setting of the debugging flag.
|
||||
</p></dd>
|
||||
</dl>
|
||||
|
||||
<p>Also provided are member functions equivalent to
|
||||
<code>yy_switch_to_buffer()</code>, <code>yy_create_buffer()</code> (though the
|
||||
first argument is an <code>istream&</code> object reference and not a
|
||||
<code>FILE*)</code>, <code>yy_flush_buffer()</code>, <code>yy_delete_buffer()</code>, and
|
||||
<code>yyrestart()</code> (again, the first argument is a <code>istream&</code>
|
||||
object reference).
|
||||
</p>
|
||||
<a name="index-yyFlexLexer-_0028C_002b_002b-only_0029"></a>
|
||||
<a name="index-FlexLexer-_0028C_002b_002b-only_0029"></a>
|
||||
<p>The second class defined in <samp>FlexLexer.h</samp> is <code>yyFlexLexer</code>,
|
||||
which is derived from <code>FlexLexer</code>. It defines the following
|
||||
additional member functions:
|
||||
</p>
|
||||
<dl compact="compact">
|
||||
<dd><a name="index-yyFlexLexer-constructor-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )</code></dt>
|
||||
<dt><code>yyFlexLexer( istream& arg_yyin, ostream& arg_yyout )</code></dt>
|
||||
<dd><p>constructs a <code>yyFlexLexer</code> object using the given streams for input
|
||||
and output. If not specified, the streams default to <code>cin</code> and
|
||||
<code>cout</code>, respectively. <code>yyFlexLexer</code> 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</code> instance.
|
||||
</p>
|
||||
<a name="index-yylex-_0028C_002b_002b-version_0029"></a>
|
||||
</dd>
|
||||
<dt><code>virtual int yylex()</code></dt>
|
||||
<dd><p>performs the same role is <code>yylex()</code> does for ordinary <code>flex</code>
|
||||
scanners: it scans the input stream, consuming tokens, until a rule’s
|
||||
action returns a value. If you derive a subclass <code>S</code> from
|
||||
<code>yyFlexLexer</code> and want to access the member functions and variables
|
||||
of <code>S</code> inside <code>yylex()</code>, then you need to use <code>%option
|
||||
yyclass="S"</code> to inform <code>flex</code> that you will be using that subclass
|
||||
instead of <code>yyFlexLexer</code>. In this case, rather than generating
|
||||
<code>yyFlexLexer::yylex()</code>, <code>flex</code> generates <code>S::yylex()</code>
|
||||
(and also generates a dummy <code>yyFlexLexer::yylex()</code> that calls
|
||||
<code>yyFlexLexer::LexerError()</code> if called).
|
||||
</p>
|
||||
<a name="index-switch_005fstreams-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>virtual void switch_streams(istream* new_in = 0, ostream* new_out = 0)</code></dt>
|
||||
<dt><code>virtual void switch_streams(istream& new_in, ostream& new_out)</code></dt>
|
||||
<dd><p>reassigns <code>yyin</code> to <code>new_in</code> (if non-null) and <code>yyout</code> to
|
||||
<code>new_out</code> (if non-null), deleting the previous input buffer if
|
||||
<code>yyin</code> is reassigned.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>int yylex( istream* new_in, ostream* new_out = 0 )</code></dt>
|
||||
<dt><code>int yylex( istream& new_in, ostream& new_out )</code></dt>
|
||||
<dd><p>first switches the input streams via <code>switch_streams( new_in,
|
||||
new_out )</code> and then returns the value of <code>yylex()</code>.
|
||||
</p></dd>
|
||||
</dl>
|
||||
|
||||
<p>In addition, <code>yyFlexLexer</code> defines the following protected virtual
|
||||
functions which you can redefine in derived classes to tailor the
|
||||
scanner:
|
||||
</p>
|
||||
<dl compact="compact">
|
||||
<dd><a name="index-LexerInput-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>virtual int LexerInput( char* buf, int max_size )</code></dt>
|
||||
<dd><p>reads up to <code>max_size</code> characters into <code>buf</code> and returns the
|
||||
number of characters read. To indicate end-of-input, return 0
|
||||
characters. Note that <code>interactive</code> scanners (see the ‘<samp>-B</samp>’
|
||||
and ‘<samp>-I</samp>’ flags in <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>) define the macro
|
||||
<code>YY_INTERACTIVE</code>. If you redefine <code>LexerInput()</code> and need to
|
||||
take different actions depending on whether or not the scanner might be
|
||||
scanning an interactive input source, you can test for the presence of
|
||||
this name via <code>#ifdef</code> statements.
|
||||
</p>
|
||||
<a name="index-LexerOutput-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>virtual void LexerOutput( const char* buf, int size )</code></dt>
|
||||
<dd><p>writes out <code>size</code> characters from the buffer <code>buf</code>, which, while
|
||||
<code>NUL</code>-terminated, may also contain internal <code>NUL</code>s if the
|
||||
scanner’s rules can match text with <code>NUL</code>s in them.
|
||||
</p>
|
||||
<a name="index-error-reporting_002c-in-C_002b_002b"></a>
|
||||
<a name="index-LexerError-_0028C_002b_002b-only_0029"></a>
|
||||
</dd>
|
||||
<dt><code>virtual void LexerError( const char* msg )</code></dt>
|
||||
<dd><p>reports a fatal error message. The default version of this function
|
||||
writes the message to the stream <code>cerr</code> and exits.
|
||||
</p></dd>
|
||||
</dl>
|
||||
|
||||
<p>Note that a <code>yyFlexLexer</code> object contains its <em>entire</em>
|
||||
scanning state. Thus you can use such objects to create reentrant
|
||||
scanners, but see also <a href="Reentrant.html#Reentrant">Reentrant</a>. You can instantiate multiple
|
||||
instances of the same <code>yyFlexLexer</code> class, and you can also combine
|
||||
multiple C++ scanner classes together in the same program using the
|
||||
‘<samp>-P</samp>’ option discussed above.
|
||||
</p>
|
||||
<p>Finally, note that the <code>%array</code> feature is not available to C++
|
||||
scanner classes; you must use <code>%pointer</code> (the default).
|
||||
</p>
|
||||
<p>Here is an example of a simple C++ scanner:
|
||||
</p>
|
||||
<a name="index-C_002b_002b-scanners_002c-use-of"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> // An example of using the flex C++ scanner class.
|
||||
|
||||
%{
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int mylineno = 0;
|
||||
%}
|
||||
|
||||
%option noyywrap c++
|
||||
|
||||
string \"[^\n"]+\"
|
||||
|
||||
ws [ \t]+
|
||||
|
||||
alpha [A-Za-z]
|
||||
dig [0-9]
|
||||
name ({alpha}|{dig}|\$)({alpha}|{dig}|[_.\-/$])*
|
||||
num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)?
|
||||
num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
|
||||
number {num1}|{num2}
|
||||
|
||||
%%
|
||||
|
||||
{ws} /* skip blanks and tabs */
|
||||
|
||||
"/*" {
|
||||
int c;
|
||||
|
||||
while((c = yyinput()) != 0)
|
||||
{
|
||||
if(c == '\n')
|
||||
++mylineno;
|
||||
|
||||
else if(c == '*')
|
||||
{
|
||||
if((c = yyinput()) == '/')
|
||||
break;
|
||||
else
|
||||
unput(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{number} cout << "number " << YYText() << '\n';
|
||||
|
||||
\n mylineno++;
|
||||
|
||||
{name} cout << "name " << YYText() << '\n';
|
||||
|
||||
{string} cout << "string " << YYText() << '\n';
|
||||
|
||||
%%
|
||||
|
||||
// This include is required if main() is an another source file.
|
||||
//#include <FlexLexer.h>
|
||||
|
||||
int main( int /* argc */, char** /* argv */ )
|
||||
{
|
||||
FlexLexer* lexer = new yyFlexLexer;
|
||||
while(lexer->yylex() != 0)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<a name="index-C_002b_002b_002c-multiple-different-scanners"></a>
|
||||
<p>If you want to create multiple (different) lexer classes, you use the
|
||||
‘<samp>-P</samp>’ flag (or the <code>prefix=</code> option) to rename each
|
||||
<code>yyFlexLexer</code> to some other ‘<samp>xxFlexLexer</samp>’. You then can
|
||||
include <samp><FlexLexer.h></samp> in your other sources once per lexer class,
|
||||
first renaming <code>yyFlexLexer</code> as follows:
|
||||
</p>
|
||||
<a name="index-include-files_002c-with-C_002b_002b"></a>
|
||||
<a name="index-header-files_002c-with-C_002b_002b"></a>
|
||||
<a name="index-C_002b_002b-scanners_002c-including-multiple-scanners"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> #undef yyFlexLexer
|
||||
#define yyFlexLexer xxFlexLexer
|
||||
#include <FlexLexer.h>
|
||||
|
||||
#undef yyFlexLexer
|
||||
#define yyFlexLexer zzFlexLexer
|
||||
#include <FlexLexer.h>
|
||||
</pre></div>
|
||||
|
||||
<p>if, for example, you used <code>%option prefix="xx"</code> for one of your
|
||||
scanners and <code>%option prefix="zz"</code> for the other.
|
||||
</p>
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Reentrant.html#Reentrant" accesskey="n" rel="next">Reentrant</a>, Previous: <a href="Performance.html#Performance" accesskey="p" rel="prev">Performance</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,221 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Debugging Options</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Debugging Options">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Debugging Options">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Scanner-Options.html#Scanner-Options" rel="up" title="Scanner Options">
|
||||
<link href="Miscellaneous-Options.html#Miscellaneous-Options" rel="next" title="Miscellaneous Options">
|
||||
<link href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" rel="prev" title="Options for Scanner Speed and Size">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Debugging-Options"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Miscellaneous-Options.html#Miscellaneous-Options" accesskey="n" rel="next">Miscellaneous Options</a>, Previous: <a href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" accesskey="p" rel="prev">Options for Scanner Speed and Size</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Debugging-Options-1"></a>
|
||||
<h3 class="section">16.5 Debugging Options</h3>
|
||||
|
||||
<dl compact="compact">
|
||||
<dd>
|
||||
<a name="option_002dbackup"></a><a name="index-_002db"></a>
|
||||
<a name="index-_002d_002d_002dbackup"></a>
|
||||
<a name="index-backup"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-b, --backup, <code>%option backup</code></samp>’</dt>
|
||||
<dd><p>Generate backing-up information to <samp>lex.backup</samp>. This is a list of
|
||||
scanner states which require backing up and the input characters on
|
||||
which they do so. By adding rules one can remove backing-up states. If
|
||||
<em>all</em> backing-up states are eliminated and ‘<samp>-Cf</samp>’ or <code>-CF</code>
|
||||
is used, the generated scanner will run faster (see the ‘<samp>--perf-report</samp>’ flag).
|
||||
Only users who wish to squeeze every last cycle out of their scanners
|
||||
need worry about this option. (see <a href="Performance.html#Performance">Performance</a>).
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002ddebug"></a><a name="index-_002dd"></a>
|
||||
<a name="index-_002d_002d_002ddebug"></a>
|
||||
<a name="index-debug"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-d, --debug, <code>%option debug</code></samp>’</dt>
|
||||
<dd><p>makes the generated scanner run in <em>debug</em> mode. Whenever a pattern
|
||||
is recognized and the global variable <code>yy_flex_debug</code> is non-zero
|
||||
(which is the default), the scanner will write to <samp>stderr</samp> a line
|
||||
of the form:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> -accepting rule at line 53 ("the matched text")
|
||||
</pre></div>
|
||||
|
||||
<p>The line number refers to the location of the rule in the file defining
|
||||
the scanner (i.e., the file that was fed to flex). Messages are also
|
||||
generated when the scanner backs up, accepts the default rule, reaches
|
||||
the end of its input buffer (or encounters a NUL; at this point, the two
|
||||
look the same as far as the scanner’s concerned), or reaches an
|
||||
end-of-file.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dperf_002dreport"></a><a name="index-_002dp"></a>
|
||||
<a name="index-_002d_002d_002dperf_002dreport"></a>
|
||||
<a name="index-perf_002dreport"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-p, --perf-report, <code>%option perf-report</code></samp>’</dt>
|
||||
<dd><p>generates a performance report to <samp>stderr</samp>. The report consists of
|
||||
comments regarding features of the <code>flex</code> input file which will
|
||||
cause a serious loss of performance in the resulting scanner. If you
|
||||
give the flag twice, you will also get comments regarding features that
|
||||
lead to minor performance losses.
|
||||
</p>
|
||||
<p>Note that the use of <code>REJECT</code>, and
|
||||
variable trailing context (see <a href="Limitations.html#Limitations">Limitations</a>) entails a substantial
|
||||
performance penalty; use of <code>yymore()</code>, the ‘<samp>^</samp>’ operator, and
|
||||
the ‘<samp>--interactive</samp>’ flag entail minor performance penalties.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dnodefault"></a><a name="index-_002ds"></a>
|
||||
<a name="index-_002d_002d_002dnodefault"></a>
|
||||
<a name="index-nodefault"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-s, --nodefault, <code>%option nodefault</code></samp>’</dt>
|
||||
<dd><p>causes the <em>default rule</em> (that unmatched scanner input is echoed
|
||||
to <samp>stdout)</samp> to be suppressed. If the scanner encounters input
|
||||
that does not match any of its rules, it aborts with an error. This
|
||||
option is useful for finding holes in a scanner’s rule set.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dtrace"></a><a name="index-_002dT"></a>
|
||||
<a name="index-_002d_002d_002dtrace"></a>
|
||||
<a name="index-trace"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-T, --trace, <code>%option trace</code></samp>’</dt>
|
||||
<dd><p>makes <code>flex</code> run in <em>trace</em> mode. It will generate a lot of
|
||||
messages to <samp>stderr</samp> concerning the form of the input and the
|
||||
resultant non-deterministic and deterministic finite automata. This
|
||||
option is mostly for use in maintaining <code>flex</code>.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dnowarn"></a><a name="index-_002dw"></a>
|
||||
<a name="index-_002d_002d_002dnowarn"></a>
|
||||
<a name="index-nowarn"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-w, --nowarn, <code>%option nowarn</code></samp>’</dt>
|
||||
<dd><p>suppresses warning messages.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dverbose"></a><a name="index-_002dv"></a>
|
||||
<a name="index-_002d_002d_002dverbose"></a>
|
||||
<a name="index-verbose"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>-v, --verbose, <code>%option verbose</code></samp>’</dt>
|
||||
<dd><p>specifies that <code>flex</code> should write to <samp>stderr</samp> a summary of
|
||||
statistics regarding the scanner it generates. Most of the statistics
|
||||
are meaningless to the casual <code>flex</code> user, but the first line
|
||||
identifies the version of <code>flex</code> (same as reported by ‘<samp>--version</samp>’),
|
||||
and the next line the flags used when generating the scanner, including
|
||||
those that are on by default.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="option_002dwarn"></a><a name="index-_002d_002d_002dwarn"></a>
|
||||
<a name="index-warn"></a>
|
||||
</dd>
|
||||
<dt>‘<samp>--warn, <code>%option warn</code></samp>’</dt>
|
||||
<dd><p>warn about certain things. In particular, if the default rule can be
|
||||
matched but no default rule has been given, the flex will warn you.
|
||||
We recommend using this option always.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Miscellaneous-Options.html#Miscellaneous-Options" accesskey="n" rel="next">Miscellaneous Options</a>, Previous: <a href="Options-for-Scanner-Speed-and-Size.html#Options-for-Scanner-Speed-and-Size" accesskey="p" rel="prev">Options for Scanner Speed and Size</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,192 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Definitions Section</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Definitions Section">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Definitions Section">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Format.html#Format" rel="up" title="Format">
|
||||
<link href="Rules-Section.html#Rules-Section" rel="next" title="Rules Section">
|
||||
<link href="Format.html#Format" rel="prev" title="Format">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Definitions-Section"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Rules-Section.html#Rules-Section" accesskey="n" rel="next">Rules Section</a>, Previous: <a href="Format.html#Format" accesskey="p" rel="prev">Format</a>, Up: <a href="Format.html#Format" accesskey="u" rel="up">Format</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Format-of-the-Definitions-Section"></a>
|
||||
<h3 class="section">5.1 Format of the Definitions Section</h3>
|
||||
|
||||
<a name="index-input-file_002c-Definitions-section"></a>
|
||||
<a name="index-Definitions_002c-in-flex-input"></a>
|
||||
<p>The <em>definitions section</em> contains declarations of simple <em>name</em>
|
||||
definitions to simplify the scanner specification, and declarations of
|
||||
<em>start conditions</em>, which are explained in a later section.
|
||||
</p>
|
||||
<a name="index-aliases_002c-how-to-define"></a>
|
||||
<a name="index-pattern-aliases_002c-how-to-define"></a>
|
||||
<p>Name definitions have the form:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> name definition
|
||||
</pre></div>
|
||||
|
||||
<p>The ‘<samp>name</samp>’ is a word beginning with a letter or an underscore
|
||||
(‘<samp>_</samp>’) followed by zero or more letters, digits, ‘<samp>_</samp>’, or
|
||||
‘<samp>-</samp>’ (dash). The definition is taken to begin at the first
|
||||
non-whitespace character following the name and continuing to the end of
|
||||
the line. The definition can subsequently be referred to using
|
||||
‘<samp>{name}</samp>’, which will expand to ‘<samp>(definition)</samp>’. For example,
|
||||
</p>
|
||||
<a name="index-pattern-aliases_002c-defining"></a>
|
||||
<a name="index-defining-pattern-aliases"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> DIGIT [0-9]
|
||||
ID [a-z][a-z0-9]*
|
||||
</pre></div>
|
||||
|
||||
<p>Defines ‘<samp>DIGIT</samp>’ to be a regular expression which matches a single
|
||||
digit, and ‘<samp>ID</samp>’ to be a regular expression which matches a letter
|
||||
followed by zero-or-more letters-or-digits. A subsequent reference to
|
||||
</p>
|
||||
<a name="index-pattern-aliases_002c-use-of"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> {DIGIT}+"."{DIGIT}*
|
||||
</pre></div>
|
||||
|
||||
<p>is identical to
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> ([0-9])+"."([0-9])*
|
||||
</pre></div>
|
||||
|
||||
<p>and matches one-or-more digits followed by a ‘<samp>.</samp>’ followed by
|
||||
zero-or-more digits.
|
||||
</p>
|
||||
<a name="index-comments-in-flex-input"></a>
|
||||
<p>An unindented comment (i.e., a line
|
||||
beginning with ‘<samp>/*</samp>’) is copied verbatim to the output up
|
||||
to the next ‘<samp>*/</samp>’.
|
||||
</p>
|
||||
<a name="index-_0025_007b-and-_0025_007d_002c-in-Definitions-Section"></a>
|
||||
<a name="index-embedding-C-code-in-flex-input"></a>
|
||||
<a name="index-C-code-in-flex-input"></a>
|
||||
<p>Any <em>indented</em> text or text enclosed in ‘<samp>%{</samp>’ and ‘<samp>%}</samp>’
|
||||
is also copied verbatim to the output (with the %{ and %} symbols
|
||||
removed). The %{ and %} symbols must appear unindented on lines by
|
||||
themselves.
|
||||
</p>
|
||||
<a name="index-_0025top"></a>
|
||||
|
||||
<p>A <code>%top</code> block is similar to a ‘<samp>%{</samp>’ ... ‘<samp>%}</samp>’ block, except
|
||||
that the code in a <code>%top</code> block is relocated to the <em>top</em> of the
|
||||
generated file, before any flex definitions <a name="DOCF1" href="#FOOT1"><sup>1</sup></a>.
|
||||
The <code>%top</code> 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>{</samp>’ and ‘<samp>}</samp>’ are used to delimit the
|
||||
<code>%top</code> block, as show in the example below:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %top{
|
||||
/* This code goes at the "top" of the generated file. */
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
<p>Multiple <code>%top</code> blocks are allowed, and their order is preserved.
|
||||
</p>
|
||||
<div class="footnote">
|
||||
<hr>
|
||||
<h4 class="footnotes-heading">Footnotes</h4>
|
||||
|
||||
<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
|
||||
<p>Actually,
|
||||
<code>yyIN_HEADER</code> is defined before the ‘<samp>%top</samp>’ block.</p>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Rules-Section.html#Rules-Section" accesskey="n" rel="next">Rules Section</a>, Previous: <a href="Format.html#Format" accesskey="p" rel="prev">Format</a>, Up: <a href="Format.html#Format" accesskey="u" rel="up">Format</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,182 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Diagnostics</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Diagnostics">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Diagnostics">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="Limitations.html#Limitations" rel="next" title="Limitations">
|
||||
<link href="Tables-File-Format.html#Tables-File-Format" rel="prev" title="Tables File Format">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Diagnostics"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Limitations.html#Limitations" accesskey="n" rel="next">Limitations</a>, Previous: <a href="Serialized-Tables.html#Serialized-Tables" accesskey="p" rel="prev">Serialized Tables</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Diagnostics-1"></a>
|
||||
<h2 class="chapter">23 Diagnostics</h2>
|
||||
|
||||
<a name="index-error-reporting_002c-diagnostic-messages"></a>
|
||||
<a name="index-warnings_002c-diagnostic-messages"></a>
|
||||
|
||||
<p>The following is a list of <code>flex</code> diagnostic messages:
|
||||
</p>
|
||||
<ul>
|
||||
<li> ‘<samp>warning, rule cannot be matched</samp>’ indicates that the given rule
|
||||
cannot be matched because it follows other rules that will always match
|
||||
the same text as it. For example, in the following ‘<samp>foo</samp>’ cannot be
|
||||
matched because it comes after an identifier “catch-all” rule:
|
||||
|
||||
<a name="index-warning_002c-rule-cannot-be-matched"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> [a-z]+ got_identifier();
|
||||
foo got_foo();
|
||||
</pre></div>
|
||||
|
||||
<p>Using <code>REJECT</code> in a scanner suppresses this warning.
|
||||
</p>
|
||||
</li><li> ‘<samp>warning, -s option given but default rule can be matched</samp>’ means
|
||||
that it is possible (perhaps only in a particular start condition) that
|
||||
the default rule (match any single character) is the only one that will
|
||||
match a particular input. Since ‘<samp>-s</samp>’ was given, presumably this is
|
||||
not intended.
|
||||
|
||||
</li><li> <code>reject_used_but_not_detected undefined</code> or
|
||||
<code>yymore_used_but_not_detected undefined</code>. These errors can occur
|
||||
at compile time. They indicate that the scanner uses <code>REJECT</code> or
|
||||
<code>yymore()</code> but that <code>flex</code> failed to notice the fact, meaning
|
||||
that <code>flex</code> scanned the first two sections looking for occurrences
|
||||
of these actions and failed to find any, but somehow you snuck some in
|
||||
(via a #include file, for example). Use <code>%option reject</code> or
|
||||
<code>%option yymore</code> to indicate to <code>flex</code> that you really do use
|
||||
these features.
|
||||
|
||||
</li><li> ‘<samp>flex scanner jammed</samp>’. a scanner compiled with
|
||||
‘<samp>-s</samp>’ has encountered an input string which wasn’t matched by any of
|
||||
its rules. This error can also occur due to internal problems.
|
||||
|
||||
</li><li> ‘<samp>token too large, exceeds YYLMAX</samp>’. your scanner uses <code>%array</code>
|
||||
and one of its rules matched a string longer than the <code>YYLMAX</code>
|
||||
constant (8K bytes by default). You can increase the value by
|
||||
#define’ing <code>YYLMAX</code> in the definitions section of your <code>flex</code>
|
||||
input.
|
||||
|
||||
</li><li> ‘<samp>scanner requires -8 flag to use the character 'x'</samp>’. Your scanner
|
||||
specification includes recognizing the 8-bit character ‘<samp>'x'</samp>’ and
|
||||
you did not specify the -8 flag, and your scanner defaulted to 7-bit
|
||||
because you used the ‘<samp>-Cf</samp>’ or ‘<samp>-CF</samp>’ table compression options.
|
||||
See the discussion of the ‘<samp>-7</samp>’ flag, <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>, for
|
||||
details.
|
||||
|
||||
</li><li> ‘<samp>flex scanner push-back overflow</samp>’. you used <code>unput()</code> to push
|
||||
back so much text that the scanner’s buffer could not hold both the
|
||||
pushed-back text and the current token in <code>yytext</code>. Ideally the
|
||||
scanner should dynamically resize the buffer in this case, but at
|
||||
present it does not.
|
||||
|
||||
</li><li> ‘<samp>input buffer overflow, can't enlarge buffer because scanner uses
|
||||
REJECT</samp>’. the scanner was working on matching an extremely large token
|
||||
and needed to expand the input buffer. This doesn’t work with scanners
|
||||
that use <code>REJECT</code>.
|
||||
|
||||
</li><li> ‘<samp>fatal flex scanner internal error--end of buffer missed</samp>’. This can
|
||||
occur in a scanner which is reentered after a long-jump has jumped out
|
||||
(or over) the scanner’s activation frame. Before reentering the
|
||||
scanner, use:
|
||||
<div class="example">
|
||||
<pre class="verbatim"> yyrestart( yyin );
|
||||
</pre></div>
|
||||
<p>or, as noted above, switch to using the C++ scanner class.
|
||||
</p>
|
||||
</li><li> ‘<samp>too many start conditions in <> construct!</samp>’ you listed more start
|
||||
conditions in a <> construct than exist (so you must have listed at
|
||||
least one of them twice).
|
||||
</li></ul>
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Limitations.html#Limitations" accesskey="n" rel="next">Limitations</a>, Previous: <a href="Serialized-Tables.html#Serialized-Tables" accesskey="p" rel="prev">Serialized Tables</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,115 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Does flex support recursive pattern definitions?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Does flex support recursive pattern definitions?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Does flex support recursive pattern definitions?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="How-do-I-skip-huge-chunks-of-input-_0028tens-of-megabytes_0029-while-using-flex_003f.html#How-do-I-skip-huge-chunks-of-input-_0028tens-of-megabytes_0029-while-using-flex_003f" rel="next" title="How do I skip huge chunks of input (tens of megabytes) while using flex?">
|
||||
<link href="Why-do-flex-scanners-call-fileno-if-it-is-not-ANSI-compatible_003f.html#Why-do-flex-scanners-call-fileno-if-it-is-not-ANSI-compatible_003f" rel="prev" title="Why do flex scanners call fileno if it is not ANSI compatible?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Does-flex-support-recursive-pattern-definitions_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="How-do-I-skip-huge-chunks-of-input-_0028tens-of-megabytes_0029-while-using-flex_003f.html#How-do-I-skip-huge-chunks-of-input-_0028tens-of-megabytes_0029-while-using-flex_003f" accesskey="n" rel="next">How do I skip huge chunks of input (tens of megabytes) while using flex?</a>, Previous: <a href="Why-do-flex-scanners-call-fileno-if-it-is-not-ANSI-compatible_003f.html#Why-do-flex-scanners-call-fileno-if-it-is-not-ANSI-compatible_003f" accesskey="p" rel="prev">Why do flex scanners call fileno if it is not ANSI compatible?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Does-flex-support-recursive-pattern-definitions_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Does flex support recursive pattern definitions?</h3>
|
||||
|
||||
<p>e.g.,
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim">%%
|
||||
block "{"({block}|{statement})*"}"
|
||||
</pre></div>
|
||||
|
||||
<p>No. You cannot have recursive definitions. The pattern-matching power of
|
||||
regular expressions in general (and therefore flex scanners, too) is
|
||||
limited. In particular, regular expressions cannot “balance” parentheses
|
||||
to an arbitrary degree. For example, it’s impossible to write a regular
|
||||
expression that matches all strings containing the same number of ’{’s
|
||||
as ’}’s. For more powerful pattern matching, you need a parser, such
|
||||
as <cite>GNU bison</cite>.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,105 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Does there exist a "faster" NDFA->DFA algorithm?</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Does there exist a "faster" NDFA->DFA algorithm?">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Does there exist a "faster" NDFA->DFA algorithm?">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="How-does-flex-compile-the-DFA-so-quickly_003f.html#How-does-flex-compile-the-DFA-so-quickly_003f" rel="next" title="How does flex compile the DFA so quickly?">
|
||||
<link href="Can-I-get-the-flex-manual-in-another-format_003f.html#Can-I-get-the-flex-manual-in-another-format_003f" rel="prev" title="Can I get the flex manual in another format?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="How-does-flex-compile-the-DFA-so-quickly_003f.html#How-does-flex-compile-the-DFA-so-quickly_003f" accesskey="n" rel="next">How does flex compile the DFA so quickly?</a>, Previous: <a href="Can-I-get-the-flex-manual-in-another-format_003f.html#Can-I-get-the-flex-manual-in-another-format_003f" accesskey="p" rel="prev">Can I get the flex manual in another format?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Does-there-exist-a-_0022faster_0022-NDFA_002d_003eDFA-algorithm_003f-1"></a>
|
||||
<h3 class="unnumberedsec">Does there exist a "faster" NDFA->DFA algorithm?</h3>
|
||||
|
||||
<p>There’s no way around the potential exponential running time - it
|
||||
can take you exponential time just to enumerate all of the DFA states.
|
||||
In practice, though, the running time is closer to linear, or sometimes
|
||||
quadratic.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
-153
@@ -1,153 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: EOF</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: EOF">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: EOF">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="index.html#Top" rel="up" title="Top">
|
||||
<link href="Misc-Macros.html#Misc-Macros" rel="next" title="Misc Macros">
|
||||
<link href="Multiple-Input-Buffers.html#Multiple-Input-Buffers" rel="prev" title="Multiple Input Buffers">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="EOF"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Misc-Macros.html#Misc-Macros" accesskey="n" rel="next">Misc Macros</a>, Previous: <a href="Multiple-Input-Buffers.html#Multiple-Input-Buffers" accesskey="p" rel="prev">Multiple Input Buffers</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="End_002dof_002dFile-Rules"></a>
|
||||
<h2 class="chapter">12 End-of-File Rules</h2>
|
||||
|
||||
<a name="index-EOF_002c-explanation"></a>
|
||||
<p>The special rule <code><<EOF>></code> indicates
|
||||
actions which are to be taken when an end-of-file is
|
||||
encountered and <code>yywrap()</code> returns non-zero (i.e., indicates
|
||||
no further files to process). The action must finish
|
||||
by doing one of the following things:
|
||||
</p>
|
||||
<ul>
|
||||
<li> <a name="index-YY_005fNEW_005fFILE-_0028now-obsolete_0029"></a>
|
||||
assigning <samp>yyin</samp> to a new input file (in previous versions of
|
||||
<code>flex</code>, after doing the assignment you had to call the special
|
||||
action <code>YY_NEW_FILE</code>. This is no longer necessary.)
|
||||
|
||||
</li><li> executing a <code>return</code> statement;
|
||||
|
||||
</li><li> executing the special <code>yyterminate()</code> action.
|
||||
|
||||
</li><li> or, switching to a new buffer using <code>yy_switch_to_buffer()</code> as
|
||||
shown in the example above.
|
||||
</li></ul>
|
||||
|
||||
<p><<EOF>> rules may not be used with other patterns; they may only be
|
||||
qualified with a list of start conditions. If an unqualified <<EOF>>
|
||||
rule is given, it applies to <em>all</em> start conditions which do not
|
||||
already have <<EOF>> actions. To specify an <<EOF>> rule for only the
|
||||
initial start condition, use:
|
||||
</p>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> <INITIAL><<EOF>>
|
||||
</pre></div>
|
||||
|
||||
<p>These rules are useful for catching things like unclosed comments. An
|
||||
example:
|
||||
</p>
|
||||
<a name="index-_003c_003cEOF_003e_003e_002c-use-of"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> %x quote
|
||||
%%
|
||||
|
||||
...other rules for dealing with quotes...
|
||||
|
||||
<quote><<EOF>> {
|
||||
error( "unterminated quote" );
|
||||
yyterminate();
|
||||
}
|
||||
<<EOF>> {
|
||||
if ( *++filelist )
|
||||
yyin = fopen( *filelist, "r" );
|
||||
else
|
||||
yyterminate();
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,120 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: ERASEME53</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME53">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME53">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops.html#I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops" rel="next" title="I need to scan if-then-else blocks and while loops">
|
||||
<link href="Is-flex-GNU-or-not_003f.html#Is-flex-GNU-or-not_003f" rel="prev" title="Is flex GNU or not?">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="ERASEME53"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops.html#I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops" accesskey="n" rel="next">I need to scan if-then-else blocks and while loops</a>, Previous: <a href="Is-flex-GNU-or-not_003f.html#Is-flex-GNU-or-not_003f" accesskey="p" rel="prev">Is flex GNU or not?</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="ERASEME53-1"></a>
|
||||
<h3 class="unnumberedsec">ERASEME53</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: tsv@cs.UManitoba.CA
|
||||
Subject: Re: Flex (reg)..
|
||||
In-reply-to: Your message of Thu, 06 Mar 1997 23:50:16 PST.
|
||||
Date: Thu, 06 Mar 1997 15:54:19 PST
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
> [:alpha:] ([:alnum:] | \\_)*
|
||||
|
||||
If your rule really has embedded blanks as shown above, then it won't
|
||||
work, as the first blank delimits the rule from the action. (It wouldn't
|
||||
even compile ...) You need instead:
|
||||
|
||||
[:alpha:]([:alnum:]|\\_)*
|
||||
|
||||
and that should work fine - there's no restriction on what can go inside
|
||||
of ()'s except for the trailing context operator, '/'.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,124 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: ERASEME55</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME55">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME55">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="ERASEME56.html#ERASEME56" rel="next" title="ERASEME56">
|
||||
<link href="I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops.html#I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops" rel="prev" title="I need to scan if-then-else blocks and while loops">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="ERASEME55"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="ERASEME56.html#ERASEME56" accesskey="n" rel="next">ERASEME56</a>, Previous: <a href="I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops.html#I-need-to-scan-if_002dthen_002delse-blocks-and-while-loops" accesskey="p" rel="prev">I need to scan if-then-else blocks and while loops</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="ERASEME55-1"></a>
|
||||
<h3 class="unnumberedsec">ERASEME55</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: Colin Paul Adams <colin@colina.demon.co.uk>
|
||||
Subject: Re: Flex C++ classes and Bison
|
||||
In-reply-to: Your message of 09 Aug 1997 17:11:41 PDT.
|
||||
Date: Fri, 15 Aug 1997 10:48:19 PDT
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
> #define YY_DECL int yylex (YYSTYPE *lvalp, struct parser_control
|
||||
> *parm)
|
||||
>
|
||||
> I have been trying to get this to work as a C++ scanner, but it does
|
||||
> not appear to be possible (warning that it matches no declarations in
|
||||
> yyFlexLexer, or something like that).
|
||||
>
|
||||
> Is this supposed to be possible, or is it being worked on (I DID
|
||||
> notice the comment that scanner classes are still experimental, so I'm
|
||||
> not too hopeful)?
|
||||
|
||||
What you need to do is derive a subclass from yyFlexLexer that provides
|
||||
the above yylex() method, squirrels away lvalp and parm into member
|
||||
variables, and then invokes yyFlexLexer::yylex() to do the regular scanning.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,131 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: ERASEME56</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME56">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME56">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="ERASEME57.html#ERASEME57" rel="next" title="ERASEME57">
|
||||
<link href="ERASEME55.html#ERASEME55" rel="prev" title="ERASEME55">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="ERASEME56"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="ERASEME57.html#ERASEME57" accesskey="n" rel="next">ERASEME57</a>, Previous: <a href="ERASEME55.html#ERASEME55" accesskey="p" rel="prev">ERASEME55</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="ERASEME56-1"></a>
|
||||
<h3 class="unnumberedsec">ERASEME56</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: Mikael.Latvala@lmf.ericsson.se
|
||||
Subject: Re: Possible mistake in Flex v2.5 document
|
||||
In-reply-to: Your message of Fri, 05 Sep 1997 16:07:24 PDT.
|
||||
Date: Fri, 05 Sep 1997 10:01:54 PDT
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
> In that example you show how to count comment lines when using
|
||||
> C style /* ... */ comments. My question is, shouldn't you take into
|
||||
> account a scenario where end of a comment marker occurs inside
|
||||
> character or string literals?
|
||||
|
||||
The scanner certainly needs to also scan character and string literals.
|
||||
However it does that (there's an example in the man page for strings), the
|
||||
lexer will recognize the beginning of the literal before it runs across the
|
||||
embedded "/*". Consequently, it will finish scanning the literal before it
|
||||
even considers the possibility of matching "/*".
|
||||
|
||||
Example:
|
||||
|
||||
'([^']*|{ESCAPE_SEQUENCE})'
|
||||
|
||||
will match all the text between the ''s (inclusive). So the lexer
|
||||
considers this as a token beginning at the first ', and doesn't even
|
||||
attempt to match other tokens inside it.
|
||||
|
||||
I thinnk this subtlety is not worth putting in the manual, as I suspect
|
||||
it would confuse more people than it would enlighten.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,127 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: ERASEME57</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME57">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME57">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
|
||||
<link href="Is-there-a-repository-for-flex-scanners_003f.html#Is-there-a-repository-for-flex-scanners_003f" rel="next" title="Is there a repository for flex scanners?">
|
||||
<link href="ERASEME56.html#ERASEME56" rel="prev" title="ERASEME56">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="ERASEME57"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="Is-there-a-repository-for-flex-scanners_003f.html#Is-there-a-repository-for-flex-scanners_003f" accesskey="n" rel="next">Is there a repository for flex scanners?</a>, Previous: <a href="ERASEME56.html#ERASEME56" accesskey="p" rel="prev">ERASEME56</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="ERASEME57-1"></a>
|
||||
<h3 class="unnumberedsec">ERASEME57</h3>
|
||||
<div class="example">
|
||||
<pre class="verbatim">To: "Marty Leisner" <leisner@sdsp.mc.xerox.com>
|
||||
Subject: Re: flex limitations
|
||||
In-reply-to: Your message of Sat, 06 Sep 1997 11:27:21 PDT.
|
||||
Date: Mon, 08 Sep 1997 11:38:08 PDT
|
||||
From: Vern Paxson <vern>
|
||||
|
||||
> %%
|
||||
> [a-zA-Z]+ /* skip a line */
|
||||
> { printf("got %s\n", yytext); }
|
||||
> %%
|
||||
|
||||
What version of flex are you using? If I feed this to 2.5.4, it complains:
|
||||
|
||||
"bug.l", line 5: EOF encountered inside an action
|
||||
"bug.l", line 5: unrecognized rule
|
||||
"bug.l", line 5: fatal parse error
|
||||
|
||||
Not the world's greatest error message, but it manages to flag the problem.
|
||||
|
||||
(With the introduction of start condition scopes, flex can't accommodate
|
||||
an action on a separate line, since it's ambiguous with an indented rule.)
|
||||
|
||||
You can get 2.5.4 from ftp.ee.lbl.gov.
|
||||
|
||||
Vern
|
||||
</pre></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,175 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
The flex manual is placed under the same licensing conditions as the
|
||||
rest of flex:
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
|
||||
The Flex Project.
|
||||
|
||||
Copyright (C) 1990, 1997 The Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
This code is derived from software contributed to Berkeley by
|
||||
Vern Paxson.
|
||||
|
||||
The United States Government has rights in this work pursuant
|
||||
to contract no. DE-AC03-76SF00098 between the United States
|
||||
Department of Energy and the University of California.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. -->
|
||||
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
|
||||
<head>
|
||||
<title>Lexical Analysis With Flex, for Flex 2.6.2: Extra Data</title>
|
||||
|
||||
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Extra Data">
|
||||
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Extra Data">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="Generator" content="makeinfo">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link href="index.html#Top" rel="start" title="Top">
|
||||
<link href="Indices.html#Indices" rel="index" title="Indices">
|
||||
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||||
<link href="Reentrant-Detail.html#Reentrant-Detail" rel="up" title="Reentrant Detail">
|
||||
<link href="About-yyscan_005ft.html#About-yyscan_005ft" rel="next" title="About yyscan_t">
|
||||
<link href="Accessor-Methods.html#Accessor-Methods" rel="prev" title="Accessor Methods">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a.summary-letter {text-decoration: none}
|
||||
blockquote.indentedblock {margin-right: 0em}
|
||||
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||||
blockquote.smallquotation {font-size: smaller}
|
||||
div.display {margin-left: 3.2em}
|
||||
div.example {margin-left: 3.2em}
|
||||
div.lisp {margin-left: 3.2em}
|
||||
div.smalldisplay {margin-left: 3.2em}
|
||||
div.smallexample {margin-left: 3.2em}
|
||||
div.smalllisp {margin-left: 3.2em}
|
||||
kbd {font-style: oblique}
|
||||
pre.display {font-family: inherit}
|
||||
pre.format {font-family: inherit}
|
||||
pre.menu-comment {font-family: serif}
|
||||
pre.menu-preformatted {font-family: serif}
|
||||
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||||
pre.smallexample {font-size: smaller}
|
||||
pre.smallformat {font-family: inherit; font-size: smaller}
|
||||
pre.smalllisp {font-size: smaller}
|
||||
span.nolinebreak {white-space: nowrap}
|
||||
span.roman {font-family: initial; font-weight: normal}
|
||||
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||||
ul.no-bullet {list-style: none}
|
||||
-->
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body lang="en">
|
||||
<a name="Extra-Data"></a>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="About-yyscan_005ft.html#About-yyscan_005ft" accesskey="n" rel="next">About yyscan_t</a>, Previous: <a href="Accessor-Methods.html#Accessor-Methods" accesskey="p" rel="prev">Accessor Methods</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
<hr>
|
||||
<a name="Extra-Data-1"></a>
|
||||
<h4 class="subsection">19.4.6 Extra Data</h4>
|
||||
|
||||
<a name="index-reentrant_002c-extra-data"></a>
|
||||
<a name="index-yyextra"></a>
|
||||
<p>User-specific data can be stored in <code>yyextra</code>.
|
||||
</p>
|
||||
<p>In a reentrant scanner, it is unwise to use global variables to
|
||||
communicate with or maintain state between different pieces of your program.
|
||||
However, you may need access to external data or invoke external functions
|
||||
from within the scanner actions.
|
||||
Likewise, you may need to pass information to your scanner
|
||||
(e.g., open file descriptors, or database connections).
|
||||
In a non-reentrant scanner, the only way to do this would be through the
|
||||
use of global variables.
|
||||
<code>Flex</code> allows you to store arbitrary, “extra” data in a scanner.
|
||||
This data is accessible through the accessor methods
|
||||
<code>yyget_extra</code> and <code>yyset_extra</code>
|
||||
from outside the scanner, and through the shortcut macro
|
||||
<code>yyextra</code>
|
||||
from within the scanner itself. They are defined as follows:
|
||||
</p>
|
||||
<a name="index-YY_005fEXTRA_005fTYPE-_0028reentrant-only_0029"></a>
|
||||
<a name="index-yyget_005fextra"></a>
|
||||
<a name="index-yyset_005fextra"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> #define YY_EXTRA_TYPE void*
|
||||
YY_EXTRA_TYPE yyget_extra ( yyscan_t scanner );
|
||||
void yyset_extra ( YY_EXTRA_TYPE arbitrary_data , yyscan_t scanner);
|
||||
</pre></div>
|
||||
|
||||
<p>In addition, an extra form of <code>yylex_init</code> is provided,
|
||||
<code>yylex_init_extra</code>. This function is provided so that the yyextra value can
|
||||
be accessed from within the very first yyalloc, used to allocate
|
||||
the scanner itself.
|
||||
</p>
|
||||
<p>By default, <code>YY_EXTRA_TYPE</code> is defined as type <code>void *</code>. You
|
||||
may redefine this type using <code>%option extra-type="your_type"</code> in
|
||||
the scanner:
|
||||
</p>
|
||||
<a name="index-YY_005fEXTRA_005fTYPE_002c-defining-your-own-type"></a>
|
||||
<div class="example">
|
||||
<pre class="verbatim"> /* An example of overriding YY_EXTRA_TYPE. */
|
||||
%{
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
%}
|
||||
%option reentrant
|
||||
%option extra-type="struct stat *"
|
||||
%%
|
||||
|
||||
__filesize__ printf( "%ld", yyextra->st_size );
|
||||
__lastmod__ printf( "%ld", yyextra->st_mtime );
|
||||
%%
|
||||
void scan_file( char* filename )
|
||||
{
|
||||
yyscan_t scanner;
|
||||
struct stat buf;
|
||||
FILE *in;
|
||||
|
||||
in = fopen( filename, "r" );
|
||||
stat( filename, &buf );
|
||||
|
||||
yylex_init_extra( buf, &scanner );
|
||||
yyset_in( in, scanner );
|
||||
yylex( scanner );
|
||||
yylex_destroy( scanner );
|
||||
|
||||
fclose( in );
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
|
||||
<hr>
|
||||
<div class="header">
|
||||
<p>
|
||||
Next: <a href="About-yyscan_005ft.html#About-yyscan_005ft" accesskey="n" rel="next">About yyscan_t</a>, Previous: <a href="Accessor-Methods.html#Accessor-Methods" accesskey="p" rel="prev">Accessor Methods</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user