188 Commits
Author SHA1 Message Date
Eric S. Raymond 04c5b7c920 remove some gcc warnings 2020-09-06 11:21:46 -04:00
Joerg Sonnenberger a631f5da8d correct some indentation in skeleton 2020-04-24 12:06:24 -04:00
Will Estes 8b1fbf674f doc: document release page in README 2019-09-12 16:42:40 -04:00
Will Estes d3de49f842 doc: new translations 2019-06-20 14:05:30 -04:00
Explorer09 98018e3f58 scanner: Include-guard flexint_shared.h
This prevents compiler's "redefinition of typedef" warnings or errors
when we could include flexint_shared.h twice, when building flex's own
scanner (scan.c) or in the "multiple_scanners" test in the testsuite.

(Depending on the compiler's flags this might or might not produce
errors, but it's good to guard it anyway.)

Fixes: #329

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-05-22 16:56:52 -04:00
jannick0 21121feec9 scanner: no YYTABLES_NAME macro unless requested 2018-05-22 16:51:26 -04:00
Will Estes 4c7e3a5a67 po: include update_linguas script in distribution.
Since automake takes a hands off approach to the po/ directory, we
need to list update_linguas.sh in the top Makefile.am. We list it as a
dist_noinst_SCRIPT so that it will get distributed with executeable
permissions. We also list autogen.sh in the same way for the same
reason.
2018-05-07 15:53:26 -04:00
viktor.shepel a752d7c1c2 doc: display build status badge in README 2018-05-07 14:58:48 -04:00
Simon Sobisch 60b578fdaa doc: describe mailing list usage in more detail 2018-04-07 13:26:34 -04:00
Jannick b33fd4c43a doc: amend manual section on state stack functions. 2018-03-13 10:45:56 -04:00
jannick0 3971b6146a scanner: fix default of yy_top_state()
extend fix when `YY_G` is used (reentrant scanner).
2018-03-13 10:45:42 -04:00
jannick0 67b3e44872 scanner: fix default of yy_top_state()
For an _empty_ state stack the top of the state stack defaults to the state as if no state stack were present.

NB: sanity check for `yy_start_stack_ptr` could be added in `yy_top_state()`.
2018-03-13 10:45:16 -04:00
Explorer09 6a6e69af76 build: Add "-f" flag to "mv" in makefiles.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-12 10:34:36 +08:00
Explorer09 dcd8e8b401 build: Fix makefile dist-hook directory permissions.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-12 10:15:31 +08:00
Explorer09 e1f6b4a263 scanner: More compatible flex integer type definitions.
Visual C++ 2010 does not define __STDC_VERSION__, and (before Visual
C++ 2013) has <stdint.h> and not <inttypes.h>.

ANSI/ISO C only requires at least 16 bits for int type (not 32 bits as
required by POSIX since SUSv2), so check the bit length before the
typedef.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 5574881ff4 scanner: Skeleton no longer includes integer limit macros.
The [U]INT{8,16,32}_{MIN,MAX} macros are never used in skeleton code.
Having them in skeleton just increases the chance of conflicts in case
that user defines them in non-C99 environment (see issue #307, when
flex code is built in Visual C++ (before VS2013)).

flexint.h is now split in two files. Only "flexint_shared.h" will be
included in skeleton now, which defines flex integral types.
flexint.h contains integer limits macros that would be used in flex
only.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 ec4f23d5d2 scanner: Add a fallback INT_MAX definition.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 1985bb3c7a scanner: correct comments about __STDC_LIMIT_MACROS.
No code changes.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 16:00:24 -05:00
Explorer09 4081efa083 scanner: Fix glibc features.h dependency in skeleton.
Commit a17d79e9c7 defines _POSIX_C_SOURCE
to the minimum of 1 if it's not defined in the user's scanner code or
the compiling environment. However in glibc the macros are not yet set
up until one of the libc headers is included. This unfortunately have
made us overwrite the default _POSIX_C_SOURCE value that would be
defined by glibc (200809L at the time of writing), causing regressions
in user code.

Now in this patch:
1. Ensure feature test macros have been set up in glibc before checking
or defining any of them in our skeleton code.
2. Have a more conservative logic when determining the need to define
_POSIX_C_SOURCE (required for fileno()).

Fixes: #313

Note:
It could be tricky for application code to ensure feature test macros
have been set up in glibc, since <features.h> is no portable header and
not meant to be included directly by applications. The way to do it is
to include a libc header which in turn includes <features.h>. However,
many of the glibc headers check __USE_POSIX (a glibc internal macro
defined if _POSIX_C_SOURCE is defined) and determine which interfaces
to expose already, making the headers inappropriate for our goal.
Those which don't depend on _POSIX_C_SOURCE, and are also available
since ANSI C89, are only <assert.h>, <errno.h> and <math.h>.

<assert.h> is finally favored due to other considerations:
- <math.h> check for __USE_XOPEN in glibc, making a dependency on
_XOPEN_SOURCE, besides it exposes much more interfaces than we need.
- In djgpp, <errno.h> depends on _POSIX_SOURCE to hide definitions of
some errno values when it's defined.
- <assert.h> exposes the fewest interfaces among the 3 headers and, at
the time of writing, checks for only C99 (for __func__), C11 (for
_Static_assert), and _GNU_SOURCE when needed.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-08 10:04:36 +08:00
Explorer09 d5023f5a48 scanner: Fix scan.l xgettext warnings.
xgettext was not very clever at interpreting lex patterns and can get
confused when seeing unquoted quotation marks, and emit warnings for
them. Now fix the warnings by properly quoting the quotation marks in
lex regex patterns.

Example
    Original: \"[^"\n]*\" -> "warning: unterminated string literal"
    Fixed:    "\""[^""\n]*"\"" -> OK

My basic build test shows that the generated stage1scan.c is
bit-identical to the original.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-03-04 20:51:38 +08:00
Explorer09 e104f5589c travis: '--disable-acl' when building gettext
This silences a configure warning about libacl not found in Travis
build log.
2018-03-01 14:08:54 -05:00
Explorer09 6aa652b089 travis: Silence build output of automake and gettext
Only when a build error occurs on building any of these dependent
packages do we dump some sensible logs to standard output.
2018-03-01 14:08:54 -05:00
Kang-Che Sung e63c0bb6b6 travis: Hard-code hashes for verifying tarballs
GPG signatures require an external keyserver which might be offline,
which is undesirable for build server use. It's equally secure to just
hard-code the hashes, provided they're trusted (i.e. you verify a hash
against a GPG signature once).

Fixes: #311.

As a side note: the original two signatures
(gettext-0.19.8.1.tar.lz.sig and automake-1.15.1.tar.gz.sig) are signed
against the files' SHA-1 hash.
2018-03-01 14:08:54 -05:00
Explorer09 c42de062bb build: Move dnl comments out of AC_CHECK_FUNCS
Due to a bug, autoheader (2.69) will treat M4 dnl comments in a quoted
argument of AC_CHECK_FUNCS as function tokens and generate a lot of
redundant and useless HAVE_* macros in config.h.in.
(Examples: HAVE_DNL, HAVE_AVAILABLE_, HAVE_BY)

It seems to be this commit dbb4e94dc7 of
mine that revealed this autoheader bug, and the affected config.h.in
had been shipped within flex-2.6.4 release tarball.

I have reported the autoheader bug here:
<https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html>

As a workaround, let's move comments out of AC_CHECK_FUNCS.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-02-28 19:30:56 -05:00
Explorer09 065c9fbe22 test: Remove redundant '-o $@' in tableopts.am
$(LINK) in Automake already contains the '-o $@' arguments.
2018-02-24 23:12:09 +08:00
Will Estes ff7bc8af46 doc: list travis in NEWS [skip ci] 2018-01-03 08:49:00 -05:00
Will Estes c0508df61d initial .travis.yml file 2018-01-03 08:49:00 -05:00
Explorer09 e7d45afc6a scanner: Allow "--" as option argument.
Previously, invocations such as:

    flex --outfile -- wc1.l

 would fail with "requires an
argument" error message.

Fixes #285
2017-12-09 16:29:52 -05:00
Explorer09 c984ab0fd0 scanner: scanopt_err() now returns void 2017-12-08 09:56:18 -05:00
Explorer09 aa775c8711 scanner: simplify scanopt_usage().
In-function macro CALC_LEN removed and no longer needed.

Local variable renames:

    maxlen[0] => opt_col_width

    maxlen[1] => desc_col_width

    indent now explicitly const
2017-12-08 09:55:19 -05:00
Explorer09 23882383d4 scanner: prevent overflow in add_action() 2017-12-06 16:23:25 -05:00
Michael W. Bombardieri 08e1b25b0e scanner: use calloc to allocate new filter memory 2017-11-29 08:11:22 -05:00
Explorer09 87472f5aa7 Obsolete yypad64() macro.
Slightly rewrite the logic in yytbl_data_load() and yytbl_write_pad64()
so they simply check if the bytes read/written are in 8-byte boundary.
No need to calculate how many bytes we need to pad. (Incidentally this
makes smaller code in x86_64.)

For yytbl_hdr_init(), just expand the calculation from the macro.
2017-11-28 15:06:10 -05:00
Explorer09 12d2f86080 scanner: temporarily protect against ccl overflow & overwriting.
For ccladd(), if cclp given is a non-last ccl, adding a char into it
will overflow the buffer and overwrite the first char in the next ccl.

For now, add a temporary detection and protection code.  (Not sure if
this could happen in user input, but if it could, then you can expect
some "corrupted" behavior for generated scanners.)
2017-11-28 14:56:42 -05:00
Explorer09 ea1faa2d09 build: fix ENABLE_NLS preprocessor check.
Because ENABLE_NLS may be defined to 0 (manually, not through
autoconf) and it's semantically incorrect to only check whether it's
defined.

This is a correction to commit
661d603b65.
2017-11-28 14:09:04 -05:00
Explorer09 11b7512664 scanner: Rename genecs() local variables. No code changes. 2017-11-03 19:12:49 -04:00
Explorer09 3c0f34cf12 scanner: Remove unused BASENAME() macro.
(Simply forgot to do so in commit fb731ac022)
2017-11-03 18:41:16 -04:00
Alex Richardson 661d603b65 build: use #ifdef for ENABLE_NLS check.
config.h will have either define ENABLE_NLS or not define it. If it is
not defined we get a -Wundef warning due to using #if with an
undefined macro
2017-11-03 10:39:32 -04:00
Explorer09 a17d79e9c7 scanner: Define _POSIX_C_SOURCE when needed in skeleton.
The function fileno() is defined by POSIX. When flex would otherwise not provide that feature macro, we define it.

Fixes #263
2017-11-03 10:19:21 -04:00
Lukasz Baj 0db9f8903a build: Remove custom reallocarray() declaration.
Use one from <stdlib.h> instead because that is more portable.
2017-10-05 11:31:18 -04:00
Explorer09 37a6184dab scanner: Simplify PRINT_SPACES() macro 2017-10-05 11:27:54 -04:00
Explorer09 24fd055133 build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
This would, e.g. define _GNU_SOURCE in config.h, enabling the
reallocarray() prototype in glibc 2.26+ on Linux systems with that
version of glibc.

Fixes #241.
2017-09-04 11:22:30 -04:00
Will Estes 1d62d3eb24 doc: document config.h inclusion by flex itself 2017-09-03 21:25:57 -04:00
Explorer09 4b5111d977 scanner: Include flexdef.h at %top block of scan.l
config.h may define macros that alter the API of the standard library
funtions, and so it should be included before any other standard
header, even before the skeleton's standard header inclusion.

For example: config.h may #define _GNU_SOURCE that would expose the
reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we
include <stdlib.h> before config.h, reallocarray() would not be
available for use in lex file since the second include doesn't help
due to header guard.

For now our config.h might `#define malloc rpl_malloc` -- this
substitution must work before including stdlib.h, or else the compiler
will complain about missing prototypes, and may result in incorrect
code in scan.l (gcc warning: return makes pointer from integer without
a cast [-Wint-conversion]).

