202 Commits
Author SHA1 Message Date
Will Estes 4322cc82f3 html from #95 2016-10-22 09:41:09 -04:00
Will Estes a49c591c86 manual: import current manual 2016-10-20 20:35:50 -04:00
Will Estes 6c668b89ca clear out source code 2016-10-20 20:31:27 -04:00
Demi Obenour 4bffa41e4e Improved M4 quotation
This fixes M4 quotation of certain strings beginning with `yy` (in
section 3 of the input file only) and character literals.  The new
quotation method is also less brittle and faster.

Tests that relied on the old behavior were fixed.

Also, `yyconst` is no longer defined; use `const` (which it
unconditionally was defined to) instead.
2016-10-19 20:39:06 -04:00
Will Estes 7dcb10c048 build: for automake, flex is foreign 2016-10-19 17:00:50 -04:00
Will Estes 9a4ae5d619 doc: mv README to README.md 2016-10-19 10:27:23 -04:00
Will Estes 2ad733a56e doc: touch up README 2016-10-19 10:26:44 -04:00
Will Estes 507f96a5ff doc: README no longer mentions sourceforge 2016-10-19 05:25:36 -04:00
Will Estes 17bf278ad7 doc: update NEWS with more post-2.6.1 additions 2016-10-06 16:39:04 -04:00
Demi Obenour 9d3ddf572e Fix M4 quoting of section 3.
This fixes M4 quoting of section 3 of the input file, including escape
sequences and character constants.

Tests were added to verify the behavior in section 3 with respect to
quoting. Both escaping of quotes and quoting of potential macro-start
characters are tested. Existing tests were also fixed to account for the new -- and now correct -- behavior. Many tests relied on the old behavior of expanding M4 macros
in section 3.  They needed to be updated for the new behavior.
2016-10-05 19:25:56 -04:00
Mightyjo 735ffb6a65 Fix yyrestart(NULL) SEGV. 2016-10-05 17:19:03 -04:00
Demi Obenour ee87e5df00 scanner: M4 quoting fixes 2016-09-25 19:40:10 -04:00
Demi Obenour 749a8c80f7 Support make indent for out of source builds 2016-09-25 19:40:10 -04:00
Demi Obenour fb91984b3b Simplify some shell code 2016-09-25 18:53:29 -04:00
Demi Obenour e50d903620 no longer generate K&R C scanners 2016-09-25 16:12:14 -04:00
Demi Obenour 7528bc0aee Fix escaping of [[ and ]] in strings
Previously, `[[` and `]]` were not escaped in strings, which led
to bad interactions with m4.

Also, don't break strings on newline, as GCC et al support whitespace
between a backslash and the subsequent newline.
2016-09-04 18:29:30 -04:00
Translation Project b22b8fdb97 new sv translation 2016-06-20 09:17:57 -04:00
Demetri Obenour 925549475e Delete action_m4_define from misc.c
This function was not used and always triggered a fatal error when run.
2016-05-23 17:36:33 -04:00
Will Estes 7878f90988 test: run direct tests from srcdir 2016-05-20 17:31:27 -04:00
Egor Pugin 1b7a7165f3 Exited with error code on some conditions in include tests 2016-05-20 17:31:27 -04:00
Will Estes 98fd512f9a test: drop .exe when making input file names 2016-05-20 17:31:27 -04:00
Will Estes 0cc66ab7fd test: removed dependencies for include tests 2016-05-20 14:09:29 -04:00
Tobias Klauser 0afeed389c Avoid realloc on every call of sf_push()
Currently, every call to sf_push() realloc()'s _sf_stack, even if the
maximum size _sf_max wasn't changed. As the indentation beneath the
"if" clause already indicates, the realloc() should only be executed
if _sf_max was increased.

Found by compiling flex with the -Wmisleading-indentation flags of gcc,
which leads to the following warning:

scanflags.c: In function ‘sf_push’:
scanflags.c:42:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if (_sf_top_ix + 1 >= _sf_max)
     ^~
scanflags.c:44:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
         _sf_stk = realloc(_sf_stk, sizeof(scanflags_t) * _sf_max);
         ^~~~~~~
2016-04-28 10:18:21 +02:00
Will Estes 2061043d3d build: prettified command to build man page 2016-03-31 18:47:00 -04:00
Will Estes 84ca965d1f build: added man page to DISTCLEANFILES 2016-03-31 18:46:23 -04:00
Will Estes 9f2343bf65 remove unused TODO, BUGS files 2016-03-31 16:09:28 -04:00
Will Estes ad46bcf9cd removed to.do/ directory 2016-03-31 15:58:16 -04:00
Will Estes e15146bbaa gettext: removed flex.skl from POTFILES.in file list 2016-03-31 13:36:09 -04:00
rlar 4db9c203f6 fix skel.c dependency (missing tables_shared.c) and
polish build rule

Also remove references to srcdir since skel.c is no longer mentioned in po/POTFILES.in.
2016-03-31 11:19:20 -04:00
rlar 7cfb440c7c fix flex.1 dependency
git clean -fdx && ./autogen.sh && \
  mkdir -p ../build && cd ../build && ../flex/configure && make -j10 && \
  make dist

failed with:

>  help2man: can't get `--help' info from ../../flex/src/flex

Note:
  There is no dependency except for the flex binary.
2016-03-31 10:51:19 -04:00
rlar 39cff7e239 fix stage1scan.c and stage1scan.l dependency
git clean -fdx && ./autogen.sh && \
  mkdir -p ../build && cd ../build && ../flex/configure && make -j10

failed with:

> ../src/stage1flex -o stage1scan.c stage1scan.l
> stage1flex: can't open stage1scan.l

Note:
  stage1scan.c is not necessairy in the "make dist" generated tar.gz file.
  stage1flex will be build from scan.c (which is distributed),
    and this will then generate stage1scan.c from scan.l
2016-03-31 10:47:00 -04:00
Will Estes 07a1d30ba3 gettext: list src/flex.skl in po/POTFILES.in 2016-03-31 10:21:56 -04:00
rlar 8d09d89c33 warning in generated code, with -Ca
warning: conversion to 'yy_state_type' from 'flex_uint32_t' may change the sign of the result [-Wsign-conversion]
2016-03-31 07:17:32 -04:00
rlar f57cb42c7d suppress WARNINGFLAGS' for the almost obsolete noansi' test cases 2016-03-31 07:15:43 -04:00
rlar f1ce47684c configure option --enable-warnings' and WARNINGFLAGS'
`WARNINGFLAGS' can be passed when invoking `configure'
 and when invoking `make'

if configure switch `--enable-warnings' was given
  then default to something useful if we have `GCC'

`WARNINGFLAGS' is not used when compiling `stage1flex'
  to avoid unnecessary clutter
2016-03-31 07:11:51 -04:00
Tobias Klauser babe9a1e8e Fix potential buffer overflow in strncat()
When using clang/llvm 3.8 to compile flex, the following warning is
emitted:

main.c:378:27: warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]
                                        strncat(m4_path, m4, sizeof(m4_path));
                                                             ^~~~~~~~~~~~~~~
main.c:378:27: note: change the argument to be the free space in the destination buffer minus the terminating null byte
                                        strncat(m4_path, m4, sizeof(m4_path));
                                                             ^~~~~~~~~~~~~~~
                                                             sizeof(m4_path) - strlen(m4_path) - 1