Fixes #247.
2017-09-03 21:17:59 -04:00
Explorer09 f2943389fd {re,}allocate_array code cleanup 2017-09-02 15:09:28 -04:00
Will Estes 71d3525ad2 doc: document libfl targets in Makefile 2017-09-02 15:07:52 -04:00
Explorer09 dd1afa37e1 build: Add convenience targets to build libfl only
These are wrappers around automake- and libtool-generated targets,
allowing users to build libfl only, without the main flex program.

See GH-256 for discussion.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2017-08-31 15:54:02 -04:00
Will Estes b84ad149c9 doc: document src/libfl in NEWS 2017-08-31 15:51:25 -04:00
Explorer09 08e19c55ca Don't install libfl.pc if --disable-libfl. 2017-08-27 00:18:44 +08:00
Explorer09 e199cb6bdf libfl.pc: Rewrite descriptions, remove unneeded Cflags.
There's no need to include any header when linking with `-lfl`.
2017-08-27 00:18:32 +08:00
Explorer09 7e06407175 Move libfl.pc.in to src subdirectory. 2017-08-27 00:17:57 +08:00
Will Estes 931d29bdea doc: NEWS updates 2017-08-24 09:26:02 -04:00
Explorer09 b115f389b2 Hardcode flex name in --help text
Don't use program_name in the description of -T/--trace or -V/--version
option. It's ugly when user invokes flex with a long path like
"/home/username/tools/bin/my-custom-built-flex".

This solution is not long term. If possible, the help text should be
modified so that the "flex" name is no longer needed below the first
"Usage:" line. All translations of help text will need to be updated
as well.
2017-08-24 08:34:23 -04:00
Explorer09 a657f0c6f5 Remove an unneeded gettext() in --version output
"%s %s\n" is not translatable
2017-08-24 08:34:23 -04:00
Explorer09 fb731ac022 scanner: remove BASENAME(); don't strip path from program_name
There's no technical need of stripping path from program_name. I think
the users should be fine if they see the path they use to invoke flex
is diagnostic messages and help texts.

Yes, users will see "Usage: ../flex [OPTIONS]..." now if they invoke
flex with the path "../flex".

The --version output has been changed so that the name field will be
always "flex" or "flex++". If the flex program has been renamed to
"lex" (for compatibility or other reason) this will allow identifying
the implementation name ("flex"). (And it's a recommended practice in
GNU Coding Standards)
2017-08-24 08:34:23 -04:00
Will Estes d64a5263cf build: sort .gitignore 2017-08-24 08:18:11 -04:00
Michael Haubenwallner 24e73c4446 have libobjs depend on libobjdir (#244) 2017-08-24 08:15:00 -04:00
Will Estes aa50a492fc build: git ignore libfl.pc 2017-08-24 08:02:19 -04:00
Tyler Slabinski c1ed5df2f6 Create libfl.pc target for pkgconfig 2017-08-24 07:52:13 -04:00
Jannick 535524ea6b scanner: #define BASENAME, remove #include libgen.h 2017-07-17 21:12:44 -04:00
Jannick 3f2b9a4d63 mkskel.sh: fix EOL issue for CRLF systems 2017-07-18 02:03:45 +02:00
jannick0 7af066b952 scanner: Ignore comment lines in skeleton files.
In skeleton files comments are indicated by leading `%#` and when
directly read in using `flex -S <skeleton.skl>` they should be
ignored. Example: `flex.skl`.

Amending commit 2f21edac99 which removed
this conditional branch.
2017-07-15 18:52:28 -04:00
Explorer09 e784a805ef filter: faster is_blank_line implementation
Using regex_t regex_blank_line is *slow*.
2017-07-15 18:31:41 -04:00
Explorer09 0f370436e1 filter: new internal function is_blank_line()
It's simply to return (regexec(&regex_blank_line, str, 0, NULL, 0) == 0);
The reason for encapsulation is to allow replacing this with a
non-regex method if necessary.
2017-07-13 15:15:29 -04:00
Will Estes 19cffb0ff0 build: require automake, gettext versions as per maintainer dev setup 2017-07-13 15:14:58 -04:00
Will Estes 36c2c0a2e8 doc: NEWS memory leak fix 2017-07-03 11:49:36 -04:00
viktor.shepel faa877a843 scanner: memory leak free scanner generator.
**Issue:**
Scanner generation leaks memory for transition tables when invoked
without `--tables-file` option.

**Root cause:**
`gentabs` function has different memory acquire/release conditions.

**Solution:**
Reclaim memory at the same scope where it was alloacated.
2017-07-03 11:45:55 -04:00
viktor.shepel 8a044dbe6d filter: memory leak free scanner postprocessing.
**Issue:**
Scanner postprocessing leaks memory during correction of `#line`
directives values and generation of C header file.

**Root cause:**
`filter_fix_linedirs` and `filter_tee_header` functions do not
dispose allocated memory.

**Solution:**
Automatically reclaim affected memory by allocating it on stack
insted of heap. Stack allocation should not be a problem as its
only 512 bytes and there is no recursive calls.
2017-07-03 11:45:37 -04:00
Will Estes ef32155253 doc: NEWS c{i,j} 2017-07-03 11:34:14 -04:00
NieDzejkob ea4b0a129e scanner: c{i,j} should preserve case.
Fixes #193
2017-07-03 11:34:00 -04:00
Will Estes 6bebb264a9 doc: document --backup-file in NEWS 2017-07-03 09:46:48 -04:00
EricSharkey c55bf919cc scanner: add optionn to specify backup filename.
In a directory containing multiple scanners, we want to allow
specifying the name of the backup file else the backup files will be
overwritten.
2017-07-03 09:41:42 -04:00
Will Estes 8bd14f1387 doc: new uk translation 2017-06-18 13:56:06 -04:00
Translation Project 90c62441b3 doc: new uk translation from the Translation Project 2017-06-18 13:55:11 -04:00
Explorer09 9e00f250f6 doc: formatting fixes in README 2017-06-04 16:20:04 -04:00
Explorer09 b4735d6925 test: echo 'set -v' before setting so in shell. 2017-06-04 16:15:23 -04:00
Will Estes 71b9c0cedc doc: tableopts rule portability mentioned in NEWS 2017-05-26 11:23:12 -04:00
Will Estes 2c0152a0c3 test: remove duplicate shell options line 2017-05-26 11:21:16 -04:00
Explorer09 1f3db3aeb3 test: use portable pattern substitution in tableopts.sh
Fixes: #222
2017-05-24 15:33:09 +08:00
Will Estes db4f5e0fe5 doc: document NetBSD build crash fix 2017-05-19 08:05:51 -04:00
Will Estes 2ae437ad54 build: remove automake check-news 2017-05-19 08:03:48 -04:00
Thomas Klausner 2b290d8ebd scanner: Use reallocarr() when available.
NetBSD had a crash during build. Since the provided substitute for
reallocarray() wasn't working, use NetBSD's reallocarr(). Let
configure choose that function whenever it is available. Use
reallocarray if available. Still fallback if neither is available.

Fixes #219
2017-05-19 07:29:15 -04:00
Will Estes 3a70bac04a doc: list line number directives in NEWS 2017-05-14 07:16:45 -04:00
Jeff Smith 2c7e34bb95 filter: Output correct #line value for current file.
A #line pre-processor directive specifies the line number and source
file of the following lines. If the source file _is_ the current file,
the line number should be that of the line following the directive. So
the specified line number should be the current line number plus 1.
2017-05-14 06:31:56 -04:00
Will Estes 596a221844 scanner: corrected typo 2017-05-13 17:24:55 -04:00
Will Estes 0be3198908 doc: noyyget/set_column options documented 2017-05-13 17:23:18 -04:00
Will Estes 5cadd124f8 scanner: finish support for noyy{get,set}_column.
Unattributed patch carried over from sourceforge bug tracker.
2017-05-13 15:15:45 -04:00
Will Estes 7284970311 build: .mailmap for cleaning up shortlog 2017-05-13 14:24:17 -04:00
Hans-Bernhard Broeker 2c3f463909 test: rename some files for non-case-sensitive filesystems.
-C*f and -C*F option-specific test files collide on case-insensitive
file systems, and cause tests to either not be run at all, or to
overwrite each other's files at build time.  So rename -C*F ones to
-C*_F.
2017-05-06 20:46:20 -04:00
Will Estes af72e9e222 build: 2.6.4 is previous version 2017-05-06 20:26:28 -04:00
Will Estes 385766c5cf build: ignore .sig files.
We generate gpg signatures in place for releases. Since these should
not be tracked in the flex repo itself, we tell git to ignore them.
2017-05-06 16:54:54 -04:00
Will Estes 5dfc45ef5a build: no longer ignore *.tar.bz2
Since we no longer generate *.tar.bz2 archives, we do not need to tell
git to ignore them.
2017-05-06 16:53:14 -04:00
Will Estes ab49343b08 gettext: pulled latest translations; recompiled against current sources 2017-05-06 16:34:36 -04:00
Will Estes 0cfad78b32 version 2.6.4
* NEWS: Record release date.
2017-05-06 16:34:35 -04:00
Will Estes 31cdc1f095 note previous version 2017-05-06 16:34:35 -04:00
Will Estes 3d843a0f8d doc: update NEWS for upcoming release 2017-05-06 16:34:35 -04:00
viktor.shepel 7889866f58 doc: Correct typo in C code sample in manual 2017-05-06 10:56:29 -04:00
Explorer09 e5c7ad3aec scanner: Mention %# comments are removed when building skel.c 2017-05-06 10:51:48 -04:00
Demi Obenour a1634aa8d3 Honor user definitions of yy_* macros
The user may have defined the yy_* macros themselves.  In that case,
don't clobber them.
2017-05-03 16:16:37 -04:00
Demi Obenour d564d45477 Don't leak macro definitions into header files
This allowed unnamespaced definitions to leak into header files,
breaking client code.

Fixes #142
2017-05-03 16:16:37 -04:00
Demi Obenour ba530cd52f scanner: Check for 0 bracecount when EOL ends quoted literal.
This can happen in the case of // comments (which Flex doesn't handle
specially).
2017-05-03 16:13:39 -04:00
Demi Obenour b1c2957b3f scanner: when bracelevel is negative, treat as zero.
This really should never happen, but this at least fixes the
breakage on Verilator.
2017-05-03 16:13:02 -04:00
Jeff Smith 8b746fa025 test: enable more silent building of tests.
When running 'make V=0 check', some compile and link steps are made
less verbose and some are not.  This cleans up most steps that are
not.

These have no effect if V=0 is not specified.
2017-05-03 14:27:42 -04:00
Demi Obenour 2f21edac99 build: Delete comments from skeleton file.
Since the comments in flex.skl are, by hypothesis, not needed in
skel.c, we remove them. THis reduces the size of the resulting
executable somewhat.
2017-05-03 13:24:09 -04:00
Explorer09 2592576239 build: do not generate lib/Makefile.in.
Files in lib/ are picked up and built using makefile directives in
src/Makefile.am. Remove the need to generate lib/Makefile.in and the
stub lib/Makefile.am.
2017-05-03 13:14:16 -04:00
Will Estes 9131b8426a gettext: revert listing generated .c files 2017-05-02 20:39:15 -04:00
Jeff Smith 88b8e2a9d5 FLEX_EXIT() is the preferred way to exit flex 2017-05-02 15:31:05 -04:00
Explorer09 47d6a45345 Fix myesc() 'sptr' conditionals
* Don't call isascii() here. It's deprecated in POSIX and not needed
  for myesc's case.
* The check of the character class and range here should match what's
  defined as {ESCSEQ} in scan.l, so for [[:xdigit:]] we use isxdigit();
  for [0-7] we check '0' <= c <= '7' (not isdigit(c) because isdigit is
  locale-dependant in standard's sense)
* Add missing length limit for "\x<hex>" (<hex> is at most 2 digits)
2017-05-02 15:14:25 -04:00
Explorer09 d4ab90f185 Obsolete htoui() and otoui(); use strtoul().
No sense to keep these two function when libc's strtoul() can do the
same job, but better.
2017-05-02 15:14:25 -04:00
Todd C. Miller 09697fb269 scanner: update yy_buf_size after yyrealloc() 2017-05-02 15:08:10 -04:00
Simon Sobisch c2ceb3e129 build: use lowest versions for gettext, automake. 2017-05-02 14:56:59 -04:00
Simon Sobisch 5b30b23fe9 gettext: more recent makevars; new script to update po files.
Previously, "make dist" and similar commands would cause the po files
to be updated, which is incorrect. The more recent version now used
should not do this.

Replaced Rules-getpo by extra script to manually update and rebuild all po files.
2017-05-02 14:56:59 -04:00
Simon Sobisch 3211921c23 gettext: list generated files instead of flex, bison sources in POTFILES.in.
Listing the flex and bison sources -- as the gettext manual suggests
-- causes warnings. Listing the generated C files for the lexer and
parser removes the warnings. Since both files contain line directives,
any translator who needs to refer back to those files should be able
to find the context in which strings are needed.
2017-05-02 14:56:38 -04:00
Simon Sobisch 4efcf28ee6 build: only touch ChangeLog if it does not exist 2017-05-02 14:43:49 -04:00
Simon Sobisch 634ef8a945 build: list earliest useable versions for automake 2017-05-02 14:43:49 -04:00
Simon Sobisch 0a9687d138 build: check for how to call libtoolize.
Previously, we would call libtoolize and if that failed, we would call
glibtoolize since some platforms have the libtoolize program under
that name.

Instead, we check to see if the environment variable LIBTOOLIZE is set
and use that if so. Otherwise, we try to find a program "libtoolize"
on the path and failing that glibtoolize. We alert the user if no
suitable program can be found.
2017-05-02 14:43:49 -04:00
Alastair Hughes 89f10ee36f build: support cross compiling.
Check for cross compiling. If cross compiling, build stage1flex using a
custom link command.
We also override LDADD since that adds the replacement implementations
that are cross compiled, and instead always use the replacement library
implementations.

We don't use BUILD_OBJEXT and BUILD_EXEEXT since it seems that automake
does not support these.

Fixes #78.
2017-02-23 14:07:56 -05:00
Explorer09 d1b195b671 build: Include <strings.h>; add strcasecmp() check to configure.
strings.h (not string.h) is the standard-defined include header for
strcasecmp(). Include <strings.h> for portability (even though glibc
exposes strcasecmp() declaration also in <string.h> by default).
2017-02-17 16:56:21 -05:00
Explorer09 dbb4e94dc7 build: Let configure error if missing required functions, headers..
`configure` will now error if a required header or function is not
found on the system.

Also add comments on optional functions checks.

Add sys/stats.h and sys/wait.h to list of required headers in
configure.

This fixes issue #180.
2017-02-17 16:55:33 -05:00
Explorer09 c7a545ae09 scanner: compute powers of two faster.
Replace the naive "for" loop in determining power of two with a clever
bitwise solution. This code is around the Internet already and is in
Public Domain.
2017-02-16 13:26:21 -05:00
Explorer09 122e58965a test: skip pthread test when needed files missing.
"Unlisting" the pthread test when libpthread is not available is never
a good idea. Should let it compile into a stub program that returns
the "skip" status.

configure.ac and tests/Makefile.am are edited so that pthread test can
be built anyway, but only works (not as the stub) when both pthread.h
and libpthread are detected on the system.

Also fix a small typo in tests/pthread.l comments.
2017-02-16 09:33:35 -05:00
Will Estes 2e820b6015 build: mv scan.c when building dist.
Revert change to copy scan.c when building the distribution
archive. Move it instead. This satisfies automake's notions of what
should be clean and ensures that the distribution archive contains a
just-built copy of scan.c.

Fixes #186
2017-02-16 09:27:22 -05:00
Will Estes 44f10b366f build: don't assume distdir/scan.c is writeable 2017-02-06 12:04:03 -05:00
Explorer09 a7adbf20a9 build: Add dist-hook to force remake scan.c.
This will ensure the flex scanner included in release tarball being
generated by exactly the flex version to be released.

Here's one catch after this change: You may not run "make dist" or
"make distdir" if you configure the flex source to be cross-compiled.
2017-02-06 11:48:05 -05:00
Explorer09 dae5c22f87 build: respect '--localedir' from configure.
Makefile shouldn't overwrite the 'localedir' variable, because that's
what '--localedir' option in 'configure' is for.
2017-02-06 11:45:09 -05:00
Explorer09 dec3a380e5 build: Remove "-I$(top_srcdir)/intl" from CPPFLAGS.
Revert commit e02c3d27ee

("include the intl/ subdirectory when searching for include files")

Flex doesn't come with libintl source code, so inclusion of
$(top_srcdir)/intl subdirectory during compiling is unnecessary.

This flag seems to be left after "remove intl from dist"
(commit 8f45da06ad) without someone
cleaning this up.

Users who need to build with gettext functionality from libintl would
use the '--with-libintl-prefix' configure option.
2017-02-06 11:44:13 -05:00
Explorer09 e2d569053a scanner: fix regcomp's error reporting, double malloc.
Fix unneeded double malloc - let regerror(). Write its message after
our "regcomp for (regex) failed: " string.

Also, errbuf cannot be free()'d because of flexfatal containing a
longjmp.
2017-02-06 11:37:18 -05:00
Explorer09 3c0ccc4520 test: Skip bison tests if bison is not available 2017-01-25 10:33:06 -05:00
Explorer09 546851ba35 build: remove repeated bison detection from configure.
AC_PROG_YACC already detects the bison program. We can just use it,
and make notice if [ $YACC != 'bison -y' ]

Remove unused AC_SUBST([BISON], ...).

Add AM_CONDITIONAL([HAVE_BISON], ...) so that we can skip bison tests
in testsuite when bison is absent.

We don't make any attempt to detect other yacc implementations since
flex is developed with bison. While it would be possible, the need
isn't there right now. It would be possible to add a --with-parser
option that defaulted to bison if such a need cropped up.
2017-01-25 10:29:26 -05:00
Explorer09 a2fccbe579 build: fix Makefile parse.h dependency clauses.
The current clauses stating "main.c: parse.h" and "yylex.c: parse.h" do
not work as expected. Make did not try to build parse.h upon building
flex-main.o as it would think main.c exist already and ignore the
clause. Fix this by explicitly stating that the .o files depend on
parse.h instead.

This dependency bug only happens if user builds flex from a
checked-out repository.
2017-01-24 12:07:06 -05:00
Explorer09 e8cb34ed48 test: Remake *_scanner.c if *_scanner.h is missing.
If a ${foo}_scanner.c exists but the respective ${foo}_scanner.h is
missing, then 'make' can halt. Fix this by deleting the
${foo}_scanner.c file and then remake it. This rule is the same as the
automake-generated rule for .c files that require LEX or YACC (except
automake will use ylwrap).
2017-01-24 11:56:09 -05:00
Explorer09 afc687f586 test: remove BUILT_SOURCES; add missing dependencies.
Without BUILT_SOURCES in Makefile, no test sources in tests/ will be
built when using the default "make all" target. This is desireable for
people who are just building flex but who do not want to run, and
therefore, build any part of the test suite.

Also fix missing sources dependencies:

    bison_nr_scanner.$(OBJEXT): bison_nr_parser.h
    bison_yylloc_scanner.$(OBJEXT): bison_yylloc_parser.h
    bison_yylval_scanner.$(OBJEXT): bison_yylval_parser.h
2017-01-24 11:53:46 -05:00
Explorer09 9c54eb6e30 build: detect overflow for [re]allocate_array.
Use reallocarray() when we have it (i.e. in OpenBSD system). When we
don't, use equivalent overflow detection for our allocate_array and
reallocate_array functions.

Remove lib/reallocarray.c from our LIBOBJS as we no longer need it.

Provide a fallback SIZE_MAX macro definition in flexint.h (not
preprocessor friendly, but enough for our reallocate_array use case).
2017-01-24 07:36:50 -05:00
Will Estes 7e4d538724 doc: v2.6.4 2017-01-23 14:25:11 -05:00
Thomas Klausner 0a89eef5dc build: more BSD make and vpath build fixes.
BSD make doesn't like $< with more than one source
specified. Additionally, make sure to specify srcdir when referring to
source files since vpath builds depend on this.
2017-01-23 13:48:15 -05:00
Thomas Klausner b61b0fe906 build: Fix skel.c generation with BSD make 2017-01-23 13:45:34 -05:00
Christos Zoulas 078b46c69d Add more defines in the non-reentrant part.
Fix the reentrant part; don't "#define yyfoo yyfoo" because it breaks
code that does #ifndef yywrap ..
2017-01-23 13:39:49 -05:00
Christos Zoulas 726c8dab23 scanner: Add yyparse prototype 2017-01-23 13:38:58 -05:00
Thomas Klausner 6bf98d9aea scanner: move comment for consistency 2017-01-23 13:35:26 -05:00
Christos Zoulas 1a9468797d scanner: Use array instead of pointer 2017-01-23 13:32:40 -05:00
Christos Zoulas 43a5bebd7d scanner: manage path to m4 better.
Avoid alloca() for SSP; it is better anyway; since we don't need to
strdup the path.
2017-01-23 12:31:21 -05:00
Christos Zoulas fb175a49c3 scanner: Avoid creating unused label 2017-01-23 12:06:53 -05:00
Christos Zoulas f01ab4fe02 Cast argument to avoid arithmetic on void *. 2017-01-23 11:42:14 -05:00
Christos Zoulas 7ca76038df scanner: Use strncpy 2017-01-23 11:38:36 -05:00
Christos Zoulas f5d87f1a26 scanner: Use prefix when defining yywrap to avoid redefinition.
Fixes regression introduced in v2.6.3.
2017-01-23 11:35:19 -05:00
Christos Zoulas 6f47a5232c scanner: Include stdarg.h for va_list 2017-01-23 11:27:51 -05:00
Christos Zoulas d0d0573900 scanner: Rename warn to lwarn.
This avoids a naming conflict in NetBSD's  libc.
2017-01-23 11:01:54 -05:00
Explorer09 da071cfb7a test: document automake convention for skipped exit status. 2017-01-20 11:06:06 -05:00
Explorer09 dd7c6d4a0f test: let testwrapper scripts be run by ${SHELL}.
This allows user to use a different shell if /bin/sh has problems.
The use of $SHELL (variable) to run scripts is already an Automake
convention. All shell scripts in build-aux are run by $SHELL.
2017-01-17 21:10:42 -05:00
Explorer09 bcf7a07369 test: Remove test scripts bashisms.
They now all work under a POSIX compliant sh. Specifically, 'dash' can
now be used for running "make check" tests.

Note that none of these scripts has ever been using a pipe, so
`set -o pipefail` is unnecessary and removed.
2017-01-17 21:10:16 -05:00
Explorer09 8c8691c3fd test: exit on '-1' test non-zero status.
If a '-1' test program returns a non-zero status, don't go further and
compare it's (numeric) output values. This allows a '-1' test to
indicate a "skip" status or an otherwise error. (Currently no such '-1'
test would skip like this, though.)

Shell syntax note: `set -e` will not exit with the syntax like this
`test $(false) = $(false);`. The exit statuses of `false` in the
example will be ignored instead. But putting the output in a variable,
such as `VAR=$(false)`, DOES exit.
2017-01-17 21:08:42 -05:00
Explorer09 bb92951c02 build: Fix 'make indent' target
This 'make indent' target has not been working since the directories
reorganization in flex 2.6.0. Now make it work again.

Note that the current indent profile breaks many styles of existing
code. The indent target should not be used until the .indent.pro
options are reviewed for desireability.
2017-01-12 18:02:24 -05:00
Explorer09 8db5267af4 build: Simplify indent program detection 2017-01-12 18:01:57 -05:00
Tobias Klauser de0c5e91df filter: Don't emit #line if %option noline set
One place emitting a #line directive to the generated header was
missed in commit 647a92b9f4 when resolving #55. Fix it to respect
gen_line_dirs as well.
2017-01-12 17:44:00 -05:00
Will Estes 84a9a4b9fc translation: refresh po files from translation project 2017-01-12 13:22:02 -05:00
Harald van Dijk e666829949 c++: Fix yyrestart(NULL) SEGV.
Binding a reference to a dereferenced null pointer is invalid and
compilers optimise away the &file == 0 check. We need a real stream.

yyin is available already, and yyrestart(NULL) is only supported when
yyin will not be used, so there is no harm in just passing in that.
Since we now always have a valid stream, we can skip the null check
too.

Fixes #98.
2017-01-11 21:04:28 -05:00
luistung 7f263e3520 scanner: join symbol list.
Removed a newline that caused a problem building the scanner in some
circumstances. Specifically:

'bad character' error  when executing

/bin/sh ../build-aux/ylwrap scan.l lex.yy.c scan.c -- flex
2017-01-11 09:09:15 -05:00
Will Estes a58086a269 scanner: remove void cast before fprintf 2017-01-11 09:05:18 -05:00
Will Estes 581ef6d17f doc: update NEWS for 2.6.3 release 2016-12-30 12:48:24 -05:00
Explorer09 adddfba7ab build: New configure option '--disable-bootstrap'.
If configure is run with '--disable-bootstrap', then stage1flex won't
be built and stage1scan.c will be generated by sed'ing scan.c.

This option is intended to workaround bootstrap bugs rather than to
fix the bootstrapping issues which are proving subtler and harder to
fix than anyone would like.
2016-12-29 17:26:07 -05:00
Explorer09 6964073c59 build: "make clean" deletes stage1scan.c, stage1flex 2016-12-29 17:25:19 -05:00
Explorer09 935478c3fe build: allow building libfl even with --disable-libfl.
For various reasons, we may wish to build libfl explicitly even when
configure has been run with the --disable-libfl option. This is
possible, now, via 'make -C src libfl.la'.
2016-12-29 17:19:53 -05:00
Alexis La Goutte a33e6fd5b4 scanner: remove trailing whitespace in skeleton 2016-12-29 15:11:11 -05:00
Demi Obenour 8d4aa5ccaf scanner: Disallow, overquote '[' and ']' in prefix 2016-12-29 14:18:15 -05:00
Samuel Thibault 7975c43384 scanner: allocate correct buffer size for m4 path.
Flex did not check the length of the m4 path which could lead to a
buffer overflow in some cases. Additionally, not all platforms believe
in PATH_MAX, so stop relying on it.

Fixes #138
2016-12-29 08:47:10 -05:00
Will Estes 6bea32e937 doc: note no more libcompat in NEWS 2016-11-24 18:50:21 -05:00
Will Estes 223f297825 build: explain empty lib/Makefile.am 2016-11-24 18:50:21 -05:00
Explorer09 44fa758931 build: warn about cross compiling with *alloc 2016-11-24 18:48:28 -05:00
Explorer09 713f5a0cb4 build: Link $(LIBOBJS) from src/ dir, remove libcompat.la.
The libcompat.la library was small and less friendly to bootstrapping
and cross compilation. Now, we will simply link individual object
files as needed, which is simpler.
2016-11-24 18:45:07 -05:00
Explorer09 11c445cde9 build: Let stage1flex respect LFLAGS 2016-11-15 19:26:08 -05:00
Will Estes 99612781d9 doc: describe --disable-libfl in NEWS 2016-11-14 14:26:48 -05:00
Explorer09 5d71e9ffb9 build: Add --disable-libfl configure option.
Disabling libfl is useful when building flex for a cross-toolchain.

Fixes: GH-99
2016-11-14 14:23:27 -05:00
Demi Obenour 347652c32b fix backwards incompatible changes in 2.6.2.
This patch addscompatibility `#defines` for all macros affected by
`%prefix`.

Fixes #113.
2016-11-12 12:00:12 -05:00
Will Estes d374b87e68 git: ignore quote_in_comment artifacts 2016-11-08 12:53:21 -05:00
Demi Obenour c8ad3d682f Fixes a major bug in Flex's own lexing of literals.
My changes caused Flex to mishandle string and character literals in
line comments.  This commit fixes them.

Fixes #113.
2016-11-08 12:49:44 -05:00
Thomas Klausner 0af671a275 Fix unportable test(1) operator.
"==" is only supported by bash, "=" is the standard comparison
operator.
2016-11-06 22:32:43 +01:00
Demi Obenour 14846e5e1a Add more escaping tests 2016-11-02 13:22:02 -04:00
Demi Obenour e1038db19a Fix another escaping bug
in non-indented verbatim section 2 code.

I also did some reformatting.
2016-11-01 20:20:46 -04:00
Alastair Hughes 75f4305eed build: fix false negatives for help2man and texi2dvi
HELP2MAN and TEXI2DVI (or the corresponding ac_prog variables) will
never be zero length as they fall back to the missing script; check for
the fall back and warn on that instead of always warning.
2016-10-29 09:11:20 -04:00
Explorer09 c503eaf061 doc: Don't delete flex.1 during "make distclean".
flex.1 is pre-generated in release tarball. If we delete it, the next
"configure and make" on the source directory will then require help2man
unnecessarily.
2016-10-28 19:48:11 -04:00
Alastair Hughes 92311a56b3 Only regenerate the man page when required.
Make the flex binary an order-only prerequisite, and add back the
prerequisites from before 7cfb440. This prevents rebuilding the man page
whenever the flex binary is rebuilt, which causes problems if help2man
is not installed and will never work when cross compiling.

Fixes #108.
2016-10-27 17:55:46 -04:00
Will Estes 2bf2ad6d68 build: no longer build PIC version of libfl.
The PIC version of libfl was not being built correctly. From the lack
of bug reports around this problem, we conclude that the PIC version
of libfl is not used and so we drop it from the build build targets
for flex.
2016-10-26 14:09:36 -04:00
Explorer09 023cd4f754 doc: README.md formatting fixes
* Wrap everything in the raw document in 72 char per line limit.
* Proper casing for terms "Git" and "GitHub" (don't try to look lazy).
* Add unordered list marks when needed.
* Say `configure && make && make install` and quoted for fixed-width
  font.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2016-10-25 10:20:35 -04:00
Will Estes 31cc18ebd0 build: version 2.6.3 begins 2016-10-25 09:53:50 -04:00
Will Estes 35d2fdfad1 doc: mark 2.6.2 release date 2016-10-24 18:29:36 -04:00
Will Estes 2ecf674239 build: switch xz to lzip 2016-10-24 18:26:22 -04:00
Demi Obenour b02489f588 Fix M4 quotation in section 2 prologue and refactor duplicated code 2016-10-23 14:04:42 -04:00
Alex Kennedy 802cd0a6ed Update flex.texi: Removed repedative wording
"Flex used to" was written twice at the beginning of Chapter 9, paragraph 2.
2016-10-21 20:42:36 -07:00
479 changed files with 69329 additions and 30752 deletions
+25
View File
@@ -0,0 +1,25 @@
*.orig
*.rej
*.sig
*.tar.gz
*.tar.lz
*~
.deps
.libs
ABOUT-NLS
ChangeLog
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache
autoscan.log
build-aux/
config.log
config.status
configure
configure.scan
flex-*/
libtool
m4/
stamp-*
Vendored
+15
View File
@@ -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
+50
View File
@@ -0,0 +1,50 @@
Aaron Stone <sodabrew@users.sourceforge.net>
Akim Demaille <akim@lrde.epita.fr>
Alastair Hughes <hobbitalastair@gmail.com>
Alex Kennedy <alexzanderkennedy@gmail.com>
Alexis La Goutte <alexis.lagoutte@gmail.com>
Bastian Köcher <git@kchr.de>
Christoph Junghans <ottxor@gentoo.org>
Christos Zoulas <christos@zoulas.com>
Cyril Brulebois <kibi@debian.org>
Demi Obenour <demiobenour@gmail.com>
Dennis Clarke <dclarke@blastwave.org>
Egor Pugin <egor.pugin@gmail.com>
Elias Pipping <pipping@users.sourceforge.net>
Explorer09 <explorer09@gmail.com>
Hans-Bernhard Broeker <HBBroeker@T-Online.de>
Harald van Dijk <harald@gigawatt.nl>
Hugh Sasse <hgs@dmu.ac.uk>
Jaska Uimonen <jaska.uimonen@helsinki.fi>
Jeff Smith <whydoubt@gmail.com>
John Millaway <john43@users.sourceforge.net>
Manoj Srivastava <srivasta@golden-gryphon.com>
Mariusz Pluciński <mplucinski@mplucinski.com>
Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Michael McConville <mmcconville@mykolab.com> <mmcco@mykolab.com>
Michael Reed <m.reed@mykolab.com>
Michael van Elst <mlelstv@NetBSD.org>
Mightyjo <mightyjo@gmail.com>
Mike Frysinger <vapier@gentoo.org>
OBATA Akio <obache@NetBSD.org>
Robert Larice <Robert.Larice@t-online.de> rlar <rlar>
Robert Larice <Robert.Larice@t-online.de> Robert.Larice Robert Larice <Robert.Larice@t-online.de>
Robert Minsk <rminsk@users.sourceforge.net>
Samuel Thibault <samuel.thibault@ens-lyon.org>
Sean McBride <sean@rogue-research.com>
Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com> <xindigo@gmail.com>
Simon Sobisch <simonsobisch@web.de>
Stefan Reinauer <stefan.reinauer@coreboot.org>
Thomas Klausner <wiz@NetBSD.org>
Till Varoquaux <till.varoquaux@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Todd C. Miller <Todd.Miller@courtesan.com>
Translation Project <coordinator@translationproject.org> <coordinators@translationproject.org>
Translation Project <coordinator@translationproject.org> <translation@translationproject.org>
Vern Paxson <vern@ee.lbl.gov>
Will Estes <westes575@gmail.com> <wlestes@users.sourceforge.net>
Yuri <yuri@tsoft.com>
luistung <dongliang1986@gmail.com>
lukeallardyce <lukeallardyce@users.sourceforge.net>
nomis52 <nomis52@users.sourceforge.net>
viktor.shepel <shepelvictor@bigmir.net>
+1
View File
@@ -0,0 +1 @@
2.6.4
+24
View File
@@ -0,0 +1,24 @@
language: c
compiler:
- gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- autoconf
- bison
- gcc-6
- help2man
- lzip
- texinfo
- texlive
before_script:
- ./.travis/install-gettext.sh
- ./.travis/install-automake.sh
- export PATH=$HOME/bin:$PATH
script: ./autogen.sh && ./configure && make && make check && make distcheck
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash -ex
wget -nv https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz
# Verify tarball against hard-coded hashes. GPG signatures require an external
# keyserver which might be offline, which is undesirable for build server use.
# It's equally secure to just hard-code hashes, provided they're trusted (i.e.
# you verify a hash against a GPG signature once).
echo 'd3cd5fc9bbea9f977b51799180cde5d253dcba96 *automake-1.15.1.tar.gz'|
sha1sum -c || :
printf '%s *automake-1.15.1.tar.gz\n' \
f0d4717ebe2c76cec5d487de090f6e1c0f784b0d382fd964ffa846287e2a364a\
52531a26ab98b7033ac04ed302a247b3b114299def54819a03439bfc962ff61b|
sha512sum -c || :
tar xf automake-1.15.1.tar.gz
cd automake-1.15.1
# Don't flood Travis CI build log with dependency packages unless error occurs.
./configure --quiet --prefix="$HOME" ||
{ s=$? && cat config.log && (exit $s); }
make -s V=0 >/dev/null 2>&1 || make -s V=1
make -s install >make_install.log 2>&1 ||
{ s=$? && cat make_install.log && (exit $s); }
rm make_install.log || :
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash -ex
wget -nv https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.lz
# Verify tarball against hard-coded hashes. GPG signatures require an external
# keyserver which might be offline, which is undesirable for build server use.
# It's equally secure to just hard-code hashes, provided they're trusted (i.e.
# you verify a hash against a GPG signature once).
echo '404e072c455f79be4a2458863c19fb55a217771e *gettext-0.19.8.1.tar.lz'|
sha1sum -c || :
printf '%s *gettext-0.19.8.1.tar.lz\n' \
27c7a15be1ffd30a0182e264d0bf896850a295160872e1b1b9d1e9a15bc486cd\
93465c131f948206fa0bbe2e3eacfc8489dd0cfc5ea5dcf05eff3829e27fc60f|
sha512sum -c || :
tar xf gettext-0.19.8.1.tar.lz
cd gettext-0.19.8.1
# Don't flood Travis CI build log with dependency packages unless error occurs.
# libacl is not used in this Travis build system.
./configure --quiet --prefix="$HOME" --disable-acl ||
{ s=$? && cat config.log && (exit $s); }
make -s V=0 >/dev/null 2>&1 || make -s V=1
make -s install >make_install.log 2>&1 ||
{ s=$? && cat make_install.log && (exit $s); }
rm make_install.log || :
+16
View File
@@ -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.
+5
View File
@@ -0,0 +1,5 @@
# Contributor Code of Conduct
This project adheres to No Code of Conduct. We are all adults. We accept anyone's contributions. Nothing else matters.
For more information please visit the [No Code of Conduct](https://github.com/domgetter/NCoC) homepage.
+42
View File
@@ -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.
+93
View File
@@ -0,0 +1,93 @@
# 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.
ACLOCAL_AMFLAGS = -I m4
dist_doc_DATA = \
AUTHORS \
COPYING \
NEWS \
ONEWS \
README.md
EXTRA_DIST = \
.indent.pro
dist_noinst_SCRIPTS = \
autogen.sh \
po/update_linguas.sh
SUBDIRS = \
src \
doc \
examples \
po \
tests \
tools
# Convenience targets to build libfl only
# These are actually wrappers around automake- and libtool-generated targets
libfl:
cd src && $(MAKE) $(AM_MAKEFLAGS) libfl.la libfl.pc
install-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la \
pkgconfig_DATA=libfl.pc install-libLTLIBRARIES install-pkgconfigDATA
uninstall-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) \
lib_LTLIBRARIES=libfl.la pkgconfig_DATA=libfl.pc \
uninstall-libLTLIBRARIES uninstall-pkgconfigDATA
# libfl.pc is cleaned via 'distclean' target
clean-libfl:
cd src && \
$(MAKE) $(AM_MAKEFLAGS) lib_LTLIBRARIES=libfl.la clean-libLTLIBRARIES \
clean-libtool
# 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
indent:
cd src && $(MAKE) $(AM_MAKEFLAGS) indent
install-exec-hook:
cd $(DESTDIR)$(bindir) && \
$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
.PHONY: libfl install-libfl uninstall-libfl clean-libfl \
ChangeLog indent
+800
View File
@@ -0,0 +1,800 @@
flex NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
** build
*** Flex now includes its own <config.h> header before including
system headers so that any system specific features detected by
configure are taken into account during compilation of flex
itself.
*** The flex build system now includes Makefile targets at the top
level to allow just building and installing libfl.
*** The flex distribution now includes a file, src/libfl.pc, to allow
using pkgconfig to find out what flags to use when building
against libfl from flex.
*** Various edge cases, mostly involving out-of-tree builds have been
accounted for in the autotools build system.
*** A crash during building on NetBSD has been fixed.
*** Flex is now automatically built by travis-ci. That should increase
the visibility of bugs and help prevent regressions.
** documentation
*** new bg, pt, uk translations from the translation project
** scanner
*** Some memory leaks have been fixed.
*** A long standing bug that effected expressions of the form c{i,j}
where 'c' is a character and {i,j} describes the number of times
to match against 'c' when case sensitivity was turned on has been
fixed.
*** New option: --backup-file allows setting the name of the file
written containing backing up information. Useful if you need
backing up information from multiple scanners in the same
directory.
*** flex emits correct line number directives when line numbers refer
to the file containing the line number directives.
*** The options {no,}yy{get,set}_column are now supported.
** test
*** Generating the various tableoptions make rules is now more portable.
*** Tests of the options -C*f and -C*F will now run correctly on
filesystems that are not case sensitive.
* Noteworthy changes in release 2.6.4 (2017-05-06) [stable]
** build
*** The indent target now knows about flex's new (as of 2.6.0)
layout. The indent rules it would apply are not correct and do
need to be fixed.
*** The files included in the flex distribution are now built by the
version of flex that is included in the distribution.
*** The configure script has a better idea of which headers are
required to build flex. It will also error when missing functions
are detected.
*** We have lowered the versions of automake and gettext that
configure.ac lists as required for building flex. In autogen.sh,
we now check for how to call libtoolize and use what we find in
the rest of the script.
*** Since files in lib/ are picked up as needed by src/, we no longer
generate a Makefile for that directory.
*** Flex can be cross compiled.
** documentation
*** Some typos were removed from the manual.
** scanner
*** Some minor performance enhancements.
*** We honor user defined yy_* macros again. We are also more careful
to not leak macro definitions into header files.
*** A number of portability fixes were introduced so building flex is
more reliable on more platforms. Additionally, outdated function
calls were removed.
*** When building the flex executable itself, %# comments from
flex.skl are removed when generating the C source code array. This
reduces the size of flex.
** test suite
*** All scripts in the test suite are now run by $(SHELL) and the
needed portability fixes have been included.
*** Test suite dependencies are handled much better. This only matters
if you are actively developing flex or its test suite.
*** Tests that depend on platform dependent features now properly skip
when those platforms are not present.
*** When running "make check", you can now pas V=0 to silence more of
the build. This is useful when you're less connncerned about the
details of building and linking the test programs themselves.
* Noteworthy changes in release 2.6.3 (2016-12-30) [stable]
** scanner
*** several bug fixes resolved problems introduced in recent flex
versions regarding processing of comments, literals and various
quoting scenarios.
*** If the path to m4 was sufficiently long, a buffer overflow could
occur. This has been resolved. The fix also removes dependence on
the constant PATH_MAX.
** build
*** A new configure option --disable-bootstrap changes the behavior of
the build system when building flex. The default
"--enable-bootstrap" behavior is to build flex, then to use that
flex to build flex again. With --disable-bootstrap, the scanner is
simply built by sedding the scanner source. This is friendlier to
cross compilation.
*** The compatibility functions in lib/ are no longer built as a
library. Instead, they are built as $(LIBOBJ) objects. This is
simpler and friendlier to cross compilation.
*** It is now possible to build flex without building the accompanying
libfl. This is friendlier to cross compilation. See the
--disable-libfl option to configure. Resolves #99.
*** the PIC version of libfl was not correctly built. It is no longer
included in the build/installation targets of flex since it was
unused.
*** the distributed man page is only rebuilt when the relevant source
files change or when the binary doesn't exist. In particular, this
is friendlier to cross compilation. Resolves #108
** test
*** the shell scripts in the test suite are more portable across different shell implementations.
* version 2.6.2 released 2016-10-24
** flex internals
*** a segfalt involving yyrestart(NULL) has been fixed
*** flex should now handle quoting when mixed with m4 processing correctly
*** flex handles `[[' and `]]' correctly
*** flex no longer generates non-ANSI code
*** more compilation warnings were squashed in generated scanners
*** prevented a buffer overflow that could occur when input buffers were the exact wrong size
** test suite
*** input filenames on MSWindows are now calculated correctly
*** general code cleanups in a number of tests now make the test suite compile much more cleanly
** build system
*** the xz archive has been replaced with an lzip archive
*** a new option to configure --enable-warnings to encapsulate passing
of warning-related flags which is useful in testing flex
*** make indent now works for out of source builds
*** Portability warnings when generating Makefile.in files are now suppressed; they were just noise and the use of GNU extensions in Makefile.{am,in,} was intentional and well known.
** bugs
*** resolved gh#67
** new sv translation from the translation project
* version 2.6.1 released 2016-03-01
** flex resources
*** The flex project is now hosted at github. Consider this a "period of transition". In particular, you should start at https://github.com/westes/flex for the flex codebase, issue tracking and pull requests.
*** New releases of flex are to be found at https://github.com/westes/flex/releases.
** flex internals
*** Flex now uses more modern and more standard names for variable types. There's more work to be done on that front yet, though.
*** A number of compiler warnings have been remedied.
*** Line directives should now work as expected and be absent when that is expected.
** test suite
*** When running the test suite, c++ files are compiled with the c++ header inside the flex distribution, rather than relying on the build system's flex header , which might not be installed yet or which might be out of date with respect to what flex tests expect.
*** Some portability fixes in the test suite such as opening files for reading in binary mode
** Building flex
*** The file src/scan.c asdistributed with flex source is now built with the current version of flex. Occasionally this had to be done manually to pick up new flex features. It's now just a part of flex's build system.
*** The pdf version of the manual is no longer distributed with flex, although if you have the texinfo package installed, you can still build it.
*** lots of general build system cleanup
*** the build system tries a bit harder to find libtoolize and texi2dvi.
*** When help2man and texi2dvi are missing, the error messages are now much more helpful.
** bug fixes
*** resolved github issues #53, #54, #55, #61.
*** Resolved sf bugs #128, #129, #155, #160, #184, #187, #195.
* version 2.6.0 released 2015-11-17
** User Visible Changes
*** C++ scanners now use references instead of pointers. See the manual for details.
*** A number of compiler warnings were addressed, so flex generated scanners should be quieter under compiler warning scenarios.
*** Allow error reporting routines to accept varying number of arguments
*** Removed deprecated 'register' storage class specifier
*** Changeed output formats from octal to hexadecimal
*** check limits before using array index cclp; resolves sf-166
*** Suppress clang warning about empty @param paragraph; resolves sf#158
*** Fixed malloc/realloc replacement, resolves sf bug#151.
*** Adjusted buffer sizes on ia64.
*** various documentation and code clean up fixes: resolves sf bugs #167, #168, among other patches.
** Flex Internals
*** flex is now organized into subdirectories. This keeps the tree neater at the top level and puts like things near each other and unlike things away from each other.
*** The test suite has been reorganized and is now run with the parallel test suite harness from automake.
*** Cleaned up the automake parts of the build system to better reflect what automake does on its own. Also added a call to libtoolize in autogen.sh because autoreconf gets confused without a prior run of libtoolize.
*** po/Makefile now includes a rule to fetch the latest translations from the translation project. "make -f po/Makefile getpo" from the top level of the flex tree will fetch the files.
*** New da translation from the translation project
* 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.
See the file COPYING for copying conditions.
Local Variables:
mode: text
mode: outline-minor
end:
+1233
View File
File diff suppressed because it is too large Load Diff
+114
View File
@@ -0,0 +1,114 @@
[![Build Status](https://travis-ci.org/westes/flex.svg?branch=master)](https://travis-ci.org/westes/flex)
This is flex, the fast lexical analyzer generator.
flex is a tool for generating scanners: programs which recognize
lexical patterns in text.
The flex codebase is kept in
[Git on GitHub.](https://github.com/westes/flex) Source releases of flex with some intermediate files already built can be found on [the github releases page.](https://github.com/westes/flex/releases)
Use GitHub's [issues](https://github.com/westes/flex/issues) and
[pull request](https://github.com/westes/flex) features to file bugs
and submit patches.
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 or search in the
archive at: https://sourceforge.net/p/flex/mailman/
Note: Posting is only allowed from addresses that are subscribed to
the lists.
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.
* 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; for handling the build system
* automake; for Makefile generation
* gettext; for i18n support
* help2man; to generate the flex man page
* tar, gzip, lzip, etc.; for packaging of the source distribution
* GNU texinfo; to build and test the flex manual. Note that if you want
to build the dvi/ps/pdf versions of the documentation you will need
texi2dvi and related programs, along with a sufficiently powerful
implementation of TeX to process them. See your operating system
documentation for how to achieve this. The printable versions of the
manual are not built unless specifically requested, but the targets
are included by automake.
* GNU indent; for indenting the flex source the way we want it done
In cases where the versions of the above tools matter, the file
configure.ac will specify the minimum required versions.
Once you have all the necessary tools installed, life becomes
simple. To prepare the flex tree for building, run the script:
```bash
./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 routine:
```bash
configure && make && make install
```
---
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.
+53
View File
@@ -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.
Executable
+51
View File
@@ -0,0 +1,51 @@
#!/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.
# use LIBTOOLIZE, if set
LIBTOOLIZE_ORIG="$LIBTOOLIZE";
if test "x$LIBTOOLIZE" = "x"; then LIBTOOLIZE=libtoolize; fi
# test libtoolize
$LIBTOOLIZE --version 2>/dev/null
if test "$?" -ne 0; then
LIBTOOLIZE=glibtoolize
$LIBTOOLIZE --version 2>/dev/null
if test "$?" -ne 0; then
echo "error: libtoolize not working, re-run with LIBTOOLIZE=/path/to/libtoolize"
echo " LIBTOOLIZE is currently \"$LIBTOOLIZE_ORIG\""
exit 1
fi
fi
#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.)
if ! test -f ChangeLog; then
touch ChangeLog
fi
"$LIBTOOLIZE" --install --force
autoreconf --install --force
+188
View File
@@ -0,0 +1,188 @@
# -*- 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.4],[flex-help@lists.sourceforge.net],[flex])
AC_PREREQ([2.60])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
AC_USE_SYSTEM_EXTENSIONS
LT_INIT
AM_INIT_AUTOMAKE([1.15 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_LIBOBJ_DIR([lib])
AC_CONFIG_MACRO_DIR([m4])
SHARED_VERSION_INFO="2:0:0"
AC_SUBST(SHARED_VERSION_INFO)
# checks for programs
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.7])
AC_PROG_YACC
AS_IF([test "$YACC" != 'bison -y'], [
YACC="\${top_srcdir}/build-aux/missing bison -y"
AC_MSG_NOTICE(no bison program found: only required for maintainers)
])
AM_CONDITIONAL([HAVE_BISON], [test "$YACC" = 'bison -y'])
AM_PROG_LEX
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_INSTALL
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
# allow passing a variable `WARNINGFLAGS',
# either when invoking `configure', or when invoking `make'
# default to something useful if GCC was detected
AC_ARG_ENABLE([warnings],
[AS_HELP_STRING([--enable-warnings],
[enable a bunch of compiler warning flags (defaults to GCC warning flags).])],
[AS_IF([test "x$GCC" = xyes],
[ : ${WARNINGFLAGS="-Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"} ])])
AC_SUBST([WARNINGFLAGS])
AC_ARG_ENABLE([libfl],
[AS_HELP_STRING([--disable-libfl],
[do not build -lfl runtime support library])],
[], [enable_libfl=yes])
AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
# --disable-bootstrap is intended only to workaround problems with bootstrap
# (e.g. when cross-compiling flex or when bootstrapping has bugs).
# Ideally we should be able to bootstrap even when cross-compiling.
AC_ARG_ENABLE([bootstrap],
[AS_HELP_STRING([--disable-bootstrap],
[don't perform a bootstrap when building flex])],
[], [enable_bootstrap=yes])
AM_CONDITIONAL([ENABLE_BOOTSTRAP], [test "x$enable_bootstrap" = xyes])
AM_CONDITIONAL([CROSS], [test "x$cross_compiling" = xyes])
AC_PATH_PROG([HELP2MAN], help2man, [\${top_srcdir}/build-aux/missing help2man])
AS_IF([test "$HELP2MAN" = "\${top_srcdir}/build-aux/missing help2man"],
AC_MSG_WARN(help2man: program not found: building man page will not work)
)
AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi])
AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],
AC_MSG_WARN(texi2dvi: program not found: building pdf version of manual will not work)
)
# 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, [\${top_srcdir}/build-aux/missing indent])
AC_MSG_CHECKING(if $INDENT is GNU indent)
AS_IF([$INDENT --version 2>/dev/null | head -n 1 | grep "GNU indent" >/dev/null],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_WARN($INDENT does not appear to be GNU indent; 'make indent' may not function properly)
])
# checks for headers
AC_CHECK_HEADERS([regex.h strings.h sys/stat.h sys/wait.h unistd.h], [],
[AC_MSG_ERROR(required header not found on your system)])
AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.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.
LIBPTHREAD=''
AC_CHECK_LIB(pthread, pthread_mutex_lock,
[AC_CHECK_HEADERS([pthread.h], [LIBPTHREAD=-lpthread],
[AC_MSG_WARN([pthread tests will be skipped])])],
[AC_MSG_WARN([pthread tests will be skipped])])
AC_SUBST([LIBPTHREAD])
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
dnl Autoconf bug: AC_FUNC_MALLOC and AC_FUNC_REALLOC might not warn of cross
dnl compilation. Workaround this.
AC_FUNC_MALLOC
AS_IF([test "$cross_compiling" = yes],
AC_MSG_WARN([result $ac_cv_func_malloc_0_nonnull guessed because of cross compilation]))
AC_FUNC_REALLOC
AS_IF([test "$cross_compiling" = yes],
AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
dnl Autoheader (<= 2.69) bug: "dnl" comments in a quoted argument of
dnl AC_CHECK_FUNCS will expand wierdly in config.h.in.
dnl (https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html)
AC_CHECK_FUNCS([dup2 memset regcomp strcasecmp strchr strdup strtol], [],
[AC_MSG_ERROR(required library function not found on your system)])
# Optional library functions:
# pow - Used only by "examples/manual/expr".
# setlocale - Needed only if NLS is enabled.
# reallocarr - NetBSD function. Use reallocarray if not available.
# reallocarray - OpenBSD function. We have replacement if not available.
AC_CHECK_FUNCS([pow setlocale reallocarr reallocarray])
AC_CONFIG_FILES(
Makefile
doc/Makefile
examples/Makefile
examples/fastwc/Makefile
examples/manual/Makefile
po/Makefile.in
src/libfl.pc
src/Makefile
tools/Makefile
tests/Makefile
)
AC_OUTPUT
+1
View File
@@ -0,0 +1 @@
XBS-Destinations: sourceforge
+27
View File
@@ -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
+14
View File
@@ -0,0 +1,14 @@
FLEX = $(top_builddir)/src/flex$(EXEEXT)
info_TEXINFOS = flex.texi
dist_man_MANS = flex.1
MAINTAINERCLEANFILES = flex.1
CLEANFILES = *.aux *.cp *.cps *.fn *.fns *.hk *.hks *.ky *.log \
*.op *.ops *.pg *.toc *.tp *.tps *.vr *.vrs
flex.1: $(top_srcdir)/configure.ac $(top_srcdir)/src/flex.skl $(top_srcdir)/src/options.c $(top_srcdir)/src/options.h | $(FLEX)
$(HELP2MAN) --name='$(PACKAGE_NAME)' --section=1 \
--source='The Flex Project' --manual='Programming' \
--output=$@ $(FLEX) \
|| rm -f $@
+8623
View File
File diff suppressed because it is too large Load Diff
+29
View File
@@ -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
+15
View File
@@ -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.
+119
View File
@@ -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
}
+29
View File
@@ -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
+56
View File
@@ -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
+26
View File
@@ -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 );
}
+19
View File
@@ -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();
}
+21
View File
@@ -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();
}
+25
View File
@@ -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();
}
+28
View File
@@ -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();
}
+25
View File
@@ -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();
}
+24
View File
@@ -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.
+55
View File
@@ -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
+88
View File
@@ -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
+12
View File
@@ -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
+45
View File
@@ -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();
}
+106
View File
@@ -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
.
+28
View File
@@ -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
+65
View File
@@ -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;
+17
View File
@@ -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.
+8
View File
@@ -0,0 +1,8 @@
INCLUDE #2
This is the second file that will
be included.
>>> Foo are GNU?
#include "eof_test03.txt"
+7
View File
@@ -0,0 +1,7 @@
INCLUDE #3
This is the third file that will
be included.
>>> echo "I am `whoami`!!"
+35
View File
@@ -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);
}
%%
+64
View File
@@ -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);
}
+40
View File
@@ -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);
.
%%
+118
View File
@@ -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);
}
+442
View File
@@ -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);
}
+15
View File
@@ -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")); }
%%
+6
View File
@@ -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.
+19
View File
@@ -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")); }
+145
View File
@@ -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);
}
+78
View File
@@ -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;
+120
View File
@@ -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);
}
+12
View File
@@ -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");
%%
+33
View File
@@ -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);
}
+98
View File
@@ -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
%%
+94
View File
@@ -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);
}
%%
+21
View File
@@ -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
+32
View File
@@ -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]);
}
}
+31
View File
@@ -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]);
}
}
}
+30
View File
@@ -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;
}
}
}
%}
%%
+122
View File
@@ -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);
}
+29
View File
@@ -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);
}
%%
+33
View File
@@ -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);
}
%%
+7
View File
@@ -0,0 +1,7 @@
"This is a test \
of multi-line string \
scanning in flex. \
This may be breaking some law \
of usage though..."
+58
View File
@@ -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} std::cout << "number " << YYText() << '\n';
\n mylineno++;
{name} std::cout << "name " << YYText() << '\n';
{string} std::cout << "string " << YYText() << '\n';
%%
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;
while(lexer->yylex() != 0)
;
return 0;
}
+3
View File
@@ -0,0 +1,3 @@
*.la
*.lo
*.o
Executable
+17
View File
@@ -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);
}
+29
View File
@@ -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;
}
+125
View File
@@ -0,0 +1,125 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_CC_FOR_BUILD
#
# DESCRIPTION
#
# This macro searches for a C compiler that generates native executables,
# that is a C compiler that surely is not a cross-compiler. This can be
# useful if you have to generate source code at compile-time like for
# example GCC does.
#
# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
# The value of these variables can be overridden by the user by specifying
# a compiler with an environment variable (like you do for standard CC).
#
# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
# substituted in the Makefile.
#
# LICENSE
#
# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 8
AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_CPP])dnl
AC_REQUIRE([AC_EXEEXT])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
dnl Use the standard macros, but make them use other variable names
dnl
pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
pushdef([ac_cv_objext], ac_cv_build_objext)dnl
pushdef([ac_exeext], ac_build_exeext)dnl
pushdef([ac_objext], ac_build_objext)dnl
pushdef([CC], CC_FOR_BUILD)dnl
pushdef([CPP], CPP_FOR_BUILD)dnl
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
pushdef([host], build)dnl
pushdef([host_alias], build_alias)dnl
pushdef([host_cpu], build_cpu)dnl
pushdef([host_vendor], build_vendor)dnl
pushdef([host_os], build_os)dnl
pushdef([ac_cv_host], ac_cv_build)dnl
pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
pushdef([ac_cpp], ac_build_cpp)dnl
pushdef([ac_compile], ac_build_compile)dnl
pushdef([ac_link], ac_build_link)dnl
save_cross_compiling=$cross_compiling
save_ac_tool_prefix=$ac_tool_prefix
cross_compiling=no
ac_tool_prefix=
AC_PROG_CC
AC_PROG_CPP
AC_EXEEXT
ac_tool_prefix=$save_ac_tool_prefix
cross_compiling=$save_cross_compiling
dnl Restore the old definitions
dnl
popdef([ac_link])dnl
popdef([ac_compile])dnl
popdef([ac_cpp])dnl
popdef([ac_cv_host_os])dnl
popdef([ac_cv_host_vendor])dnl
popdef([ac_cv_host_cpu])dnl
popdef([ac_cv_host_alias])dnl
popdef([ac_cv_host])dnl
popdef([host_os])dnl
popdef([host_vendor])dnl
popdef([host_cpu])dnl
popdef([host_alias])dnl
popdef([host])dnl
popdef([LDFLAGS])dnl
popdef([CPPFLAGS])dnl
popdef([CFLAGS])dnl
popdef([CPP])dnl
popdef([CC])dnl
popdef([ac_objext])dnl
popdef([ac_exeext])dnl
popdef([ac_cv_objext])dnl
popdef([ac_cv_exeext])dnl
popdef([ac_cv_prog_cc_g])dnl
popdef([ac_cv_prog_cc_cross])dnl
popdef([ac_cv_prog_cc_works])dnl
popdef([ac_cv_prog_gcc])dnl
popdef([ac_cv_prog_CPP])dnl
dnl Finally, set Makefile variables
dnl
BUILD_EXEEXT=$ac_build_exeext
BUILD_OBJEXT=$ac_build_objext
AC_SUBST(BUILD_EXEEXT)dnl
AC_SUBST(BUILD_OBJEXT)dnl
AC_SUBST([CFLAGS_FOR_BUILD])dnl
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
])
-119
View File
@@ -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> &nbsp; [<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&rsquo;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&rsquo;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>
-112
View File
@@ -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> &nbsp; [<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>
-134
View File
@@ -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> &nbsp; [<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>
-392
View File
@@ -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> &nbsp; [<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 &lsquo;<samp>zap me</samp>&rsquo; from its input:
</p>
<a name="index-deleting-lines-from-input"></a>
<div class="example">
<pre class="verbatim"> %%
&quot;zap me&quot;
</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 &lsquo;<samp>{</samp>&rsquo;, then the action spans till the
balancing &lsquo;<samp>}</samp>&rsquo; is found, and the action may cross multiple lines.
<code>flex</code> knows about C strings and comments and won&rsquo;t be fooled by
braces found within them, but also allows actions to begin with
&lsquo;<samp>%{</samp>&rsquo; and will consider the action to be all the text up to the
next &lsquo;<samp>%}</samp>&rsquo; (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 (&lsquo;<samp>|</samp>&rsquo;) means &ldquo;same as the
action for the next rule&rdquo;. 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&ndash;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&rsquo;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 &ldquo;second best&rdquo; 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 &lsquo;<samp>frob</samp>&rsquo; 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 &lsquo;<samp>frob</samp>&rsquo; 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 &lsquo;<samp>abcd</samp>&rsquo;, it will
write &lsquo;<samp>abcdabcaba</samp>&rsquo; 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&rsquo;s action since they use the
special &lsquo;<samp>|</samp>&rsquo; 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&rsquo;s actions it
will slow down <em>all</em> of the scanner&rsquo;s matching. Furthermore,
<code>REJECT</code> cannot be used with the &lsquo;<samp>-Cf</samp>&rsquo; or &lsquo;<samp>-CF</samp>&rsquo; 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
&lsquo;<samp>mega-kludge</samp>&rsquo; the following will write &lsquo;<samp>mega-mega-kludge</samp>&rsquo; 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 &lsquo;<samp>mega-</samp>&rsquo; is matched and echoed to the output. Then &lsquo;<samp>kludge</samp>&rsquo;
is matched, but the previous &lsquo;<samp>mega-</samp>&rsquo; is still hanging around at the
beginning of
<code>yytext</code>
so the
<code>ECHO</code>
for the &lsquo;<samp>kludge</samp>&rsquo; rule will actually write &lsquo;<samp>mega-kludge</samp>&rsquo;.
</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&rsquo;s action entails a minor performance penalty in the scanner&rsquo;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 &lsquo;<samp>foobar</samp>&rsquo; the
following will write out &lsquo;<samp>foobarbar</samp>&rsquo;:
</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&rsquo;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 &gt;= 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 &lsquo;<samp>EOF</samp>&rsquo; 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"> %%
&quot;/*&quot; {
int c;
for ( ; ; )
{
while ( (c = input()) != '*' &amp;&amp;
c != EOF )
; /* eat up text of comment */
if ( c == '*' )
{
while ( (c = input()) == '*' )
;
if ( c == '/' )
break; /* found the end */
}
if ( c == EOF )
{
error( &quot;EOF in comment&quot; );
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&rsquo;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&rsquo;s
caller, indicating &ldquo;all done&rdquo;. 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> &nbsp; [<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>
-135
View File
@@ -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> &nbsp; [<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 &ldquo;unspecified address&rdquo; &ldquo;::&rdquo;.
</p>
</dd>
<dt>URI</dt>
<dd><p><code>(([^:/?#]+):)?(&quot;//&quot;([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?</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>
-111
View File
@@ -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> &nbsp; [<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">&bull; <a href="Makefiles-and-Flex.html#Makefiles-and-Flex" accesskey="1">Makefiles and Flex</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Bison-Bridge.html#Bison-Bridge" accesskey="2">Bison Bridge</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="M4-Dependency.html#M4-Dependency" accesskey="3">M4 Dependency</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Common-Patterns.html#Common-Patterns" accesskey="4">Common Patterns</a>:</td><td>&nbsp;&nbsp;</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> &nbsp; [<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 &lt;adoram@orna.hybridge.com&gt;
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 &lt;vern&gt;
[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.]
&gt; 1. Using the pattern
&gt; ([Ff](oot)?)?[Nn](ote)?(\.)?
&gt; instead of
&gt; (((F|f)oot(N|n)ote)|((N|n)ote)|((N|n)\.)|((F|f)(N|n)(\.)))
&gt; (in a very complicated flex program) caused the program to slow from
&gt; 300K+/min to 100K/min (no other changes were done).
These two are not equivalent. For example, the first can match &quot;footnote.&quot;
but the second can only match &quot;footnote&quot;. 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.
&gt; 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.
&gt; 3. I have a pattern that look like this:
&gt; pats {p1}|{p2}|{p3}|...|{p50} (50 patterns ORd)
&gt;
&gt; running yet another complicated program that includes the following rule:
&gt; &lt;snext&gt;{and}/{no4}{bb}{pats}
&gt;
&gt; gets me to &quot;too complicated - over 32,000 states&quot;...
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.
&gt; so I divided {pats} to {pats1}, {pats2},..., {pats5} each consists of about
&gt; 10 patterns and changed the rule to be 5 rules.
&gt; 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'.
&gt; 4. I changed a rule that looked like this:
&gt; &lt;snext8&gt;{and}{bb}/{ROMAN}[^A-Za-z] { BEGIN...
&gt;
&gt; to the next 2 rules:
&gt; &lt;snext8&gt;{and}{bb}/{ROMAN}[A-Za-z] { ECHO;}
&gt; &lt;snext8&gt;{and}{bb}/{ROMAN} { BEGIN...
&gt;
&gt; 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.
&gt; but are there any specific rules about it ?
See the &quot;Performance Considerations&quot; 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> &nbsp; [<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>
-122
View File
@@ -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> &nbsp; [<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 &amp; Yacc</em>,
O&rsquo;Reilly and Associates. Be sure to get the 2nd edition.
</p>
<p>M. E. Lesk and E. Schmidt,
<em>LEX &ndash; 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>
-203
View File
@@ -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> &nbsp; [<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 &lsquo;<samp>%option
bison-bridge</samp>&rsquo; or by supplying &lsquo;<samp>--bison-bridge</samp>&rsquo; 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 &quot;C&quot; assignment statements... sort of. */
%{
#include &quot;y.tab.h&quot; /* Generated by bison. */
%}
%option bison-bridge bison-locations
%
[[:digit:]]+ { yylval-&gt;num = atoi(yytext); return NUMBER;}
[[:alnum:]]+ { yylval-&gt;str = strdup(yytext); return STRING;}
&quot;=&quot;|&quot;;&quot; { 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 &quot;C&quot; 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 &lt;str&gt; STRING
%token &lt;num&gt; NUMBER
%%
assignment:
STRING '=' NUMBER ';' {
printf( &quot;(setf %s %d)&quot;, $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> &nbsp; [<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> &nbsp; [<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
&ldquo;outermost&rdquo; <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>&rsquo;s won&rsquo;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> &nbsp; [<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 &lt;vern&gt;
&gt; I assume as long as my *.l file defines the
&gt; range of expected character code values (in octal format), flex will
&gt; scan the file and read multi-byte characters correctly. But I have no
&gt; 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 &quot;faster&quot; NDFA-&gt;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 &quot;faster&quot; NDFA-&gt;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> &nbsp; [<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 &quot;rules&quot; section of the file?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the &quot;rules&quot; section of the file?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Can I include comments in the &quot;rules&quot; 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> &nbsp; [<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 &quot;rules&quot; 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> &nbsp; [<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 &lt;jl@theophys.kth.se&gt;
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 &lt;vern&gt;
&gt; I'm working for the Swedish team translating GNU program, and I'm currently
&gt; working with flex. I have a few questions about some of the messages which
&gt; 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 ...
&gt; #: main.c:545
&gt; msgid &quot; %d protos created\n&quot;
&gt;
&gt; Does proto mean prototype?
Yes - prototypes of state compression tables.
&gt; #: main.c:539
&gt; msgid &quot; %d/%d (peak %d) template nxt-chk entries created\n&quot;
&gt;
&gt; Here I'm mainly puzzled by 'nxt-chk'. I guess it means 'next-check'. (?)
&gt; However, 'template next-check entries' doesn't make much sense to me. To be
&gt; 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
&quot;base&quot; and &quot;default&quot; entries, the second has &quot;next&quot; and &quot;check&quot; entries.
The &quot;base&quot; entry is indexed by the current state and yields an index into
the next/check table. The &quot;default&quot; entry gives what to do if the state
transition isn't found in next/check. The &quot;next&quot; entry gives the next
state to enter, but only if the &quot;check&quot; 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.
&gt; #: main.c:533
&gt; msgid &quot; %d/%d base-def entries created\n&quot;
&gt;
&gt; 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> &nbsp; [<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>
-309
View File
@@ -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> &nbsp; [<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>&lsquo;<samp>--ansi-definitions, <code>%option ansi-definitions</code></samp>&rsquo;</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>&lsquo;<samp>--ansi-prototypes, <code>%option ansi-prototypes</code></samp>&rsquo;</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>&lsquo;<samp>--bison-bridge, <code>%option bison-bridge</code></samp>&rsquo;</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>&lsquo;<samp>--bison-locations, <code>%option bison-locations</code></samp>&rsquo;</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>&lsquo;<samp>-L, --noline, <code>%option noline</code></samp>&rsquo;</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>&rsquo;s
fault &ndash; 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>&lsquo;<samp>-R, --reentrant, <code>%option reentrant</code></samp>&rsquo;</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 &lsquo;<samp>--c++</samp>&rsquo; option.
</p>
<p>The option &lsquo;<samp>--reentrant</samp>&rsquo; 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>&lsquo;<samp>-+, --c++, <code>%option c++</code></samp>&rsquo;</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>&lsquo;<samp>--array, <code>%option array</code></samp>&rsquo;</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>&lsquo;<samp>--pointer, <code>%option pointer</code></samp>&rsquo;</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>&lsquo;<samp>-PPREFIX, --prefix=PREFIX, <code>%option prefix=&quot;PREFIX&quot;</code></samp>&rsquo;</dt>
<dd><p>changes the default &lsquo;<samp>yy</samp>&rsquo; prefix used by <code>flex</code> for all
globally-visible variable and function names to instead be
&lsquo;<samp>PREFIX</samp>&rsquo;. For example, &lsquo;<samp>--prefix=foo</samp>&rsquo; 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
&lsquo;<samp>-lfl</samp>&rsquo;
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>&lsquo;<samp>--main, <code>%option main</code></samp>&rsquo;</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>&lsquo;<samp>--nounistd, <code>%option nounistd</code></samp>&rsquo;</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>&lsquo;<samp>--yyclass=NAME, <code>%option yyclass=&quot;NAME&quot;</code></samp>&rsquo;</dt>
<dd><p>only applies when generating a C++ scanner (the &lsquo;<samp>--c++</samp>&rsquo; 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> &nbsp; [<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>
-148
View File
@@ -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> &nbsp; [<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 &lsquo;<samp>/*</samp>&rsquo; and
&lsquo;<samp>*/</samp>&rsquo; 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 &lsquo;<samp>%option</samp>&rsquo; 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
&lsquo;<samp>/*</samp>&rsquo;). 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) */
&lt;STATE_X&gt;{
ruleC ECHO;
ruleD ECHO;
%{
/* code block */
%}
}
%%
/* User Code Section */
</pre></div>
</body>
</html>
-116
View File
@@ -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> &nbsp; [<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">&bull; <a href="Numbers.html#Numbers" accesskey="1">Numbers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Identifiers.html#Identifiers" accesskey="2">Identifiers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Quoted-Constructs.html#Quoted-Constructs" accesskey="3">Quoted Constructs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Addresses.html#Addresses" accesskey="4">Addresses</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>
</body>
</html>
-576
View File
@@ -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> &nbsp; [<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: &nbsp; </th><td><a class="summary-letter" href="#Concept-Index_cp_symbol-1"><b>$</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-2"><b>%</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-3"><b>&lt;</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-4"><b>[</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-5"><b>^</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-6"><b>|</b></a>
&nbsp;
<br>
<a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-K"><b>K</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-N"><b>N</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-Y"><b>Y</b></a>
&nbsp;
</td></tr></table>
<table class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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">&lt;</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">&lt;&lt;EOF&gt;&gt;, use of</a>:</td><td>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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 (&lt;*&gt;)</a>:</td><td>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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: &nbsp; </th><td><a class="summary-letter" href="#Concept-Index_cp_symbol-1"><b>$</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-2"><b>%</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-3"><b>&lt;</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-4"><b>[</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-5"><b>^</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_symbol-6"><b>|</b></a>
&nbsp;
<br>
<a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-K"><b>K</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-N"><b>N</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
&nbsp;
<a class="summary-letter" href="#Concept-Index_cp_letter-Y"><b>Y</b></a>
&nbsp;
</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> &nbsp; [<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>
-142
View File
@@ -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> &nbsp; [<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 &copy; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
</p>
<p>Copyright &copy; 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 &ldquo;AS IS&rdquo; AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
</p>
</body>
</html>
-136
View File
@@ -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> &nbsp; [<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 &lsquo;<samp>yy</samp>&rsquo; 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 &gt; all.tables
</pre></div>
<p>The above example created two scanners, &lsquo;<samp>cpp</samp>&rsquo;, and &lsquo;<samp>c</samp>&rsquo;. 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
View File
@@ -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> &nbsp; [<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
&lsquo;<samp>-+</samp>&rsquo; option (or, equivalently, <code>%option c++)</code>, which is
automatically specified if the name of the <code>flex</code> executable ends
in a &rsquo;+&rsquo;, 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&amp;</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&amp;</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&amp; arg_yyin, ostream&amp; 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&rsquo;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&rsquo;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=&quot;S&quot;</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&amp; new_in, ostream&amp; 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&amp; new_in, ostream&amp; 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 &lsquo;<samp>-B</samp>&rsquo;
and &lsquo;<samp>-I</samp>&rsquo; 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&rsquo;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
&lsquo;<samp>-P</samp>&rsquo; 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 &lt;iostream&gt;
using namespace std;
int mylineno = 0;
%}
%option noyywrap c++
string \&quot;[^\n&quot;]+\&quot;
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 */
&quot;/*&quot; {
int c;
while((c = yyinput()) != 0)
{
if(c == '\n')
++mylineno;
else if(c == '*')
{
if((c = yyinput()) == '/')
break;
else
unput(c);
}
}
}
{number} cout &lt;&lt; &quot;number &quot; &lt;&lt; YYText() &lt;&lt; '\n';
\n mylineno++;
{name} cout &lt;&lt; &quot;name &quot; &lt;&lt; YYText() &lt;&lt; '\n';
{string} cout &lt;&lt; &quot;string &quot; &lt;&lt; YYText() &lt;&lt; '\n';
%%
// This include is required if main() is an another source file.
//#include &lt;FlexLexer.h&gt;
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;
while(lexer-&gt;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
&lsquo;<samp>-P</samp>&rsquo; flag (or the <code>prefix=</code> option) to rename each
<code>yyFlexLexer</code> to some other &lsquo;<samp>xxFlexLexer</samp>&rsquo;. You then can
include <samp>&lt;FlexLexer.h&gt;</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 &lt;FlexLexer.h&gt;
#undef yyFlexLexer
#define yyFlexLexer zzFlexLexer
#include &lt;FlexLexer.h&gt;
</pre></div>
<p>if, for example, you used <code>%option prefix=&quot;xx&quot;</code> for one of your
scanners and <code>%option prefix=&quot;zz&quot;</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> &nbsp; [<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>
-221
View File
@@ -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> &nbsp; [<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>&lsquo;<samp>-b, --backup, <code>%option backup</code></samp>&rsquo;</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 &lsquo;<samp>-Cf</samp>&rsquo; or <code>-CF</code>
is used, the generated scanner will run faster (see the &lsquo;<samp>--perf-report</samp>&rsquo; 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>&lsquo;<samp>-d, --debug, <code>%option debug</code></samp>&rsquo;</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 (&quot;the matched text&quot;)
</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&rsquo;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>&lsquo;<samp>-p, --perf-report, <code>%option perf-report</code></samp>&rsquo;</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 &lsquo;<samp>^</samp>&rsquo; operator, and
the &lsquo;<samp>--interactive</samp>&rsquo; 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>&lsquo;<samp>-s, --nodefault, <code>%option nodefault</code></samp>&rsquo;</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&rsquo;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>&lsquo;<samp>-T, --trace, <code>%option trace</code></samp>&rsquo;</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>&lsquo;<samp>-w, --nowarn, <code>%option nowarn</code></samp>&rsquo;</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>&lsquo;<samp>-v, --verbose, <code>%option verbose</code></samp>&rsquo;</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 &lsquo;<samp>--version</samp>&rsquo;),
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>&lsquo;<samp>--warn, <code>%option warn</code></samp>&rsquo;</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> &nbsp; [<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>
-192
View File
@@ -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> &nbsp; [<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 &lsquo;<samp>name</samp>&rsquo; is a word beginning with a letter or an underscore
(&lsquo;<samp>_</samp>&rsquo;) followed by zero or more letters, digits, &lsquo;<samp>_</samp>&rsquo;, or
&lsquo;<samp>-</samp>&rsquo; (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
&lsquo;<samp>{name}</samp>&rsquo;, which will expand to &lsquo;<samp>(definition)</samp>&rsquo;. 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 &lsquo;<samp>DIGIT</samp>&rsquo; to be a regular expression which matches a single
digit, and &lsquo;<samp>ID</samp>&rsquo; 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}+&quot;.&quot;{DIGIT}*
</pre></div>
<p>is identical to
</p>
<div class="example">
<pre class="verbatim"> ([0-9])+&quot;.&quot;([0-9])*
</pre></div>
<p>and matches one-or-more digits followed by a &lsquo;<samp>.</samp>&rsquo; 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 &lsquo;<samp>/*</samp>&rsquo;) is copied verbatim to the output up
to the next &lsquo;<samp>*/</samp>&rsquo;.
</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 &lsquo;<samp>%{</samp>&rsquo; and &lsquo;<samp>%}</samp>&rsquo;
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 &lsquo;<samp>%{</samp>&rsquo; ... &lsquo;<samp>%}</samp>&rsquo; 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, &lsquo;<samp>{</samp>&rsquo; and &lsquo;<samp>}</samp>&rsquo; 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 &quot;top&quot; of the generated file. */
#include &lt;stdint.h&gt;
#include &lt;inttypes.h&gt;
}
</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 &lsquo;<samp>%top</samp>&rsquo; 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> &nbsp; [<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>
-182
View File
@@ -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> &nbsp; [<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> &lsquo;<samp>warning, rule cannot be matched</samp>&rsquo; 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 &lsquo;<samp>foo</samp>&rsquo; cannot be
matched because it comes after an identifier &ldquo;catch-all&rdquo; 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> &lsquo;<samp>warning, -s option given but default rule can be matched</samp>&rsquo; 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 &lsquo;<samp>-s</samp>&rsquo; 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> &lsquo;<samp>flex scanner jammed</samp>&rsquo;. a scanner compiled with
&lsquo;<samp>-s</samp>&rsquo; has encountered an input string which wasn&rsquo;t matched by any of
its rules. This error can also occur due to internal problems.
</li><li> &lsquo;<samp>token too large, exceeds YYLMAX</samp>&rsquo;. 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&rsquo;ing <code>YYLMAX</code> in the definitions section of your <code>flex</code>
input.
</li><li> &lsquo;<samp>scanner requires -8 flag to use the character 'x'</samp>&rsquo;. Your scanner
specification includes recognizing the 8-bit character &lsquo;<samp>'x'</samp>&rsquo; and
you did not specify the -8 flag, and your scanner defaulted to 7-bit
because you used the &lsquo;<samp>-Cf</samp>&rsquo; or &lsquo;<samp>-CF</samp>&rsquo; table compression options.
See the discussion of the &lsquo;<samp>-7</samp>&rsquo; flag, <a href="Scanner-Options.html#Scanner-Options">Scanner Options</a>, for
details.
</li><li> &lsquo;<samp>flex scanner push-back overflow</samp>&rsquo;. you used <code>unput()</code> to push
back so much text that the scanner&rsquo;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> &lsquo;<samp>input buffer overflow, can't enlarge buffer because scanner uses
REJECT</samp>&rsquo;. the scanner was working on matching an extremely large token
and needed to expand the input buffer. This doesn&rsquo;t work with scanners
that use <code>REJECT</code>.
</li><li> &lsquo;<samp>fatal flex scanner internal error--end of buffer missed</samp>&rsquo;. This can
occur in a scanner which is reentered after a long-jump has jumped out
(or over) the scanner&rsquo;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> &lsquo;<samp>too many start conditions in &lt;&gt; construct!</samp>&rsquo; you listed more start
conditions in a &lt;&gt; 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> &nbsp; [<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> &nbsp; [<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 &quot;{&quot;({block}|{statement})*&quot;}&quot;
</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 &ldquo;balance&rdquo; parentheses
to an arbitrary degree. For example, it&rsquo;s impossible to write a regular
expression that matches all strings containing the same number of &rsquo;{&rsquo;s
as &rsquo;}&rsquo;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 &quot;faster&quot; NDFA-&gt;DFA algorithm?</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Does there exist a &quot;faster&quot; NDFA-&gt;DFA algorithm?">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Does there exist a &quot;faster&quot; NDFA-&gt;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> &nbsp; [<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 &quot;faster&quot; NDFA-&gt;DFA algorithm?</h3>
<p>There&rsquo;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
View File
@@ -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> &nbsp; [<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>&lt;&lt;EOF&gt;&gt;</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>&lt;&lt;EOF&gt;&gt; rules may not be used with other patterns; they may only be
qualified with a list of start conditions. If an unqualified &lt;&lt;EOF&gt;&gt;
rule is given, it applies to <em>all</em> start conditions which do not
already have &lt;&lt;EOF&gt;&gt; actions. To specify an &lt;&lt;EOF&gt;&gt; rule for only the
initial start condition, use:
</p>
<div class="example">
<pre class="verbatim"> &lt;INITIAL&gt;&lt;&lt;EOF&gt;&gt;
</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...
&lt;quote&gt;&lt;&lt;EOF&gt;&gt; {
error( &quot;unterminated quote&quot; );
yyterminate();
}
&lt;&lt;EOF&gt;&gt; {
if ( *++filelist )
yyin = fopen( *filelist, &quot;r&quot; );
else
yyterminate();
}
</pre></div>
</body>
</html>
-120
View File
@@ -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> &nbsp; [<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 &lt;vern&gt;
&gt; [: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>
-124
View File
@@ -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> &nbsp; [<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 &lt;colin@colina.demon.co.uk&gt;
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 &lt;vern&gt;
&gt; #define YY_DECL int yylex (YYSTYPE *lvalp, struct parser_control
&gt; *parm)
&gt;
&gt; I have been trying to get this to work as a C++ scanner, but it does
&gt; not appear to be possible (warning that it matches no declarations in
&gt; yyFlexLexer, or something like that).
&gt;
&gt; Is this supposed to be possible, or is it being worked on (I DID
&gt; notice the comment that scanner classes are still experimental, so I'm
&gt; 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>

Some files were not shown because too many files have changed in this diff Show More