Fix it up by using the solution proposed by the warning message.
2016-03-31 10:09:57 +02:00
Robert.Larice Robert Larice c5d903dcda build: simplified dependency tracking so parallel make runs succeed 2016-03-29 15:19:00 -04:00
rlar fab3f206e4 avoid warning in generated code, with -Cf
warning: conversion to 'unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
2016-03-28 16:41:15 -04:00
Will Estes 42325b8b39 mention v2.6.2; summarize changes since 2.6.1 2016-03-18 15:25:10 -04:00
Will Estes e873499f32 doc: corrected example in manual, gh#67 2016-03-18 15:09:44 -04:00
rlar 0292299ec5 warning: conversion to 'size_t' from 'int' may change the sign of the result [-Wsign-conversion] 2016-03-18 14:52:04 -04:00
rlar ed59d3e066 warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion] 2016-03-18 14:49:23 -04:00
rlar c2429b5a4a warning: conversion to 'flex_uint32_t' from 'long unsigned int' may alter its value [-Wconversion]
struct yytbl_reader, member bread is of type flex_uint32_t
2016-03-18 14:46:43 -04:00
rlar 70b804fb02 warning: redundant redeclaration of '...' [-Wredundant-decls] 2016-03-18 14:39:21 -04:00
rlar 676a62ec1e warning: no previous prototype for '...' [-Wmissing-prototypes] 2016-03-18 14:35:39 -04:00
rlar d112fbaf53 warning: unused variable 'fp' [-Wunused-variable] 2016-03-18 14:31:37 -04:00
rlar 2da698f147 main(), warning: redundant redeclaration of 'main' [-Wredundant-decls] 2016-03-18 14:27:58 -04:00
rlar 08fd44f453 main(), warning: old-style function definition [-Wold-style-definition] 2016-03-18 14:06:11 -04:00
rlar f4be44b2b2 main(), warning: old-style function definition [-Wold-style-definition] 2016-03-18 13:56:25 -04:00
rlar 8756116ccb Fix two more casts 2016-03-16 08:27:58 -04:00
Bastian Köcher 1da19feba7 Fixes yyl compare with unsigned warning 2016-03-16 08:23:01 -04:00
Robert Larice 197b523555 Suppress portability warnings in Makefile generation 2016-03-16 08:23:01 -04:00
rlar dc55016677 generated code, in yyensure_buffer_stack(), change type of local `num_to_alloc'
which is exclusively used in yy_size_t context
2016-03-12 14:29:47 -05:00
rlar 8c098febc9 generated code, in yy_get_next_buffer(), change type of local `number_to_move'
suits better, because `yy_n_chars' and `yy_buf_size' are of type `int'
2016-03-12 14:28:55 -05:00
rlar cf4121fa97 generated code, _yybytes_len' is of type int', fix code accordingly 2016-03-12 14:27:38 -05:00
rlar 3946924ed5 generated code, max_size' seems to be of type int', fix casts accordingly 2016-03-12 14:25:34 -05:00
rlar 986bb5e294 generated code, here new_size' is of type int', fix casts accordingly 2016-03-12 14:23:30 -05:00
rlar 33dd868353 generated code, yy_buf_size' is of type int', fix casts accordingly 2016-03-12 14:22:43 -05:00
rlar 3614d4c834 generated code, offset' is of type int' 2016-03-12 14:21:33 -05:00
rlar 04c31bf09f generated code, yy_more_len' is of type int' 2016-03-12 14:20:30 -05:00
rlar 48152721a0 scan.l, rewrite two loops to avoid unneccesairy casting 2016-03-12 14:16:46 -05:00
rlar bdc999cbc1 improve readability 2016-03-12 14:12:49 -05:00
rlar fb60d5a04e another cast in tblcmp.c to avoid warning 2016-03-12 14:10:48 -05:00
rlar 3d640d049d casts in buf_append() to get rid of warnings 2016-03-08 15:35:53 -05:00
rlar de3fb712c2 cast to suite type of flex_uint32_t td_lolen 2016-03-08 15:35:45 -05:00
rlar 9160ceb67f cast to get rid of warnings 2016-03-08 15:30:35 -05:00
rlar 00bc43fa04 cast and fix usage of log10(), ceil to prevent buffer overflow 2016-03-08 15:20:45 -05:00
rlar c7b3db7957 tables.c, sprinkle casts to get rid of warnings 2016-03-08 15:20:45 -05:00
rlar 598ba7fd4c yytbl_data_compress(), change type of local newsz to get rid of warnings 2016-03-08 15:20:45 -05:00
rlar e8e83d2dbe change type of struct yytbl_writer.total_written to get rid of warnings 2016-03-08 15:13:05 -05:00
rlar c2940d142b change argument type of yytbl_writen() to get rid of warnings 2016-03-08 13:29:08 -05:00
rlar fe89a09e29 yytbl_write8/16/32(), change type of local variables to get rid of warnings 2016-03-08 13:22:54 -05:00
rlar 1d5b34b52a change return type and rename int htoi()/otoi() --> unsigned int htoui()/otoui() 2016-03-08 13:19:20 -05:00
Will Estes 609af5775f Mention 2.6.1 release date 2016-03-01 19:24:24 -05:00
rlar 455205b2e0 avoid warning, add (int) cast to the read() return value
For similiarity with the fread() case.
2016-03-01 06:08:30 -05:00
rlar 265e8e5c90 avoid warning, POSIX says yyless() has an `int' argument 2016-03-01 06:07:36 -05:00
rlar f951c3f8cc use type size_t in filter_tee_header() to avoid warnings 2016-03-01 06:06:42 -05:00
rlar 22d123c1fe add (size_t) casts to malloc invocations to prevent warnings 2016-03-01 06:05:21 -05:00
rlar d2c0374297 add (int) casts to some strlen() invocations to prevent warnings 2016-02-29 20:16:03 -05:00
rlar 0f276adbb2 ndlookup(), char *, to get rid of casts and warnings 2016-02-29 20:11:13 -05:00
rlar 967819769e ndinstal(), char *, to get rid of casts and warnings 2016-02-29 20:07:58 -05:00
rlar b7b9789469 cclinstal() and ccllookup(), char *, to get rid of casts and warnings 2016-02-29 20:07:47 -05:00
rlar 2532a957a6 warning: redundant redeclaration of ‘gen_next_state’ [-Wredundant-decls] 2016-02-29 19:53:12 -05:00
rlar 0f4684dd2a warning: no previous prototype for ‘mkecstbl’ [-Wmissing-prototypes] 2016-02-29 19:41:03 -05:00
rlar cc7d14899c warning: suggest parentheses around assignment used as truth value [-Wparentheses] 2016-02-29 19:06:56 -05:00
rlar 860d7cfe15 warning: redundant redeclaration of ‘yywrap’ [-Wredundant-decls] 2016-02-28 19:43:38 -05:00
rlar ad994f507e warning: redundant redeclaration of ‘yylval’ [-Wredundant-decls] 2016-02-28 19:42:51 -05:00
rlar 4d6fb2187b warning: redundant redeclaration of ‘yyin’ [-Wredundant-decls] 2016-02-28 19:40:05 -05:00
rlar 519783bb98 warning: redundant redeclaration of ‘yyparse’ [-Wredundant-decls] 2016-02-28 19:07:18 -05:00
rlar 318396d05a unification, rename some more
rename these too for improved similiarity:
  OPTION_OP OPT_HEADER OPT_EXTRA_TYPE OPT_TABLES
2016-02-28 18:56:25 -05:00
rlar 804efe8c42 fix name clash, OPT_OUTFILE from parse.y and from options.h
these collide:
  OPT_OUTFILE OPT_PREFIX OPT_YYCLASS
rename them TOK_... in the parser
2016-02-28 18:50:12 -05:00
Will Estes 80484ea267 Prototyped reallocarray implementation 2016-02-28 16:23:19 -05:00
Will Estes aade6607e2 Removed custom strcasecmp() function 2016-02-28 15:51:57 -05:00
rlar fd722d7030 fwrite wants a size_t, yyleng is int per posix 2016-02-28 15:21:12 -05:00
rlar bffbf1fa28 Remove some unneeded casts 2016-02-28 15:17:57 -05:00
rlar 48fa65020f warning: negative integer implicitly converted to unsigned type [-Wsign-conversion] 2016-02-28 15:15:32 -05:00
rlar e66a12bbff dfa.c:157:24: warning: conversion to 'size_t' from 'int' may change the sign of the result [-Wsign-conversion]
most certainly safe cast
2016-02-27 17:40:14 -05:00
rlar 3a132d28d9 ccl.c:86:19: warning: conversion to 'unsigned char' from 'int' may alter its value [-Wconversion]
ch seems to have been checked for proper range some lines above
2016-02-27 17:38:25 -05:00
rlar 71530afc7e warning: deprecated directive, use '%pure-parser' [-Wdeprecated] 2016-02-27 17:35:53 -05:00
rlar 9132612c2c warning: no previous prototype for 'do_nothing' [-Wmissing-prototypes] 2016-02-27 17:35:07 -05:00
rlar f691a6345d included stdlib.h header 2016-02-27 17:31:19 -05:00
Will Estes 458180116d Described more post v2.6.0 changes 2016-02-27 16:23:11 -05:00
Will Estes aa4eac68e7 build: Removed bzip2 distribiution archive 2016-02-27 15:45:34 -05:00
Will Estes 782ee061ec removed obsolete program check 2016-02-27 15:41:59 -05:00
Will Estes 0e2b8c0f95 Made some program checks more robust 2016-02-27 15:35:33 -05:00
rlar 09fd5851bc Remove unneeded cast to int 2016-02-27 14:00:55 -05:00
Will Estes a5cbe929ac Fixed incorrect integer type 2016-02-27 11:56:05 -05:00
Will Estes 7a7c3dfe1b Fix more integer types, resolves sf 184, 187 2016-02-27 09:43:00 -05:00
Robert Larice de03dfb8fa Removed some type conversion warnings 2016-02-26 20:23:05 -05:00
Will Estes a51bd6c301 Changed another buffer size to int; resolves gh#61 2016-02-26 14:23:33 -05:00
Will Estes 4a8eccf830 Changed type of yy_n_chars to int; gh#53, sf#160.
The variable yy_n_chars had been of type yy_size_t which is incorrect
given its use in read(). While it might be adviseable to look at
defining a yy_ssize_t, there might be some issues doing this and so, for
now, at least, we'll punt back to int.
2016-02-24 20:11:24 -05:00
Will Estes d2a67ba6b7 Fixed size of bufferallocation, resolved gh#54.
The value of n_alloc was a count, not a size. Multiplying the value by the element size was incorrect. That multiplication was already being done and having it done twice was incorrect.
2016-02-24 17:50:00 -05:00
Tobias Klauser dcf0226b06 Allow '%option noline' in flex input file, resolves gh#56.
Allow specifying '%option noline' in the input file, leading to the same
effect as calling flex with the command line option --noline.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-24 16:21:08 -05:00
Tobias Klauser 647a92b9f4 Emit no #line directives if gen_line_dirs is false, resolves igh#55.
There are two instances in the code which will print a #line directive
to the resulting lexer, regardless of the value of gen_line_dirs. Fix
them, so they also respect gen_line_dirs.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-24 16:19:49 -05:00
Tobias Klauser 64f2774378 Converted K&R style function definitions to ANSI C style
Consistently make use of the ANSI C function definition style instead of
the K&R style.
2016-02-16 14:52:16 +01:00
Tobias Klauser 1cc6c871f9 Used NULL constant instead of plain integer for NULL pointer.
The sparse static checker warns about using plain integer 0 as NULL
pointers in the generated lexer code. Fix this by using NULL
consistently for pointers.
2016-01-29 21:19:48 -05:00
Tobias Klauser a7ff1b23a9 Marked declaration and definition of yy_fatal_error as noreturn.
Only the declaration of yy_fatal_error is marked with
__attribute__((__noreturn__)) in case GCC >= 3 is used, but not the
definition. This leads to the sparse static checker to complain about
function declaration mismatch.

Fix it by defining a macro yynoreturn and using it for both the
declaration and the definition of yy_fatal_error.
2016-01-29 21:19:30 -05:00
Tobias Klauser 4936786fc5 Fixed declaration mismatch in yy_fatal_error.
The prototype declares yy_fatal_error parameter as "const char msg[]"
while the definition uses "const char* msg" (introduced by commit
e9d5fc713f) which causes the sparse static checkers to produce an
error.

Fix this by adjusting the definition to use "const char* msg" as well.
Also change the C++ version accordingly so it matches the declaration in
FlexLexer.hpp.
2016-01-27 17:01:14 -05:00
Will Estes 24a1589f86 flex is for flex #NCoC 2016-01-23 11:43:07 -05:00
Will Estes c351f39a2f Referred to github for issue tracking, no longer sf 2016-01-18 16:00:04 -05:00
Egor Pugin 3d1175b232 Opened files in binary mode explicitly 2016-01-10 15:43:47 -05:00
OBATA Akio 11ea8d73fc Linked flex binary against libintl, not libfl.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2016-01-08 15:23:18 -05:00
Michael van Elst 958ccda44e Improved pipe-stdin hack behavior; resolves sf#198.
Signed-off-by: Thomas <Klausner wiz@NetBSD.org>
2016-01-08 15:07:57 -05:00
Will Estes 3efb40df0e Removed no longer needed header checks 2015-12-27 14:05:51 -05:00
Will Estes 5b856d1fa3 Checked for reallocarray() with AC_REPLACE_FUNCS 2015-12-27 13:57:13 -05:00
Will Estes 5d22149d43 include libgen.h from flexdef.h, not main.c 2015-12-27 13:46:37 -05:00
Michael Reed 145968f5e2 Replace basename2() with basename(3).
Given the following program:

	\#include <libgen.h>
	\#include <stdio.h>

	/* extracts basename from path, optionally stripping the extension "\.*"
	 * (same concept as /bin/sh `basename`, but different handling of extension). */
	static char *basename2 (char *path)
	{
		char   *b;

		for (b = path; *path; path++)
			if (*path == '/')
				b = path + 1;
		return b;
	}

	static void basename_compare(char *path)
	{
		printf("basename: %s\n", basename(path));
		printf("basename2: %s\n\n", basename2(path));
	}

	int main (int argc, char *argv[])
	{
		// From http://pubs.opengroup.org/onlinepubs/9699919799/
		// ``Sample Input and Output Strings''
		basename_compare("/usr/lib");
		basename_compare("/usr/");
		basename_compare("/");
		basename_compare("///");
		basename_compare("//usr//lib//");
		return 0;
	}

... and the program's output:

	basename: lib
	basename2: lib

	basename: usr
	basename2:

	basename: /
	basename2:

	basename: /
	basename2:

	basename: lib
	basename2:

... we can see that basename2() behaves the same as basename(3) in the
average use case, but messes up pretty severely in others.  Besides
that, basename(3) is mandated by POSIX so should be present on modern
Unix-like systems, so we shouldn't define it ourselves.

Some notes:
- it doesn't appear to be mentioned in POSIX, but OpenBSD's basename(3)
  returns NULL if the returned path componenet is > PATH_MAX, so add a
  check for that
- basename(3) shouldn't return an empty string, so remove the
  program_name[0] != '\0' check
2015-12-27 13:39:45 -05:00
Michael Reed 0e00f445a9 Simplify basename2().
It's only call site does not activate the `strip_ext` code path, so the
function can be simplified a lot.  While here, remove a double
assignment.
2015-12-27 13:39:09 -05:00
Michael Reed 6fa7ed0446 Cleaned up __STDC__ #ifdefs.
Assuming a compiler conforming to the ISO C standard is used, i.e.,
__STDC__ is defined to 1, YY_USE_CONST is always defined and can be
eliminated.
2015-12-27 08:32:33 -05:00
Michael Reed 64874cd464 Remove remaining use of PROTO 2015-12-25 14:01:24 -05:00
Serguey Parkhomovsky 5f6b7645e6 buf.c: use snprintf 2015-12-21 14:40:24 -08:00
Will Estes ed855892c7 build: reformatted AC_CHECK_FUNCS for readability 2015-12-19 16:17:31 -05:00
Will Estes aebf37aa12 correct function prototype 2015-12-17 16:45:14 -05:00
Michael Reed c1c3b82b79 Remove more instances of PROTO 2015-12-15 16:11:01 -05:00
Michael Reed c918627e08 Removed prototype for main().
It's not called anywhere else so the prototype is not needed.
See the C99 standard [1], section 5.1.2.2.1 for more info.

[1]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
2015-12-15 16:05:49 -05:00
Michael McConville 559d79d0f5 Removed more instances of PROTO, ansifying. 2015-12-14 07:20:53 -05:00
Will Estes 56f558ffef Noted github for issue tracking and pull requests 2015-12-13 19:44:19 -05:00
Michael McConville 43f8adbe60 Reformatted README; removed sf bug tracking link. 2015-12-13 19:42:39 -05:00
Michael McConville bfdef978fc Removed macros for indentation level.
Just increment or decrement the indentation counter. That's less to
remember and makes the code more readable.

w# Please enter the commit message for your changes. Lines starting
2015-12-13 19:25:23 -05:00
Mike Frysinger 4082a04921 tests: fixed paths to input files.
The current test wrapper works only when the inputs are specified using
relative paths.  If they're specified with absolute paths, the driver
fails to detect the inputs because it always prepends the input dir name
which itself is a relative path:
$ cd tests
$ ./testwrapper.sh -d . -i $PWD/reject.txt -t ./reject_ver.table
<fails to open inputs>

This normally doesn't show up because people run `./configure` or, for
out of tree builds, `../configure`.  But if you happen to run configure
with an absolute path, then automake tends to generate absolute paths
as well leading to test failures.

Fix all of this by dropping the implicit input directory prepending.

- INPUT_NAME is often a list of files, not just a single one
- the input directory is used to find the testname tables which are
  usually generated, so it's impossible to use files from both source
  and build directories
- most of the time, the full/correct path is already specified
2015-12-13 19:02:51 -05:00
Mike Frysinger ff622ae961 configure: fixed realloc test.
The [] characters are used for quoting in m4, so the attempt to use
them in place of `test` fails yielding the warning at build time:

.../flex/configure: line 20222: no: command not found
2015-12-13 19:01:29 -05:00
Michael McConville 9acbb870c1 Started removal of PROTO macro.
The PROTO macro is no longer needed. Additionally, its usage is inconsistent,
so we began removing it.
2015-12-12 18:01:13 -05:00
Michael Reed e05e093047 Removed SHORT_FILE_NAMES preprocessor symbol.
As a relic of MS-DOS, we don't need this.

It's never defined; see 13b5b214f5.

Removed additional MSDOS ifdef.
2015-12-12 15:40:58 -05:00
Michael McConville 77e54b25ee Added new function reallocarray.
This is taken from OpenSSH Portable, which in turn takes it from
OpenBSD.

reallocarray wraps the stdlib's realloc function. It takes two size
arguments and checks for overflow, like calloc, but doesn't zero the
memory. Therefore, it allows us to do overflow-safe array reallocations
and overflow-safe unzeroed array allocations, which the stdlib
allocation functions don't.

We have a bunch of specific array allocation macros, none of
which check for overflow. reallocarray should be able to replace them.
2015-12-12 15:25:40 -05:00
Michael McConville 13b5b214f5 Removed MS-DOS, VMS macros.
Given the age of the MS-DOS and VMS platforms, it's likely that no one is building flex on them any more. Additionally, the preferred approach is to test for particular platform features rather than to test for particular platforms.
2015-12-12 14:19:37 -05:00
Will Estes c34590c4bf Made search for m4 more explicit. 2015-12-12 11:03:05 -05:00
Will Estes f863c9490e Returned 0 from yywrap() instead of EOF 2015-12-12 07:35:23 -05:00
Will Estes 3a4af3424c Changed end of main() in libmain to exit(0) 2015-12-11 20:25:50 -05:00
Will Estes 965c9fa979 Mentioned v2.6.1; documented some changes since v2.6.0 2015-12-11 10:57:46 -05:00
Will Estes 6f9cbd4af1 Updated build documentation; finished sf#155.
Removed version numbers for build tools. Noted that version requirements for build tools will be noted in configure.ac. Expanded documentation of building texinfo based docs.
2015-12-11 10:41:08 -05:00
Will Estes e5e5fb59c9 Removed flex.pdf from distribution; partially fixed sf#155 2015-12-11 10:40:34 -05:00
Will Estes 07d89829cc Commented in C style in skeleton; fixed sf#195 2015-12-11 09:45:14 -05:00
Will Estes 1e13e9656b Ignored autoscan files 2015-12-10 10:05:59 -05:00
Will Estes d4e8f383e8 Checked for ranlib and strdup() at configure time 2015-12-09 19:39:20 -05:00
Michael McConville 8205442c7c Replace zero_out() with stdlib's memset. 2015-12-09 17:44:33 -05:00
Michael McConville 3d08a01292 Removed memory allocation casts. 2015-12-09 17:33:58 -05:00
Michael McConville 0dfcb6228f Removed alloca() configuration.
Since alloca() is dangerous, depricated, we remove it.
2015-12-09 15:54:02 -05:00
Michael McConville d41be27501 Removed implementation of isascii().
POSIX defines isascii(), so it's likely present on anything weactually build flex on these days.
2015-12-09 15:36:18 -05:00
Michael McConville 7969134687 Removed NULL-checks before free() 2015-12-09 13:15:08 -05:00
Michael McConville d95947343e Removed flex_free()i, corrected buf_destroy logic.
As with flex_alloc(), replace with direct calls to free().

The function buf_destroy is now null safe and the logic was corrected to free()
correctly.
2015-12-09 09:53:57 -05:00
Michael McConville 1cc5d87032 Removed flex_realloc().
As with flex_alloc(), replace calls to flex_realloc(), which was just a
wrapper around realloc().
2015-12-09 09:51:17 -05:00
Michael McConville c53d722b0b Removed flex_alloc; cleaned up style.
The function flex_alloc() was just a wrapper around malloc(). Since this only added unclarity, and the flex_alloc() function is likely a legacy of olden times, remove it in favor of calls to malloc() directly.

Style elements cleaned up:

 * superfluous spacing around parentheses
 * non-constant initialization in variable declarations
 * needless casts
 * almost all uses of assignments as subexpressions
2015-12-09 09:48:39 -05:00
Michael McConville c03bef5411 Remove allocation casts 2015-12-07 21:28:21 -05:00
Will Estes 53e3088d75 Built flex with itself.
Changes in scan.l need to be built into flex with the same version of
flex in some cases. Since this build requirement is minimal, we simply
bootstrap flex unconditionally.

We intentionally exclude from version control the bootstrap artifacts as
the extra copy of the lexer, the intermediate scanner and the bootstrap
executable are not of interest.
2015-12-07 15:37:01 -05:00
Michael McConville e0877888da Use NULL rather than (type *) 0. 2015-12-05 18:50:53 -05:00
Michael McConville 3a1d84cfc0 Replace copy_unsigned_string() with xstrdup().
Like copy_string(), copy_unsigned_string() is just a clone of the
stlib's strdup(). We only use it twice. I'm pretty confident that char
signedness is irrelevant in this case.
2015-12-05 17:42:40 -05:00
Akim Demaille a562291415 Cleaned up white space. 2015-12-05 06:01:48 -05:00
Akim Demaille 35a307f959 Removed struct keyword before yy_buffer_state 2015-12-05 05:49:51 -05:00
Akim Demaille 004399be12 Replaced FLEX_STD macro with std::.
The std:: construct exists as of C++98, so we can simply assume it is
supported.
2015-12-05 05:46:19 -05:00
Akim Demaille 4cea6bfe54 Generated skel.c explicitly in srcdir.
Rewrote the target for skel.c to explicitly mention the srcdir. This
should help when building flex from a directory outside the flex
tree. Spread the rule out over several lines to enhance readability.
2015-12-04 15:07:11 -05:00
Akim Demaille 7ddfe81aa8 Called glibtoolize if libtoolize run fails.
On Mac OS X, libtoolize is known as glibtoolize. In cases where libtoolize is not present, then calling glibtoolize when bootstrapping the build system gives more folks a shot at getting flex built from the ground up.
2015-12-04 14:59:54 -05:00
Mightyjo 9e24fe5ea9 Checked for (g)texi2dvi. Better bison, help2man checks.
Added test for presence of (g)texi2dvi program. Gave notice if texi2dvi
is unavailable and set TEXI2DVI=: to avoid giving users headaches.

Enhanced tests for bison and help2man with notices when the programs
aren't found.  Set their program variables to use the missing script
in build-aux since it's compatible with them.
2015-12-03 07:21:48 -05:00
Michael McConville 399e94f904 Made string copying more standard.
copy_string() was a clone of the stdlib's strdup(). For safety,
simplicity, and speed, we should use that instead. We introduce xstrdup() which wraps strdup() in a failure upon memory allocation errors.
2015-12-02 14:39:09 -05:00
Serguey Parkhomovsky 9ba6e5283e Error on unbalanced parentheses in rules section. 2015-11-30 19:33:32 -05:00
Will Estes f1d53eb001 Cleaned up BUILT_SOURCES list.
Removed reference to skel.c as a built source since other make rules cover this case.
2015-11-29 19:43:05 -05:00
Will Estes 9e1ec519f4 Sorted file names in flex_SOURCES 2015-11-29 19:30:19 -05:00
Mightyjo a97cf48486 Replaced CHAR macro with unsigned char type.
Thanks to Michael McConville for pointing out that the old Char macro
causes problems with static analysis.  The macro has been removed and
replaced with 'unsigned char' throughout the flex sources. The macro is
not needed at best and was confusing at worst. It was not used in any of
the example files nor was it mentioned in the manual at all.
2015-11-29 17:20:22 -05:00
Will Estes 45db9033fe updated syntax of AC_INIT call as per autoupdate 2015-11-21 13:15:53 -05:00
Will Estes 3bc38e963e removed extra call to a _CPPFLAGS variable 2015-11-21 13:12:58 -05:00
Stefan Reinauer 0f7b9136ed Switch function definitions from mixed K&R to consistent ANSI C.
flex was using K&R function definitions for some functions and
ANSI C style in others, sometimes even in the same file. Change
the code to consistently use ANSI C.

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-11-19 19:26:07 -05:00
Mightyjo 09eae589d3 Used in-tree header file for c++ tests. 2015-11-18 15:03:03 -05:00
Will Estes 83d5d1695a Declared version 2.6.0 2015-11-17 11:16:43 -05:00
Will Estes d34b6160af Dated, described flex release 2.6.0 2015-11-17 11:14:05 -05:00
Will Estes 5263986825 Declared version 2.6.0rc1 2015-11-13 14:56:25 -05:00
lukeallardyce 54201ab377 Supplied versioning information in flex libraries.
Resolves sourceforge bug #182. On OSX, and possibly other platforms, building the libfl libraries without versioning information caused a build failures.
2015-11-13 14:48:19 -05:00
Will Estes 0be145eea8 Cleaned up more precisely after make check.
BUILT_SOURCES is now just the list of headers built as per the
automake manual. We provide the list of files to clean to make
rebuilding the test suite programs easier. We then use the CLEANFILES
list in a dist-hook to clean up the distribution that automake gathers
since not distributing flex generated files is foreign to automake's
mindset, but we need exactly that.

Additionally, we locate inputs to the tables-related tests more
precisely. Some files are in srcdir and some are in builddir, which
the arguments to the log compiler are now made aware of.
2015-11-12 21:44:07 -05:00
Will Estes 4864c4f23a Pulled out scripts in tests/Makefile.am 2015-11-11 19:08:26 -05:00
Will Estes 83006c65f8 Added srcdir to tableopts.am include 2015-11-11 18:22:17 -05:00
Will Estes b54685ff22 Changed man page dependencies.
The man page is just the --help output as reformatted by help2man. The
--help option is most likely to change when the flex skeleton changes
or one of the option parsing files changes or the configure.ac script
itself changes. The dependencies reflect this now.

It is still necessary, under some circumstances, to rebuild flex
explicitly before building the man page. In theory, it's possible to
have automake arrange to do this all the time, but doing so works out
to be fragile, given the rest of the build system.
2015-11-11 15:20:56 -05:00
Will Estes 589bb43094 Called libtoolize directly because autoreconf fails to pick up LT_INIT properly 2015-11-10 17:26:39 -05:00
Will Estes b382a56bf3 Added tableopts.sh to EXTRA_DIST 2015-11-10 17:24:28 -05:00
Mightyjo 461f987f09 Made tests depend on the built flex binary. 2015-11-10 14:28:17 -05:00
Mightyjo a6ceb756d9 Merge branch 'master' into streamrefs 2015-11-08 15:43:09 -08:00
Mightyjo cf6cb4dce7 Cleaned more generated sources.
Added skel.c explicitly to MAINTAINERCLEANFILES in src/Makefile.am.

Added a bunch of files to built_SOURCES in tests/Makefile.am so that the
suite is easier to clean up.
2015-11-08 14:59:29 -05:00
Mightyjo 1f4c0e67fe Updated documentation to reflect the revisions to FlexLexer.h 2015-11-07 23:28:09 -08:00
Mightyjo 336a1deaa5 Changed several pointers to istream (and ostream) to references in c++-only sections of the skeleton.
Patched up a variety of expected errors caused by changing istream* to istream&.

Added a stray 'make' at line 545.  Oops.

Changed the buffer_state struct to store std::streambuf* instead of std::istream* for C++ mode.  Changed interfaces in FlexLexer.h to take std::istream& instead of *.  Backward compatibility temporarily broken.

Patched up backward compatibility with reasonable behavior in the presence of null pointers.

Re-added backward-compatible versions of the yyFlexLexer methods that take iostream pointers.  All tests passing.
2015-11-07 23:25:24 -08:00
Translation Project 5acd407ed4 new zh_CN translation from the translation project 2015-09-29 15:53:33 -04:00
Jaska Uimonen b4b8b7ed81 fix possible resource leak with yynultrans_tbl 2015-08-06 09:28:21 -04:00
Jaska Uimonen 5f23fc0033 fix possible uninitialized array values 2015-08-06 09:27:30 -04:00
Will Estes 4f2ae90b28 add %{...%} block to example in manual 2015-08-05 15:27:37 -04:00
Will Estes b6fa146a0f initialize libtool earlier in build system generation 2015-07-15 15:20:11 -04:00
Translation Project 341bfbd389 new da translation from the Translation Project 2015-05-08 15:15:56 -04:00
486 changed files with 30752 additions and 83103 deletions
-23
View File
@@ -1,23 +0,0 @@
*.orig
*.rej
*.tar.bz2
*.tar.gz
*.tar.xz
*~
.deps
.libs
ABOUT-NLS
ChangeLog
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.log
config.status
configure
flex-*/
libtool
stamp-*
m4/
build-aux/
Vendored
-15
View File
@@ -1,15 +0,0 @@
--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
-16
View File
@@ -1,16 +0,0 @@
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.
-107
View File
@@ -1,107 +0,0 @@
This is a list of bugs still in the queue at lex.sf.net at the time we closed
out the project and moved it to flex.sf.net.
-------------------------------------------------------------
Some strict compilers warn about a few internal flex variables signedness. They
are bogus warnings and can be ignored, but people send in reports nonethless.
-------------------------------------------------------------
The initializer of the yy_transition array in the
generated scanner
contains fewer entries than the declared size of the array.
Examples include yy_transition[6504] with 6250 entries,
yy_transition[13215] with 12961 entries. This looks
like it
is always 254 fewer entries than the declared size.
This bug is present in flex 2.5.4a as well. It appears to be harmless.
-------------------------------------------------------------
The examples in the chapter "Generating C++ Scanners"
contain suspicious code. Attached is a patch that
corrects this, and after these
modifications this example compiles and works.
-------------------------------------------------------------
C++ scanners derived from the yyFlexLexer base class
will not compile with flex-2.5.31 because the
&lt;FlexLexer.h&gt; automatically gets included into the
scanner twice. Because yyFlexLexer is now defined by
default even if no prefix is specified, including
FlexLexer.h twice causes the class yyFlexLexer to be
declared twice. In flex-2.5.4 because yyFlexLexer was
not defined by flex in the scanner code, including
FlexLexer.h more than once only declared yyFlexLexer
once. I appreciate that this is because of the M4
additions to flex, but I can not find a way to stop
flex defining yyFlexLexer if it is not needed.
Here is an example of a class that will not compile:
derived_lexer.h:
#ifndef __derived_lexer__
#define __derived_lexer__
#include &lt;FlexLexer.h&gt;
class derived_lexer : public yyFlexLexer
{
public:
derived_lexer(std::istream* arg_yyin = 0) :
yyFlexLexer(arg_yyin){}
int yylex();
int x;
};
#endif
derived_lexer.l:
%{
#include &quot;derived_lexer.h&quot;
%}
%option yyclass=&quot;derived_lexer&quot;
%%
[0-9]+ {
x = atoi(yytext);
}
%%
main.cpp:
#include &quot;derived_lexer.h&quot;
#include &lt;fstream&gt;
int main()
{
std::ifstream input;
input.open(&quot;input&quot;);
derived_lexer lexer(&amp;input);
lexer.yylex();
}
-------------------------------------------------------------
Hi, the anomally is that if I generate a c++ parser it will not make
yy_scan_buffer and friends.
this is happenning on flex version 2.5.4.
Is this the intent, if so how do I make a c++ parser read from my buffer?
P.S. in c++ it will only generate:
#ifndef YY_NO_SCAN_BUFFER
#endif
#ifndef YY_NO_SCAN_STRING
#endif
#ifndef YY_NO_SCAN_BYTES
#endif
-------------------------------------------------------------
-42
View File
@@ -1,42 +0,0 @@
Flex carries the copyright used for BSD software, slightly modified
because it originated at the Lawrence Berkeley (not Livermore!) Laboratory,
which operates under a contract with the Department of Energy:
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The Flex Project.
Copyright (c) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
This basically says "do whatever you please with this software except
remove this notice or take advantage of the University's (or the flex
authors') name".
Note that the "flex.skl" scanner skeleton carries no copyright notice.
You are free to do whatever you please with scanners generated using flex;
for them, you are not even bound by the above copyright.
-70
View File
@@ -1,70 +0,0 @@
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
# Notes on building:
# Possible values for DEFS:
#
# By default, flex generates 8-bit scanners when using table compression,
# and 7-bit scanners when using uncompressed tables (-f or -F options).
# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
# to DEFS.
#
# For Vax/VMS, add "-DVMS" to DEFS.
#
# For MS-DOS, add "-DMS_DOS" to DEFS. See the directory MISC/MSDOS for
# additional info.
ACLOCAL_AMFLAGS = -I m4
indent = @INDENT@
dist_doc_DATA = \
AUTHORS \
COPYING \
NEWS \
ONEWS \
README
EXTRA_DIST = \
.indent.pro \
autogen.sh
SUBDIRS = \
lib \
src \
doc \
examples \
po \
tests \
tools
# Create the ChangeLog, but only if we're inside a git working directory
ChangeLog: $(srcdir)/tools/git2cl
if [ -d $(srcdir)/.git ] ; then \
$(srcdir)/tools/git2cl > $@ \
; fi
install-exec-hook:
cd $(DESTDIR)$(bindir) && \
$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
.PHONY: ChangeLog tags indent
-534
View File
@@ -1,534 +0,0 @@
This is the file NEWS for the flex package. It records user -visible
changes between releases of flex.
See the file COPYING for copying conditions.
* version 2.6.0-pre
* flex version 2.5.39 released 2014-03-26
** no user visible changes in this release
* version 2.5.38 released 2014-02-14
** internationalization
*** add sr translation from the translation project
*** update da, es, ko, nl, pt_BR, ro, ru, sv, tr, vi, zh_CN translations from the translation project
*** rename zh_tw to its proper zh_TW name
* version 2.5.37 released 2012-08-03
** Import flex into git. See
git://flex.git.sourceforge.net/gitroot/flex/flex.
** Fix make install target to not fail when the flex++ program is
already installed
** New translations from the translation project: de, fi, pl, vi
* version 2.5.36 released 2012-07-20
** various portability fixes that quiet compiler warnings on 64-bit
hosts
** various manual fixes, including correcting the name of a %option and
updating some simple examples to use ANSI C syntax
** various bug fixes that prevent certain error conditions from
persisting when they should not persist
** improvements to the test suite so it behaves better when linking
compiled files
** new translations from the translation project: ca, da, es, fi, fr,
ga, ko, pt_br, ro, ru, sv, tr, zh_cn
** the flex distribution is now built with automake 1.10.1 and automake
2.61
* version 2.5.35 released 2008-02-26
** fixed bug that prevented flex from accepting certain comments in the
scanner file (resolves bugs #1849809 and #1849805)
** fix bug that prevented headers for all functions from being generated
(resolves bug #1628314)
** change yy_size_t to be size_t (resolves bug #1849812)
** new de, nl, pl, pt_br, vi translations from the translation project
* version 2.5.34 released 2007-12-12
** introduce yylex_init_extra; see the manual for details
** introduce %option extra-type="your_type *" (resolves bug #1744505)
** The flex program now parses multiple short concatenated options (resolves bug
#1619820). Thanks to Petr Machata of Red Hat on this issue.
** better checking after yyalloc/yyrealloc (resolves bug #1595967)
** flex now provides for a libfl_pic.a compiled with position
independent code. Particularly useful when including a flex scanner
in a shared library and with more recent versions of gcc. Thanks to the Debian project for the idea.
** SourceForge feature request #1658379: Expose YY_BUF_SIZE in the
header file.
** flex better escapes filenames with special characters in them
(resolves bug #1623600)
** a memory leak was plugged(resolves bug #1601111)
** pattern language expanded; see the manual for details on the below
highlights
*** pattern options added to specify patterns as case-insensitive or
case-sensitive
*** pattern options to specify whether the "." character should match
the newline character
*** pattern options added to allow ignoring of whitespace in patterns
*** POSIX character classes may be negated in patterns
*** patterns may now use set difference, union operators
** the manual now contains an appendix listing various common patterns
which may be useful when writing scanners
** some memory leaks were removed from the C++ scanner (but the C++
scanner is still experimental and may change radically without
notice)
** c++ scanners can now use yywrap
** added new unit test for c++ and yywrap
** portability fixes to some unit tests
** flex man page and flex manual in pdf now distributed in the flex
distribution
** new ca, vi, ga, nl translations from the translation project
** flex no longer comes with an rpm spec file
** flex development now happens with automake 1.9.6
* version 2.5.33 released 2006-2-20
** all flex resources are now to be found from the website at
http://flex.sourceforge.net/
** there was no release 2.5.32 published
** numerous bug and security fixes
** new nl, vi, sv, ro, po, ga, ca, fr, tr translations from the translation project
** upgrade to use gettext 0.12 (this now makes the "pdf" and "ps"
targets in the build system able to be run successfully)
* version 2.5.31 released 2003-4-1
** remove --enable-maintainer-mode configure option; none of the
Makefiles were using it and it can be unduely confusing
* version 2.5.30 released 2003-4-1
** yylineno is per-buffer in reentrant scanners
** added %top directive for placing code at the top of the generated
scanner; see manual for details
** flex now uses m4 to generate scanners; while this means that
scanners are more readable, it means that flex requires m4 to be
installed; see manual for details
* version 2.5.29 released 2003-3-5
** Automatic stack management for multiple input buffers in C and C++ scanners
** moved the flex documentation to a new doc/ subdirectory
** cleanups to the yy namespace
* version 2.5.28 released 2003-2-12
** flex is now hosted at sourceforge
** Fixed trailing slash bug in YY_INPUT macro def
** Flex now warns if always-interactive is specified with fast or full
* version 2.5.27 released 2003-1-21
** flex now works with recent bison versions
** new pt_br translation from the translation project
* version 2.5.26 released 2003-1-14
** Fixed table deserialization bug on big-endian archs. Patch sent from Bryce Nichols <bryce@bnichols.org>
** yyleng has proper declarations now; this caused flex to generate
unusable scanners for some programs
** the flex distribution now includes a spec file suitable for use
with rpm
** some more c++ fixes
** new es translation from the translation project
** slight tweeks to the flex_int*_t types
** flex now warns about pattern ranges that might be ambiguous when
generating a case-insensitive scanner
* version 2.5.25 released 2002-12-2
** flex now uses flex_int*_t types. For C99 systems, they are just the
int*_t types; for non-C99 systems, we just make some typedefs
** new pt_br translation from the translation project
* version 2.5.24 released 2002-11-25
* more portability fixes
** the manual continues to be updated and edited, but it's still got a
ways to go
** it is possible to have multiple c++ scanners in the same program again
** new turkish translation from the translation project
* version 2.5.23 released 2002-10-21
** more portability fixes
** the manual includes a title page and a table-of-contents when printed
** the test suite can be run with "make check" from the top-level
directory
** configure now accepts the --enable-maintainer-mode option
** gettext functionality is now only available externally
** the constant FLEX_BETA is defined if flex is a beta release
** the script create-test was not included in the distribution and it
should have been
* version 2.5.22 released 2002-10-10
** more portability fixes around how we get ahold of the integral
types; there is a constant FLEX_NEED_INTEGRAL_TYPE_DEFINITIONS
which you should define if you don't have the <inttypes.h> header
file (after you complain to your C vendor for not providing a
reasonable C environment)
** more test suite cleanups; in particular, the test suite should run
correctly when build from a different directory
** upgraded automake to 1.7 and consequently autoconf to 2.54; this
means, among other things, that there is some support for
formatting the manual in postscript and pdf in the distributed
Makefile.in (and therefore in the Makefile built by configure)
** the flex.1 manpage is generated by help2man; (this has been true
for quite a while but was not listed here)
** flex now includes three defined constants to indicate which version
of flex generated a scanner (YY_FLEX_{MAJOR,MINOR,SUBMINOR}_VERSION)
** flex tries its best to output only the relevant portions of the
skeleton when generating a scanner, thus avoiding as much
conditional compilation as possible
* version 2.5.21 released 2002-9-17
** one of the tests in the test suite broke the dist target
* version 2.5.20 released 2002-9-16
** A flex scanner has the ability to save the DFA tables to a file,
and load them at runtime when needed; see the manual for details
** Added %option bison-bridge (--bison-bridge)
** Removed %option reentrant-bison/--reentrant-bison/-Rb
** yylineno is present in all scanners; Modified nasty performance
penalty warning with yylineno in documentation
** test-table-opts is now run last in the test suite because it's so fat
** flex can, to some extent, diagnose where internal problems occur
** new translations from the translation project: fr, ca, de, ru, sv
**Flex generates C99 defs now; see YY_TRADITIONAL_FUNC_DEFS in the
manual if that's not a good thing for you
* version 2.5.19 released 2002-9-5
** prevent segfault on input lines which are longer than the allocated
space (problem report from Manoj Srivastava
<srivasta@golden-gryphon.com>)
** Changed option 'header' to 'header-file'
* version 2.5.18 released 2002-9-4
** portability fixes for integer constants and in the way the test
suite reports its results
** the test for bison was reporting bison missing when it was, in
fact, found
** if we don't find GNU indent, we're more careful when we're not
finding it
* version 2.5.17 released 2002-8-29
** more portability fixes
** updated config.sub and config.guess
** flex is indented by GNU indent (this was done earlier but not
explicitly documented)
* version 2.5.16 released 2002-8-28
** c++ scanners compile again
** there is now an indent target in the top-level Makefile; configure
checks for GNU indent which is required for proper operation of the
indent target
** some more portability fixes were made
** %options and invocation sections of manual merged
** a c++ test was added to the test suite
** we're trying to clean up more files in the test suite's make clean
targets
* version 2.5.15 released 2002-8-21
** reject-state buffer is now dynamically allocated and REJECT buffer
variables are reentrant-safe
** manual now discusses memory usage
** skeleton now processed by m4 before mkskel.sh; (this only matters
if you want to change the skeleton or if you're doing flex development)
** zh_cn translation added from translation project
** a bug that caused a segfault has now been fixed
** the test suite now respects the usual CFLAGS, etc. variables
** removed some warnings which some tests trigggered with the -s option
** the flex-generated header file now tries to be smarter about
conditionally including start conditions
** tables code omitted from generated scanner when not used
* version 2.5.14 released 2002-8-15
** the tests using the reentrant c scanner as c++ were reworked
slightly to be sure that the c++ was enforced
** de translation now included in the distribution
** various portability fixes regarding nls support, c++ include
headers, etc.
* version 2.5.13 released 2002-8-15
** the header file output with %option header is now much smaller
** Fixed type mismatch in printf in scanner skeleton
** yylex_init now reports errors
* version 2.5.12 released 2002-8-8
** updated gettext support to 0.11.5
** new fr translation from the translation project
** bison is no longer needed to build flex; If you are building flex
from a release (i.e., not from a cvs snapshot), then you don't need
to have a pre-built lex around either (unless you modify scan.l, of
course); (This has been true for some time, but was not mentioned
here.)
* version 2.5.11 released 2002-7-31
** Fixed bug where yyless did not consider yylineno
** the yylineno performance hit is now gone
** fixed some typos in the manual and we now include texinfo.tex in
the distribution
** traditional prototypes output for C scanners, controlled by a
preprocessor symbol; see documentation for details
* version 2.5.10 released 2002-7-24
** yy_globals renamed to yyscanner and yy_globals_t renamed to
yy_guts_t
** added dist-bzip2 option to Makefile.am so we now produce a bzip2'd
archive in addition to the standard gzip archive
* version 2.5.9
** new tests in test suite: test-mem-{nr,r}, test-posix,
test-posixly-correct, test-debug-{nr,r}
** made changes to work with gcc-3.2 development code
** ability to choose which memory functions are used in flex
** new yylex_destroy() function for the non-reentrant scanner
** new handling of POSIXLY_CORRECT environment variable
** the test suite now has its copyrights explicitly described
** new ca, de, fr, ru, sv, tr translations
* version 2.5.8
** a new --posix option generates scanners with posix-style abc{1,3}
compatible parsing, see manual for the screwy details
* version 2.5.7
** configure.in now includes a call to AC_PREREQ to enforce the
requirement for autoconf at least 2.50 (This only effects you if
you're doing flex development.)
** configure now uses autoconf's versioning information and configure
--help reports the bug-reporting address for flex
** test suite now only reports success versus failure; reporting
skipped is problematic under the current setup
** compilation with --disable-nls now works
** flex can now be built in a separate directory
* version 2.5.6
** gettext support added (from gettext 0.11)
*** translations for ca, da, de, es, fr, ko, ru, sv, tr included
** distribution now built under automake 1.6 and autoconf 2.53
** command-line option parsing happens differently now:
*** Added long option parsing
*** Options -n and -c, previously deprecated, now simply do nothing
*** Options are now parsed left to right
** added a number of new options
*** All positive %options are now accessible from the command line
*** Added option -D, to define a preprocessor symbol
*** Added option --header=FILE to specify a C .h file to generate
*** added option --yywrap to call yywrap on EOF
*** added option --yylineno to track line count in yylineno
*** --yyclass=NAME name of C++ class when generating c++ scanners
*** for long option names which are associated with existing short
options, see accompanying documentation
*** new %option nounistd or command-line --nounistd added to prevent
flex from generating #include <unistd.h> on systems that don't
have that include file
** Support for reentrant C scanners has been added
*** Updated the manual with the new reentrant API
*** Two new options %option reentrant (-R) and
%option reentrant-bison (-Rb)
*** All globals optionally placed into struct yyglobals_t
*** All access to globals replaced by macro invocations
*** All functions optionally take one additional
argument, yy_globals
*** New style for invoking reentrant scanner:
yylex_init(void** scanner );
yylex( scanner );
yylex_destroy( scanner );
*** Added get/set functions for members of struct yy_globals_t
e.g., yyget_text, yyget_leng, etc
*** Prefix substitution added for new functions
*** Macro shortcuts to the lengthy get/set functions
provided for use in actions, e.g., yytext, yyleng, etc
*** Arbitrary, user-defined data, "yyextra", may be added to scanner
** %option nomain no longer implies %option yywrap
But the inverse is still true
** Developer test suite added
*** TESTS/ directory has been added. Users can
'make test' in the TESTS directory to execute the test suite
** Support for bison variables yylval and yylloc added
** automake support for the build process
** manual is now in texinfo/info format
*** flex.1 removed from distribution
** flex no longer generates C-language scanners with C++-style
comments
** flex now generates scanners in c++ which are compatible with
recent c++ compilers
** flex input scanner now recognizes '\r' as an EOL character
See the file ONEWS for changes in earlier releases.
Local Variables:
mode: text
mode: outline-minor
end:
-1233
View File
File diff suppressed because it is too large Load Diff
-113
View File
@@ -1,113 +0,0 @@
This is flex, the fast lexical analyzer generator.
flex is a tool for generating scanners: programs which recognize
lexical patterns in text.
More information about flex as well as the latest official release of
flex can be found at:
http://flex.sourceforge.net/
Bug reports should be submitted using the SourceForge Bug Tracker for
flex at:
http://sourceforge.net/tracker/?group_id=97492&atid=618177
The flex codebase is kept in git at:
https://github.com/westes/flex
There are several mailing lists available as well:
flex-announce@lists.sourceforge.net - where posts will be made
announcing new releases of flex.
flex-help@lists.sourceforge.net - where you can post questions about
using flex
flex-devel@lists.sourceforge.net - where you can discuss development of
flex itself
Find information on subscribing to the mailing lists at:
http://sourceforge.net/mail/?group_id=97492
The flex distribution contains the following files which may be of interest:
README - This file.
NEWS - current version number and list of user-visible changes.
INSTALL - basic installation information.
ABOUT-NLS - description of internationalization support in flex.
COPYING - flex's copyright and license.
doc/ - user documentation.
examples/ - containing examples of some possible flex scanners and a
few other things. See the file examples/README for more details.
TODO - outstanding bug reports, desired features, etc.
tests/ - regression tests. See TESTS/README for details.
po/ - internationalization support files.
You need the following tools to build flex from the maintainer's
repository:
compiler suite - flex is built with gcc
bash, or a good Bourne-style shell
m4 - m4 -p needs to work; GNU m4 and a few others are suitable
GNU bison; to generate parse.c from parse.y
autoconf 2.69; for handling the build system
automake 1.12.2; for Makefile generation
gettext 0.18; fori18n support
help2man 1.36; to generate the flex man page
tar, gzip, etc.; for packaging of the source distribution
GNU texinfo 498; to build and test the flex manual
GNU indent 2.8; for indenting the flex source the way we want it done
Once you have all the necessary tools installed, life becomes
simple. To prepare the flex tree for building, run the script:
$ ./autogen.sh
in the top level of the flex source tree.
This script calls the various tools needed to get flex ready for the
GNU-style configure script to be able to work.
From this point on, building flex follows the usual configure, make,
make install routine.
This file is part of flex.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
-53
View File
@@ -1,53 +0,0 @@
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.
-66
View File
@@ -1,66 +0,0 @@
* the manual:
** do an end-to-end proofread of the manual (this is under way, but is
going slowly)
** pretty up the dvi output; overflows, etc.
** faq
*** clean up the faqs section. The information is good; the texinfo
could use some touching up.
*** index the faq entries
*** mention that it's possible to use a variable to scan matching
brackets, nested comments etc.
*** include something about lexing/parsing fortran
** create a section on flex design, features, etc.
* getext
** make sure all flex modules use gettext translation facilities
*subdirectories
** in examples/manual, integrate the Makefile.examples into the
Makefile.am
* test suite
** integrate the test suite into automake's framework (note that the
test suite can be run from the top level directory with "make
check". Still, we want to get it completely under automake's control.)
** make test suite more complete
* generic coding
** move as much skeleton code as possible out of gen.c and into
flex.skl
** figure out whether we want to add the capability to have
auto-generated backout rules
** token-type and token buffer support
** check if we still need to #undef macros at the end of a header
** merge yylineno into support for location tracking
** bug where yylineno is not decremented on REJECT
** bug where yylineno is counted in trailing context
* C++
** have a separate skeleton for c++
** revisit the C++ API. We get requests to make it more complete.
Local Variables:
Mode: text
mode: outline-minor
End:
-32
View File
@@ -1,32 +0,0 @@
#!/bin/sh
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
# If you see no configure script, then run ./autogen.sh to create it
# and procede with the "normal" build procedures.
#if we pretend to have a ChangeLog, then automake is less
#worried. (Don't worry, we *do* have a ChangeLog, we just need the
#Makefile first.)
touch ChangeLog
autoreconf --install --verbose --force
-128
View File
@@ -1,128 +0,0 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# This file is part of flex.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
# autoconf requirements and initialization
AC_INIT([the fast lexical analyser generator], [2.6.0-pre],
[flex-help@lists.sourceforge.net], [flex])
AC_CONFIG_SRCDIR([src/scan.l])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([gnu check-news std-options dist-bzip2 dist-xz parallel-tests 1.14.1])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_LIBOBJ_DIR([lib])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
SHARED_VERSION_INFO="2:0:0"
AC_SUBST(SHARED_VERSION_INFO)
# checks for programs
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19])
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_INSTALL
AC_PATH_PROG(BISON, bison,bison)
AC_PATH_PROG(HELP2MAN, help2man, help2man)
# Check for a m4 that supports -P
AC_CACHE_CHECK([for m4 that supports -P], [ac_cv_path_M4],
[AC_PATH_PROGS_FEATURE_CHECK([M4], [gm4 gnum4 m4],
[[m4out=`echo 'm''4_divnum' | $ac_path_M4 -P`]
[test "x$m4out" = x0 \
&& ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
[AC_MSG_ERROR([could not find m4 that supports -P])])])
AC_SUBST([M4], [$ac_cv_path_M4])
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the m4 executable name.])
AC_PATH_PROG(INDENT, indent, indent)
# if INDENT is set to 'indent' then we didn't find indent
if test "$INDENT" != indent ; then
AC_MSG_CHECKING(if $INDENT is GNU indent)
if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN($INDENT does not appear to be GNU indent.)
fi
else
AC_MSG_WARN(no indent program found: make indent target will not function)
fi
# checks for headers
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h regex.h stddef.h stdlib.h string.h strings.h unistd.h])
# checks for libraries
# The test test-pthread uses libpthread, so we check for it here, but
# all we need is the preprocessor symbol defined since we don't need
# LIBS to include libpthread for building flex.
AC_CHECK_LIB(pthread, pthread_mutex_lock,
AC_DEFINE([HAVE_LIBPTHREAD], 1, [pthread library] ),
AC_DEFINE([HAVE_LIBPTHREAD], 0, [pthread library] )
)
AC_CHECK_HEADERS([pthread.h])
AM_CONDITIONAL([want_pthread], [test x$ac_cv_lib_pthread_pthread_mutex_lock = xyes])
AC_CHECK_LIB(m, log10)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol])
AC_CONFIG_FILES(
Makefile
doc/Makefile
examples/Makefile
examples/fastwc/Makefile
examples/manual/Makefile
lib/Makefile
po/Makefile.in
src/Makefile
tools/Makefile
tests/Makefile
)
AC_OUTPUT
-1
View File
@@ -1 +0,0 @@
XBS-Destinations: sourceforge
-27
View File
@@ -1,27 +0,0 @@
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
-31
View File
@@ -1,31 +0,0 @@
help2man = @HELP2MAN@
info_TEXINFOS = flex.texi
dist_man_MANS = flex.1
dist_doc_DATA= flex.pdf
CLEANFILES = \
flex.aux \
flex.cp \
flex.cps \
flex.fn \
flex.fns \
flex.hk \
flex.hks \
flex.ky \
flex.log \
flex.op \
flex.ops \
flex.pg \
flex.toc \
flex.tp \
flex.tps \
flex.vr \
flex.vrs
$(dist_man_MANS): $(top_srcdir)/src/main.c
for i in $(dist_man_MANS) ; do \
$(help2man) --name='$(PACKAGE_NAME)' \
--section=`echo $$i | sed -e 's/.*\.\([^.]*\)$$/\1/'` \
$(top_srcdir)/src/flex$(EXEEXT) > $$i || rm -f $$i ; \
done
-8614
View File
File diff suppressed because it is too large Load Diff
-29
View File
@@ -1,29 +0,0 @@
# 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
@@ -1,15 +0,0 @@
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
@@ -1,119 +0,0 @@
# 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
@@ -1,29 +0,0 @@
# 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
@@ -1,56 +0,0 @@
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
@@ -1,26 +0,0 @@
/* 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
@@ -1,19 +0,0 @@
/* 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
@@ -1,21 +0,0 @@
/* 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
@@ -1,25 +0,0 @@
/* 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
@@ -1,28 +0,0 @@
/* 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
@@ -1,25 +0,0 @@
/* 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
@@ -1,24 +0,0 @@
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
@@ -1,55 +0,0 @@
# 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
@@ -1,88 +0,0 @@
#############################################################
#
# 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
@@ -1,12 +0,0 @@
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
@@ -1,45 +0,0 @@
/*
* 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
@@ -1,106 +0,0 @@
/*
* 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
@@ -1,28 +0,0 @@
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
@@ -1,65 +0,0 @@
/*
* 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
@@ -1,17 +0,0 @@
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
@@ -1,8 +0,0 @@
INCLUDE #2
This is the second file that will
be included.
>>> Foo are GNU?
#include "eof_test03.txt"
-7
View File
@@ -1,7 +0,0 @@
INCLUDE #3
This is the third file that will
be included.
>>> echo "I am `whoami`!!"
-35
View File
@@ -1,35 +0,0 @@
/*
* 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
@@ -1,64 +0,0 @@
/*
* 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
@@ -1,40 +0,0 @@
%{
#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
@@ -1,118 +0,0 @@
/* 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
@@ -1,442 +0,0 @@
/*
* 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
@@ -1,15 +0,0 @@
/*
*
* 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
@@ -1,6 +0,0 @@
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
@@ -1,19 +0,0 @@
/*
* 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
@@ -1,145 +0,0 @@
/*
* 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
@@ -1,78 +0,0 @@
/*
* 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
@@ -1,120 +0,0 @@
/*
* 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
@@ -1,12 +0,0 @@
/*
* 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
@@ -1,33 +0,0 @@
/*
* 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
@@ -1,98 +0,0 @@
/*
* 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
@@ -1,94 +0,0 @@
/*
* 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
@@ -1,21 +0,0 @@
"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
@@ -1,32 +0,0 @@
/*
* 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
@@ -1,31 +0,0 @@
%{
#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
@@ -1,30 +0,0 @@
%{
#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
@@ -1,122 +0,0 @@
%{
/*
* 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
@@ -1,29 +0,0 @@
/*
* 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
@@ -1,33 +0,0 @@
/*
* 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
@@ -1,7 +0,0 @@
"This is a test \
of multi-line string \
scanning in flex. \
This may be breaking some law \
of usage though..."
-58
View File
@@ -1,58 +0,0 @@
// An example of using the flex C++ scanner class.
%option C++ noyywrap
%{
int mylineno = 0;
%}
string \"[^\n"]+\"
ws [ \t]+
alpha [A-Za-z]
dig [0-9]
name ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)*
num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)?
num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
number {num1}|{num2}
%%
{ws} /* skip blanks and tabs */
"/*" {
int c;
while((c = yyinput()) != 0)
{
if(c == '\n')
++mylineno;
else if(c == '*')
{
if((c = yyinput()) == '/')
break;
else
unput(c);
}
}
}
{number} FLEX_STD cout << "number " << YYText() << '\n';
\n mylineno++;
{name} FLEX_STD cout << "name " << YYText() << '\n';
{string} FLEX_STD cout << "string " << YYText() << '\n';
%%
int main( int /* argc */, char** /* argv */ )
{
FlexLexer* lexer = new yyFlexLexer;
while(lexer->yylex() != 0)
;
return 0;
}
-3
View File
@@ -1,3 +0,0 @@
*.la
*.lo
*.o
-4
View File
@@ -1,4 +0,0 @@
noinst_LTLIBRARIES = libcompat.la
libcompat_la_SOURCES = lib.c
libcompat_la_LIBADD = $(LTLIBOBJS)
-7
View File
@@ -1,7 +0,0 @@
/* Since building an empty library could cause problems, we provide a
* function to go into the library. We could make this non-trivial by
* moving something that flex treats as a library function into this
* directory. */
void do_nothing(){ return;}
-17
View File
@@ -1,17 +0,0 @@
#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
@@ -1,29 +0,0 @@
#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;
}
+119
View File
@@ -0,0 +1,119 @@
<!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
@@ -0,0 +1,112 @@
<!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
@@ -0,0 +1,134 @@
<!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
@@ -0,0 +1,392 @@
<!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
@@ -0,0 +1,135 @@
<!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
@@ -0,0 +1,111 @@
<!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>
@@ -0,0 +1,177 @@
<!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
@@ -0,0 +1,122 @@
<!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
@@ -0,0 +1,203 @@
<!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>
@@ -0,0 +1,110 @@
<!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>
@@ -0,0 +1,133 @@
<!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>
@@ -0,0 +1,104 @@
<!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>
@@ -0,0 +1,102 @@
<!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>
@@ -0,0 +1,155 @@
<!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
@@ -0,0 +1,309 @@
<!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
@@ -0,0 +1,148 @@
<!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
@@ -0,0 +1,116 @@
<!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
@@ -0,0 +1,576 @@
<!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
@@ -0,0 +1,142 @@
<!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
@@ -0,0 +1,136 @@
<!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
@@ -0,0 +1,357 @@
<!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
@@ -0,0 +1,221 @@
<!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
@@ -0,0 +1,192 @@
<!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
@@ -0,0 +1,182 @@
<!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>
@@ -0,0 +1,115 @@
<!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>
@@ -0,0 +1,105 @@
<!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
@@ -0,0 +1,153 @@
<!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
@@ -0,0 +1,120 @@
<!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
@@ -0,0 +1,124 @@
<!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>
+131
View File
@@ -0,0 +1,131 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: ERASEME56</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME56">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME56">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="ERASEME57.html#ERASEME57" rel="next" title="ERASEME57">
<link href="ERASEME55.html#ERASEME55" rel="prev" title="ERASEME55">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="ERASEME56"></a>
<div class="header">
<p>
Next: <a href="ERASEME57.html#ERASEME57" accesskey="n" rel="next">ERASEME57</a>, Previous: <a href="ERASEME55.html#ERASEME55" accesskey="p" rel="prev">ERASEME55</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &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="ERASEME56-1"></a>
<h3 class="unnumberedsec">ERASEME56</h3>
<div class="example">
<pre class="verbatim">To: Mikael.Latvala@lmf.ericsson.se
Subject: Re: Possible mistake in Flex v2.5 document
In-reply-to: Your message of Fri, 05 Sep 1997 16:07:24 PDT.
Date: Fri, 05 Sep 1997 10:01:54 PDT
From: Vern Paxson &lt;vern&gt;
&gt; In that example you show how to count comment lines when using
&gt; C style /* ... */ comments. My question is, shouldn't you take into
&gt; account a scenario where end of a comment marker occurs inside
&gt; character or string literals?
The scanner certainly needs to also scan character and string literals.
However it does that (there's an example in the man page for strings), the
lexer will recognize the beginning of the literal before it runs across the
embedded &quot;/*&quot;. Consequently, it will finish scanning the literal before it
even considers the possibility of matching &quot;/*&quot;.
Example:
'([^']*|{ESCAPE_SEQUENCE})'
will match all the text between the ''s (inclusive). So the lexer
considers this as a token beginning at the first ', and doesn't even
attempt to match other tokens inside it.
I thinnk this subtlety is not worth putting in the manual, as I suspect
it would confuse more people than it would enlighten.
Vern
</pre></div>
</body>
</html>
+127
View File
@@ -0,0 +1,127 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: ERASEME57</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME57">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: ERASEME57">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="FAQ.html#FAQ" rel="up" title="FAQ">
<link href="Is-there-a-repository-for-flex-scanners_003f.html#Is-there-a-repository-for-flex-scanners_003f" rel="next" title="Is there a repository for flex scanners?">
<link href="ERASEME56.html#ERASEME56" rel="prev" title="ERASEME56">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="ERASEME57"></a>
<div class="header">
<p>
Next: <a href="Is-there-a-repository-for-flex-scanners_003f.html#Is-there-a-repository-for-flex-scanners_003f" accesskey="n" rel="next">Is there a repository for flex scanners?</a>, Previous: <a href="ERASEME56.html#ERASEME56" accesskey="p" rel="prev">ERASEME56</a>, Up: <a href="FAQ.html#FAQ" accesskey="u" rel="up">FAQ</a> &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="ERASEME57-1"></a>
<h3 class="unnumberedsec">ERASEME57</h3>
<div class="example">
<pre class="verbatim">To: &quot;Marty Leisner&quot; &lt;leisner@sdsp.mc.xerox.com&gt;
Subject: Re: flex limitations
In-reply-to: Your message of Sat, 06 Sep 1997 11:27:21 PDT.
Date: Mon, 08 Sep 1997 11:38:08 PDT
From: Vern Paxson &lt;vern&gt;
&gt; %%
&gt; [a-zA-Z]+ /* skip a line */
&gt; { printf(&quot;got %s\n&quot;, yytext); }
&gt; %%
What version of flex are you using? If I feed this to 2.5.4, it complains:
&quot;bug.l&quot;, line 5: EOF encountered inside an action
&quot;bug.l&quot;, line 5: unrecognized rule
&quot;bug.l&quot;, line 5: fatal parse error
Not the world's greatest error message, but it manages to flag the problem.
(With the introduction of start condition scopes, flex can't accommodate
an action on a separate line, since it's ambiguous with an indented rule.)
You can get 2.5.4 from ftp.ee.lbl.gov.
Vern
</pre></div>
</body>
</html>
+175
View File
@@ -0,0 +1,175 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Lexical Analysis With Flex, for Flex 2.6.2: Extra Data</title>
<meta name="description" content="Lexical Analysis With Flex, for Flex 2.6.2: Extra Data">
<meta name="keywords" content="Lexical Analysis With Flex, for Flex 2.6.2: Extra Data">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Reentrant-Detail.html#Reentrant-Detail" rel="up" title="Reentrant Detail">
<link href="About-yyscan_005ft.html#About-yyscan_005ft" rel="next" title="About yyscan_t">
<link href="Accessor-Methods.html#Accessor-Methods" rel="prev" title="Accessor Methods">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Extra-Data"></a>
<div class="header">
<p>
Next: <a href="About-yyscan_005ft.html#About-yyscan_005ft" accesskey="n" rel="next">About yyscan_t</a>, Previous: <a href="Accessor-Methods.html#Accessor-Methods" accesskey="p" rel="prev">Accessor Methods</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> &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="Extra-Data-1"></a>
<h4 class="subsection">19.4.6 Extra Data</h4>
<a name="index-reentrant_002c-extra-data"></a>
<a name="index-yyextra"></a>
<p>User-specific data can be stored in <code>yyextra</code>.
</p>
<p>In a reentrant scanner, it is unwise to use global variables to
communicate with or maintain state between different pieces of your program.
However, you may need access to external data or invoke external functions
from within the scanner actions.
Likewise, you may need to pass information to your scanner
(e.g., open file descriptors, or database connections).
In a non-reentrant scanner, the only way to do this would be through the
use of global variables.
<code>Flex</code> allows you to store arbitrary, &ldquo;extra&rdquo; data in a scanner.
This data is accessible through the accessor methods
<code>yyget_extra</code> and <code>yyset_extra</code>
from outside the scanner, and through the shortcut macro
<code>yyextra</code>
from within the scanner itself. They are defined as follows:
</p>
<a name="index-YY_005fEXTRA_005fTYPE-_0028reentrant-only_0029"></a>
<a name="index-yyget_005fextra"></a>
<a name="index-yyset_005fextra"></a>
<div class="example">
<pre class="verbatim"> #define YY_EXTRA_TYPE void*
YY_EXTRA_TYPE yyget_extra ( yyscan_t scanner );
void yyset_extra ( YY_EXTRA_TYPE arbitrary_data , yyscan_t scanner);
</pre></div>
<p>In addition, an extra form of <code>yylex_init</code> is provided,
<code>yylex_init_extra</code>. This function is provided so that the yyextra value can
be accessed from within the very first yyalloc, used to allocate
the scanner itself.
</p>
<p>By default, <code>YY_EXTRA_TYPE</code> is defined as type <code>void *</code>. You
may redefine this type using <code>%option extra-type=&quot;your_type&quot;</code> in
the scanner:
</p>
<a name="index-YY_005fEXTRA_005fTYPE_002c-defining-your-own-type"></a>
<div class="example">
<pre class="verbatim"> /* An example of overriding YY_EXTRA_TYPE. */
%{
#include &lt;sys/stat.h&gt;
#include &lt;unistd.h&gt;
%}
%option reentrant
%option extra-type=&quot;struct stat *&quot;
%%
__filesize__ printf( &quot;%ld&quot;, yyextra-&gt;st_size );
__lastmod__ printf( &quot;%ld&quot;, yyextra-&gt;st_mtime );
%%
void scan_file( char* filename )
{
yyscan_t scanner;
struct stat buf;
FILE *in;
in = fopen( filename, &quot;r&quot; );
stat( filename, &amp;buf );
yylex_init_extra( buf, &amp;scanner );
yyset_in( in, scanner );
yylex( scanner );
yylex_destroy( scanner );
fclose( in );
}
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="About-yyscan_005ft.html#About-yyscan_005ft" accesskey="n" rel="next">About yyscan_t</a>, Previous: <a href="Accessor-Methods.html#Accessor-Methods" accesskey="p" rel="prev">Accessor Methods</a>, Up: <a href="Reentrant-Detail.html#Reentrant-Detail" accesskey="u" rel="up">Reentrant Detail</a> &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>

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