3 Changes between release 2.5.4 (11Sep96) and release 2.5.3:
5 - Fixed a bug introduced in 2.5.3 that blew it when a call
6 to input() occurred at the end of an input file.
8 - Fixed scanner skeleton so the example in the man page of
9 scanning strings using exclusive start conditions works.
11 - Minor Makefile tweaks.
14 Changes between release 2.5.3 (29May96) and release 2.5.2:
16 - Some serious bugs in yymore() have been fixed. In particular,
17 when using AT&T-lex-compatibility or %array, you can intermix
18 calls to input(), unput(), and yymore(). (This still doesn't
19 work for %pointer, and isn't likely to in the future.)
21 - A bug in handling NUL's in the input stream of scanners using
22 REJECT has been fixed.
24 - The default main() in libfl.a now repeatedly calls yylex() until
25 it returns 0, rather than just calling it once.
27 - Minor tweak for Windows NT Makefile, MISC/NT/Makefile.
30 Changes between release 2.5.2 (25Apr95) and release 2.5.1:
32 - The --prefix configuration option now works.
34 - A bug that completely broke the "-Cf" table compression
35 option has been fixed.
37 - A major headache involving "const" declarators and Solaris
38 systems has been fixed.
40 - An octal escape sequence in a flex regular expression must
41 now contain only the digits 0-7.
43 - You can now use "--" on the flex command line to mark the
46 - You can now specify the filename '-' as a synonym for stdin.
48 - By default, the scanners generated by flex no longer
49 statically initialize yyin and yyout to stdin and stdout.
50 This change is necessary because in some ANSI environments,
51 stdin and stdout are not compile-time constant. You can
52 force the initialization using "%option stdinit" in the first
53 section of your flex input.
55 - "%option nounput" now correctly omits the unput() routine
58 - "make clean" now removes config.log, config.cache, and the
59 flex binary. The fact that it removes the flex binary means
60 you should take care if making changes to scan.l, to make
61 sure you don't wind up in a bootstrap problem.
63 - In general, the Makefile has been reworked somewhat (thanks
64 to Francois Pinard) for added flexibility - more changes will
65 follow in subsequent releases.
67 - The .texi and .info files in MISC/texinfo/ have been updated,
68 thanks also to Francois Pinard.
70 - The FlexLexer::yylex(istream* new_in, ostream* new_out) method
71 now does not have a default for the first argument, to disambiguate
72 it from FlexLexer::yylex().
74 - A bug in destructing a FlexLexer object before doing any scanning
75 with it has been fixed.
77 - A problem with including FlexLexer.h multiple times has been fixed.
79 - The alloca() chud necessary to accommodate bison has grown
80 even uglier, but hopefully more correct.
82 - A portability tweak has been added to accommodate compilers that
83 use char* generic pointers.
85 - EBCDIC contact information in the file MISC/EBCDIC has been updated.
87 - An OS/2 Makefile and config.h for flex 2.5 is now available in
88 MISC/OS2/, contributed by Kai Uwe Rommel.
90 - The descrip.mms file for building flex under VMS has been updated,
93 - The notes on building flex for the Amiga have been updated for
94 flex 2.5, contributed by Andreas Scherer.
97 Changes between release 2.5.1 (28Mar95) and release 2.4.7:
99 - A new concept of "start condition" scope has been introduced.
100 A start condition scope is begun with:
104 where SCs is a list of one or more start conditions. Inside
105 the start condition scope, every rule automatically has the
106 prefix <SCs> applied to it, until a '}' which matches the
107 initial '{'. So, for example:
118 <ESC>"\\n" return '\n';
119 <ESC>"\\r" return '\r';
120 <ESC>"\\f" return '\f';
121 <ESC>"\\0" return '\0';
123 As indicated in this example, rules inside start condition scopes
124 (and any rule, actually, other than the first) can be indented,
125 to better show the extent of the scope.
127 Start condition scopes may be nested.
129 - The new %option directive can be used in the first section of
130 a flex scanner to control scanner-generation options. Most
131 options are given simply as names, optionally preceded by the
132 word "no" (with no intervening whitespace) to negate their
133 meaning. Some are equivalent to flex flags, so putting them
134 in your scanner source is equivalent to always specifying
135 the flag (%option's take precedence over flags):
143 caseful opposite of -i option (caseful is the default);
144 case-sensitive same as above
146 case-insensitive same as above
148 default opposite of -s option
152 interactive -I option
155 perf-report -p option
159 warn opposite of -w option (so use "%option nowarn" for -w)
161 array equivalent to "%array"
162 pointer equivalent to "%pointer" (default)
164 Some provide new features:
166 always-interactive generate a scanner which always
167 considers its input "interactive" (no call to isatty()
168 will be made when the scanner runs)
169 main supply a main program for the scanner, which
170 simply calls yylex(). Implies %option noyywrap.
171 never-interactive generate a scanner which never
172 considers its input "interactive" (no call to isatty()
173 will be made when the scanner runs)
174 stack if set, enable start condition stacks (see below)
175 stdinit if unset ("%option nostdinit"), initialize yyin
176 and yyout statically to nil FILE* pointers, instead
178 yylineno if set, keep track of the current line
179 number in global yylineno (this option is expensive
180 in terms of performance). The line number is available
181 to C++ scanning objects via the new member function
183 yywrap if unset ("%option noyywrap"), scanner does not
184 call yywrap() upon EOF but simply assumes there
185 are no more files to scan
187 Flex scans your rule actions to determine whether you use the
188 REJECT or yymore features (this is not new). Two %options can be
189 used to override its decision, either by setting them to indicate
190 the feature is indeed used, or unsetting them to indicate it
191 actually is not used:
196 Three %option's take string-delimited values, offset with '=':
198 outfile="<name>" equivalent to -o<name>
199 prefix="<name>" equivalent to -P<name>
200 yyclass="<name>" set the name of the C++ scanning class
203 A number of %option's are available for lint purists who
204 want to suppress the appearance of unneeded routines in
205 the generated scanner. Each of the following, if unset,
206 results in the corresponding routine not appearing in the
210 yy_push_state, yy_pop_state, yy_top_state
211 yy_scan_buffer, yy_scan_bytes, yy_scan_string
213 You can specify multiple options with a single %option directive,
214 and multiple directives in the first section of your flex input file.
218 YY_BUFFER_STATE yy_scan_string( const char *str )
220 returns a YY_BUFFER_STATE (which also becomes the current input
221 buffer) for scanning the given string, which occurs starting
222 with the next call to yylex(). The string must be NUL-terminated.
225 YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len )
227 creates a buffer for scanning "len" bytes (including possibly NUL's)
228 starting at location "bytes".
230 Note that both of these functions create and scan a *copy* of
231 the string/bytes. (This may be desirable, since yylex() modifies
232 the contents of the buffer it is scanning.) You can avoid the
235 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
237 which scans in place the buffer starting at "base", consisting
238 of "size" bytes, the last two bytes of which *must* be
239 YY_END_OF_BUFFER_CHAR (these bytes are not scanned; thus, scanning
240 consists of base[0] through base[size-2], inclusive). If you
241 fail to set up "base" in this manner, yy_scan_buffer returns a
242 nil pointer instead of creating a new input buffer.
244 The type yy_size_t is an integral type to which you can cast
245 an integer expression reflecting the size of the buffer.
247 - Three new routines are available for manipulating stacks of
250 void yy_push_state( int new_state )
252 pushes the current start condition onto the top of the stack
253 and BEGIN's "new_state" (recall that start condition names are
258 pops the top of the stack and BEGIN's to it, and
262 returns the top of the stack without altering the stack's
265 The start condition stack grows dynamically and so has no built-in
266 size limitation. If memory is exhausted, program execution
269 To use start condition stacks, your scanner must include
270 a "%option stack" directive.
272 - flex now supports POSIX character class expressions. These
273 are expressions enclosed inside "[:" and ":]" delimiters (which
274 themselves must appear between the '[' and ']' of a character
275 class; other elements may occur inside the character class, too).
276 The expressions flex recognizes are:
278 [:alnum:] [:alpha:] [:blank:] [:cntrl:] [:digit:] [:graph:]
279 [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:]
281 These expressions all designate a set of characters equivalent to
282 the corresponding isXXX function (for example, [:alnum:] designates
283 those characters for which isalnum() returns true - i.e., any
284 alphabetic or numeric). Some systems don't provide isblank(),
285 so flex defines [:blank:] as a blank or a tab.
287 For example, the following character classes are all equivalent:
294 If your scanner is case-insensitive (-i flag), then [:upper:]
295 and [:lower:] are equivalent to [:alpha:].
297 - The promised rewrite of the C++ FlexLexer class has not yet
298 been done. Support for FlexLexer is limited at the moment to
299 fixing show-stopper bugs, so, for example, the new functions
300 yy_scan_string() & friends are not available to FlexLexer
305 yy_set_interactive(is_interactive)
307 can be used to control whether the current buffer is considered
308 "interactive". An interactive buffer is processed more slowly,
309 but must be used when the scanner's input source is indeed
310 interactive to avoid problems due to waiting to fill buffers
311 (see the discussion of the -I flag in flex.1). A non-zero value
312 in the macro invocation marks the buffer as interactive, a zero
313 value as non-interactive. Note that use of this macro overrides
314 "%option always-interactive" or "%option never-interactive".
316 yy_set_interactive() must be invoked prior to beginning to
323 can be used to control whether the current buffer's scanning
324 context for the next token match is done as though at the
325 beginning of a line (non-zero macro argument; makes '^' anchored
326 rules active) or not at the beginning of a line (zero argument,
329 - Related to this change, the mechanism for determining when a scan is
330 starting at the beginning of a line has changed. It used to be
331 that '^' was active iff the character prior to that at which the
332 scan started was a newline. The mechanism now is that '^' is
333 active iff the last token ended in a newline (or the last call to
334 input() returned a newline). For most users, the difference in
335 mechanisms is negligible. Where it will make a difference,
336 however, is if unput() or yyless() is used to alter the input
337 stream. When in doubt, use yy_set_bol().
339 - The new beginning-of-line mechanism involved changing some fairly
340 twisted code, so it may have introduced bugs - beware ...
342 - The macro YY_AT_BOL() returns true if the next token scanned from
343 the current buffer will have '^' rules active, false otherwise.
347 void yy_flush_buffer( struct yy_buffer_state* b )
349 flushes the contents of the current buffer (i.e., next time
350 the scanner attempts to match a token using b as the current
351 buffer, it will begin by invoking YY_INPUT to fill the buffer).
352 This routine is also available to C++ scanners (unlike some
353 of the other new routines).
359 flushes the contents of the current buffer.
361 - A new "-ooutput" option writes the generated scanner to "output".
362 If used with -t, the scanner is still written to stdout, but
363 its internal #line directives (see previous item) use "output".
365 - Flex now generates #line directives relating the code it
366 produces to the output file; this means that error messages
367 in the flex-generated code should be correctly pinpointed.
369 - When generating #line directives, filenames with embedded '\'s
370 have those characters escaped (i.e., turned into '\\'). This
371 feature helps with reporting filenames for some MS-DOS and OS/2
374 - The FlexLexer class includes two new public member functions:
376 virtual void switch_streams( istream* new_in = 0,
377 ostream* new_out = 0 )
379 reassigns yyin to new_in (if non-nil) and yyout to new_out
380 (ditto), deleting the previous input buffer if yyin is
381 reassigned. It is used by:
383 int yylex( istream* new_in = 0, ostream* new_out = 0 )
385 which first calls switch_streams() and then returns the value
388 - C++ scanners now have yy_flex_debug as a member variable of
389 FlexLexer rather than a global, and member functions for testing
392 - When generating a C++ scanning class, you can now use
394 %option yyclass="foo"
396 to inform flex that you have derived "foo" as a subclass of
397 yyFlexLexer, so flex will place your actions in the member
398 function foo::yylex() instead of yyFlexLexer::yylex(). It also
399 generates a yyFlexLexer::yylex() member function that generates a
400 run-time error if called (by invoking yyFlexLexer::LexerError()).
401 This feature is necessary if your subclass "foo" introduces some
402 additional member functions or variables that you need to access
405 - Current texinfo files in MISC/texinfo, contributed by Francois
408 - You can now change the name "flex" to something else (e.g., "lex")
409 by redefining $(FLEX) in the Makefile.
411 - Two bugs (one serious) that could cause "bigcheck" to fail have
414 - A number of portability/configuration changes have been made
415 for easier portability.
417 - You can use "YYSTATE" in your scanner as an alias for YY_START
418 (for AT&T lex compatibility).
420 - input() now maintains yylineno.
422 - input() no longer trashes yytext.
424 - interactive scanners now read characters in YY_INPUT up to a
425 newline, a large performance gain.
427 - C++ scanner objects now work with the -P option. You include
428 <FlexLexer.h> once per scanner - see comments in <FlexLexer.h>
429 (or flex.1) for details.
431 - C++ FlexLexer objects now use the "cerr" stream to report -d output
434 - The -c flag now has its full glorious POSIX interpretation (do
435 nothing), rather than being interpreted as an old-style -C flag.
437 - Scanners generated by flex now include two #define's giving
438 the major and minor version numbers (YY_FLEX_MAJOR_VERSION,
439 YY_FLEX_MINOR_VERSION). These can then be tested to see
440 whether certain flex features are available.
442 - Scanners generated using -l lex compatibility now have the symbol
443 YY_FLEX_LEX_COMPAT #define'd.
445 - When initializing (i.e., yy_init is non-zero on entry to yylex()),
446 generated scanners now set yy_init to zero before executing
447 YY_USER_INIT. This means that you can set yy_init back to a
448 non-zero value in YY_USER_INIT if you need the scanner to be
449 reinitialized on the next call.
451 - You can now use "#line" directives in the first section of your
452 scanner specification.
454 - When generating full-table scanners (-Cf), flex now puts braces
455 around each row of the 2-d array initialization, to silence warnings
456 on over-zealous compilers.
458 - Improved support for MS-DOS. The flex sources have been successfully
459 built, unmodified, for Borland 4.02 (all that's required is a
460 Borland Makefile and config.h file, which are supplied in
461 MISC/Borland - contributed by Terrence O Kane).
463 - Improved support for Macintosh using Think C - the sources should
464 build for this platform "out of the box". Contributed by Scott
467 - Improved support for VMS, in MISC/VMS/, contributed by Pat Rankin.
469 - Support for the Amiga, in MISC/Amiga/, contributed by Andreas
470 Scherer. Note that the contributed files were developed for
471 flex 2.4 and have not been tested with flex 2.5.
473 - Some notes on support for the NeXT, in MISC/NeXT, contributed
476 - The MISC/ directory now includes a preformatted version of flex.1
477 in flex.man, and pre-yacc'd versions of parse.y in parse.{c,h}.
479 - The flex.1 and flexdoc.1 manual pages have been merged. There
480 is now just one document, flex.1, which includes an overview
481 at the beginning to help you find the section you need.
483 - Documentation now clarifies that start conditions persist across
484 switches to new input files or different input buffers. If you
485 want to e.g., return to INITIAL, you must explicitly do so.
487 - The "Performance Considerations" section of the manual has been
490 - Documented the "yy_act" variable, which when YY_USER_ACTION is
491 invoked holds the number of the matched rule, and added an
492 example of using yy_act to profile how often each rule is matched.
494 - Added YY_NUM_RULES, a definition that gives the total number
495 of rules in the file, including the default rule (even if you
498 - Documentation now clarifies that you can pass a nil FILE* pointer
499 to yy_create_buffer() or yyrestart() if you've arrange YY_INPUT
502 - Documentation now clarifies that YY_BUFFER_STATE is a pointer to
503 an opaque "struct yy_buffer_state".
505 - Documentation now stresses that you gain the benefits of removing
506 backing-up states only if you remove *all* of them.
508 - Documentation now points out that traditional lex allows you
509 to put the action on a separate line from the rule pattern if
510 the pattern has trailing whitespace (ugh!), but flex doesn't
513 - A broken example in documentation of the difference between
514 inclusive and exclusive start conditions is now fixed.
516 - Usage (-h) report now goes to stdout.
518 - Version (-V) info now goes to stdout.
520 - More #ifdef chud has been added to the parser in attempt to
521 deal with bison's use of alloca().
523 - "make clean" no longer deletes emacs backup files (*~).
525 - Some memory leaks have been fixed.
527 - A bug was fixed in which dynamically-expanded buffers were
528 reallocated a couple of bytes too small.
530 - A bug was fixed which could cause flex to read and write beyond
531 the end of the input buffer.
533 - -S will not be going away.
536 Changes between release 2.4.7 (03Aug94) and release 2.4.6:
538 - Fixed serious bug in reading multiple files.
540 - Fixed bug in scanning NUL's.
542 - Fixed bug in input() returning 8-bit characters.
544 - Fixed bug in matching text with embedded NUL's when
545 using %array or lex compatibility.
547 - Fixed multiple invocations of YY_USER_ACTION when using '|'
550 - Minor prototyping fixes.
552 Changes between release 2.4.6 (04Jan94) and release 2.4.5:
554 - Linking with -lfl no longer required if your program includes
555 its own yywrap() and main() functions. (This change will cause
556 problems if you have a non-ANSI compiler on a system for which
557 sizeof(int) != sizeof(void*) or sizeof(int) != sizeof(size_t).)
559 - The use of 'extern "C++"' in FlexLexer.h has been modified to
560 get around an incompatibility with g++'s header files.
562 Changes between release 2.4.5 (11Dec93) and release 2.4.4:
564 - Fixed bug breaking C++ scanners that use REJECT or variable
567 - Fixed serious input problem for interactive scanners on
568 systems for which char is unsigned.
570 - Fixed bug in incorrectly treating '$' operator as variable
573 - Fixed bug in -CF table representation that could lead to
576 - Fixed fairly benign memory leak.
578 - Added `extern "C++"' wrapper to FlexLexer.h header. This
579 should overcome the g++ 2.5.X problems mentioned in the
580 NEWS for release 2.4.3.
582 - Changed #include of FlexLexer.h to use <> instead of "".
584 - Added feature to control whether the scanner attempts to
585 refill the input buffer once it's exhausted. This feature
586 will be documented in the 2.5 release.
589 Changes between release 2.4.4 (07Dec93) and release 2.4.3:
591 - Fixed two serious bugs in scanning 8-bit characters.
593 - Fixed bug in YY_USER_ACTION that caused it to be executed
594 inappropriately (on the scanner's own internal actions, and
595 with incorrect yytext/yyleng values).
597 - Fixed bug in pointing yyin at a new file and resuming scanning.
599 - Portability fix regarding min/max/abs macros conflicting with
600 function definitions in standard header files.
602 - Added a virtual LexerError() method to the C++ yyFlexLexer class
603 for reporting error messages instead of always using cerr.
605 - Added warning in flexdoc that the C++ scanning class is presently
606 experimental and subject to considerable change between major
610 Changes between release 2.4.3 (03Dec93) and release 2.4.2:
612 - Fixed bug causing fatal scanner messages to fail to print.
614 - Fixed things so FlexLexer.h can be included in other C++
615 sources. One side-effect of this change is that -+ and -CF
616 are now incompatible.
618 - libfl.a now supplies private versions of the the <string.h>/
619 <strings.h> string routines needed by flex and the scanners
620 it generates, to enhance portability to some BSD systems.
622 - More robust solution to 2.4.2's flexfatal() bug fix.
624 - Added ranlib of installed libfl.a.
628 - NOTE: problems have been encountered attempting to build flex
629 C++ scanners using g++ version 2.5.X. The problem is due to an
630 unfortunate heuristic in g++ 2.5.X that attempts to discern between
631 C and C++ headers. Because FlexLexer.h is installed (by default)
632 in /usr/local/include and not /usr/local/lib/g++-include, g++ 2.5.X
633 decides that it's a C header :-(. So if you have problems, install
634 the header in /usr/local/lib/g++-include instead.
637 Changes between release 2.4.2 (01Dec93) and release 2.4.1:
639 - Fixed bug in libfl.a referring to non-existent "flexfatal" function.
641 - Modified to produce both compress'd and gzip'd tar files for
642 distributions (you probably don't care about this change!).
645 Changes between release 2.4.1 (30Nov93) and release 2.3.8:
647 - The new '-+' flag instructs flex to generate a C++ scanner class
648 (thanks to Kent Williams). flex writes an implementation of the
649 class defined in FlexLexer.h to lex.yy.cc. You may include
650 multiple scanner classes in your program using the -P flag. Note
651 that the scanner class also provides a mechanism for creating
652 reentrant scanners. The scanner class uses C++ streams for I/O
653 instead of FILE*'s (thanks to Tom Epperly). If the flex executable's
654 name ends in '+' then the '-+' flag is automatically on, so creating
655 a symlink or copy of "flex" to "flex++" results in a version of
656 flex that can be used exclusively for C++ scanners.
658 Note that without the '-+' flag, flex-generated scanners can still
659 be compiled using C++ compilers, though they use FILE*'s for I/O
662 See the "GENERATING C++ SCANNERS" section of flexdoc for details.
664 - The new '-l' flag turns on maximum AT&T lex compatibility. In
665 particular, -l includes support for "yylineno" and makes yytext
666 be an array instead of a pointer. It does not, however, do away
667 with all incompatibilities. See the "INCOMPATIBILITIES WITH LEX
668 AND POSIX" section of flexdoc for details.
670 - The new '-P' option specifies a prefix to use other than "yy"
671 for the scanner's globally-visible variables, and for the
672 "lex.yy.c" filename. Using -P you can link together multiple
673 flex scanners in the same executable.
675 - The distribution includes a "texinfo" version of flexdoc.1,
676 contributed by Roland Pesch (thanks also to Marq Kole, who
677 contributed another version). It has not been brought up to
678 date, but reflects version 2.3. See MISC/flex.texinfo.
680 The flex distribution will soon include G.T. Nicol's flex
681 manual; he is presently bringing it up-to-date for version 2.4.
683 - yywrap() is now a function, and you now *must* link flex scanners
686 - Site-configuration is now done via an autoconf-generated
687 "configure" script contributed by Francois Pinard.
689 - Scanners now use fread() (or getc(), if interactive) and not
690 read() for input. A new "table compression" option, -Cr,
691 overrides this change and causes the scanner to use read()
692 (because read() is a bit faster than fread()). -f and -F
693 are now equivalent to -Cfr and -CFr; i.e., they imply the
696 - In the blessed name of POSIX compliance, flex supports "%array"
697 and "%pointer" directives in the definitions (first) section of
698 the scanner specification. The former specifies that yytext
699 should be an array (of size YYLMAX), the latter, that it should
700 be a pointer. The array version of yytext is universally slower
701 than the pointer version, but has the advantage that its contents
702 remain unmodified across calls to input() and unput() (the pointer
703 version of yytext is, still, trashed by such calls).
705 "%array" cannot be used with the '-+' C++ scanner class option.
707 - The new '-Ca' option directs flex to trade off memory for
708 natural alignment when generating a scanner's tables. In
709 particular, table entries that would otherwise be "short"
712 - The new '-h' option produces a summary of the flex flags.
714 - The new '-V' option reports the flex version number and exits.
716 - The new scanner macro YY_START returns an integer value
717 corresponding to the current start condition. You can return
718 to that start condition by passing the value to a subsequent
719 "BEGIN" action. You also can implement "start condition stacks"
720 by storing the values in an integer stack.
722 - You can now redefine macros such as YY_INPUT by just #define'ing
723 them to some other value in the first section of the flex input;
724 no need to first #undef them.
726 - flex now generates warnings for rules that can't be matched.
727 These warnings can be turned off using the new '-w' flag. If
728 your scanner uses REJECT then you will not get these warnings.
730 - If you specify the '-s' flag but the default rule can be matched,
731 flex now generates a warning.
733 - "yyleng" is now a global, and may be modified by the user (though
734 doing so and then using yymore() will yield weird results).
736 - Name definitions in the first section of a scanner specification
737 can now include a leading '^' or trailing '$' operator. In this
738 case, the definition is *not* pushed back inside of parentheses.
740 - Scanners with compressed tables are now "interactive" (-I option)
741 by default. You can suppress this attribute (which makes them
742 run slightly slower) using the new '-B' flag.
744 - Flex now generates 8-bit scanners by default, unless you use the
745 -Cf or -CF compression options (-Cfe and -CFe result in 8-bit
746 scanners). You can force it to generate a 7-bit scanner using
747 the new '-7' flag. You can build flex to generate 8-bit scanners
748 for -Cf and -CF, too, by adding -DDEFAULT_CSIZE=256 to CFLAGS
751 - You no longer need to call the scanner routine yyrestart() to
752 inform the scanner that you have switched to a new file after
753 having seen an EOF on the current input file. Instead, just
754 point yyin at the new file and continue scanning.
756 - You no longer need to invoke YY_NEW_FILE in an <<EOF>> action
757 to indicate you wish to continue scanning. Simply point yyin
760 - A leading '#' no longer introduces a comment in a flex input.
762 - flex no longer considers formfeed ('\f') a whitespace character.
764 - %t, I'm happy to report, has been nuked.
766 - The '-p' option may be given twice ('-pp') to instruct flex to
767 report minor performance problems as well as major ones.
769 - The '-v' verbose output no longer includes start/finish time
772 - Newlines in flex inputs can optionally include leading or
773 trailing carriage-returns ('\r'), in support of several PC/Mac
774 run-time libraries that automatically include these.
776 - A start condition of the form "<*>" makes the following rule
777 active in every start condition, whether exclusive or inclusive.
779 - The following items have been corrected in the flex documentation:
781 - '-C' table compression options *are* cumulative.
783 - You may modify yytext but not lengthen it by appending
784 characters to the end. Modifying its final character
785 will affect '^' anchoring for the next rule matched
786 if the character is changed to or from a newline.
788 - The term "backtracking" has been renamed "backing up",
789 since it is a one-time repositioning and not a repeated
790 search. What used to be the "lex.backtrack" file is now
793 - Unindented "/* ... */" comments are allowed in the first
794 flex input section, but not in the second.
796 - yyless() can only be used in the flex input source, not
799 - You can use "yyrestart(yyin)" to throw away the
800 current contents of the input buffer.
802 - To write high-speed scanners, attempt to match as much
803 text as possible with each rule. See MISC/fastwc/README
804 for more information.
806 - Using the beginning-of-line operator ('^') is fairly
807 cheap. Using unput() is expensive. Using yyless() is
810 - An example of scanning strings with embedded escape
811 sequences has been added.
813 - The example of backing-up in flexdoc was erroneous; it
816 - A flex scanner's internal buffer now dynamically grows if needed
817 to match large tokens. Note that growing the buffer presently
818 requires rescanning the (large) token, so consuming a lot of
819 text this way is a slow process. Also note that presently the
820 buffer does *not* grow if you unput() more text than can fit
823 - The MISC/ directory has been reorganized; see MISC/README for
826 - yyless() can now be used in the third (user action) section
827 of a scanner specification, thanks to Ceriel Jacobs. yyless()
828 remains a macro and cannot be used outside of the scanner source.
830 - The skeleton file is no longer opened at run-time, but instead
831 compiled into a large string array (thanks to John Gilmore and
832 friends at Cygnus). You can still use the -S flag to point flex
833 at a different skeleton file.
835 - flex no longer uses a temporary file to store the scanner's
838 - A number of changes have been made to decrease porting headaches.
839 In particular, flex no longer uses memset() or ctime(), and
840 provides a single simple mechanism for dealing with C compilers
841 that still define malloc() as returning char* instead of void*.
843 - Flex now detects if the scanner specification requires the -8 flag
844 but the flag was not given or on by default.
846 - A number of table-expansion fencepost bugs have been fixed,
847 making flex more robust for generating large scanners.
849 - flex more consistently identifies the location of errors in
852 - YY_USER_ACTION is now invoked only for "real" actions, not for
853 internal actions used by the scanner for things like filling
854 the buffer or handling EOF.
856 - The rule "[^]]" now matches any character other than a ']';
857 formerly it matched any character at all followed by a ']'.
858 This change was made for compatibility with AT&T lex.
860 - A large number of miscellaneous bugs have been found and fixed
861 thanks to Gerhard Wilhelms.
863 - The source code has been heavily reformatted, making patches
864 relative to previous flex releases no longer accurate.
867 Changes between 2.3 Patch #8 (21Feb93) and 2.3 Patch #7:
869 - Fixed bugs in dynamic memory allocation leading to grievous
870 fencepost problems when generating large scanners.
871 - Fixed bug causing infinite loops on character classes with 8-bit
873 - Fixed bug in matching repetitions with a lower bound of 0.
874 - Fixed bug in scanning NUL characters using an "interactive" scanner.
875 - Fixed bug in using yymore() at the end of a file.
876 - Fixed bug in misrecognizing rules with variable trailing context.
877 - Fixed bug compiling flex on Suns using gcc 2.
878 - Fixed bug in not recognizing that input files with the character
879 ASCII 128 in them require the -8 flag.
880 - Fixed bug that could cause an infinite loop writing out
882 - Fixed bug in not recognizing old-style lex % declarations if
883 followed by a tab instead of a space.
884 - Fixed potential crash when flex terminated early (usually due
885 to a bad flag) and the -v flag had been given.
886 - Added some missing declarations of void functions.
887 - Changed to only use '\a' for __STDC__ compilers.
888 - Updated mailing addresses.
891 Changes between 2.3 Patch #7 (28Mar91) and 2.3 Patch #6:
893 - Fixed out-of-bounds array access that caused bad tables
894 to be produced on machines where the bad reference happened
895 to yield a 1. This caused problems installing or running
896 flex on some Suns, in particular.
899 Changes between 2.3 Patch #6 (29Aug90) and 2.3 Patch #5:
901 - Fixed a serious bug in yymore() which basically made it
902 completely broken. Thanks goes to Jean Christophe of
903 the Nethack development team for finding the problem
904 and passing along the fix.
907 Changes between 2.3 Patch #5 (16Aug90) and 2.3 Patch #4:
909 - An up-to-date version of initscan.c so "make test" will
910 work after applying the previous patches
913 Changes between 2.3 Patch #4 (14Aug90) and 2.3 Patch #3:
915 - Fixed bug in hexadecimal escapes which allowed only digits,
916 not letters, in escapes
917 - Fixed bug in previous "Changes" file!
920 Changes between 2.3 Patch #3 (03Aug90) and 2.3 Patch #2:
922 - Correction to patch #2 for gcc compilation; thanks goes to
923 Paul Eggert for catching this.
926 Changes between 2.3 Patch #2 (02Aug90) and original 2.3 release:
928 - Fixed (hopefully) headaches involving declaring malloc()
929 and free() for gcc, which defines __STDC__ but (often) doesn't
930 come with the standard include files such as <stdlib.h>.
931 Reordered #ifdef maze in the scanner skeleton in the hope of
932 getting the declarations right for cfront and g++, too.
934 - Note that this patch supercedes patch #1 for release 2.3,
935 which was never announced but was available briefly for
939 Changes between 2.3 (full) release of 28Jun90 and 2.2 (alpha) release:
943 - A lone <<EOF>> rule (that is, one which is not qualified with
944 a list of start conditions) now specifies the EOF action for
945 *all* start conditions which haven't already had <<EOF>> actions
946 given. To specify an end-of-file action for just the initial
947 state, use <INITIAL><<EOF>>.
949 - -d debug output is now contingent on the global yy_flex_debug
950 being set to a non-zero value, which it is by default.
952 - A new macro, YY_USER_INIT, is provided for the user to specify
953 initialization action to be taken on the first call to the
954 scanner. This action is done before the scanner does its
957 - yy_new_buffer() has been added as an alias for yy_create_buffer()
959 - Comments beginning with '#' and extending to the end of the line
960 now work, but have been deprecated (in anticipation of making
961 flex recognize #line directives).
963 - The funky restrictions on when semi-colons could follow the
964 YY_NEW_FILE and yyless macros have been removed. They now
965 behave identically to functions.
967 - A bug in the sample redefinition of YY_INPUT in the documentation
970 - A bug in the sample simple tokener in the documentation has
973 - The documentation on the incompatibilities between flex and
974 lex has been reordered so that the discussion of yylineno
975 and input() come first, as it's anticipated that these will
976 be the most common source of headaches.
979 Things which didn't used to be documented but now are:
981 - flex interprets "^foo|bar" differently from lex. flex interprets
982 it as "match either a 'foo' or a 'bar', providing it comes at the
983 beginning of a line", whereas lex interprets it as "match either
984 a 'foo' at the beginning of a line, or a 'bar' anywhere".
986 - flex initializes the global "yyin" on the first call to the
987 scanner, while lex initializes it at compile-time.
989 - yy_switch_to_buffer() can be used in the yywrap() macro/routine.
991 - flex scanners do not use stdio for their input, and hence when
992 writing an interactive scanner one must explicitly call fflush()
993 after writing out a prompt.
995 - flex scanner can be made reentrant (after a fashion) by using
996 "yyrestart( yyin );". This is useful for interactive scanners
997 which have interrupt handlers that long-jump out of the scanner.
999 - a defense of why yylineno is not supported is included, along
1000 with a suggestion on how to convert scanners which rely on it.
1005 - Prototypes and proper declarations of void routines have
1006 been added to the flex source code, courtesy of Kevin B. Kenny.
1008 - Routines dealing with memory allocation now use void* pointers
1009 instead of char* - see Makefile for porting implications.
1011 - Error-checking is now done when flex closes a file.
1013 - Various lint tweaks were added to reduce the number of gripes.
1015 - Makefile has been further parameterized to aid in porting.
1017 - Support for SCO Unix added.
1019 - Flex now sports the latest & greatest UC copyright notice
1020 (which is only slightly different from the previous one).
1022 - A note has been added to flexdoc.1 mentioning work in progress
1023 on modifying flex to generate straight C code rather than a
1024 table-driven automaton, with an email address of whom to contact
1025 if you are working along similar lines.
1028 Changes between 2.2 Patch #3 (30Mar90) and 2.2 Patch #2:
1030 - fixed bug which caused -I scanners to bomb
1033 Changes between 2.2 Patch #2 (27Mar90) and 2.2 Patch #1:
1035 - fixed bug writing past end of input buffer in yyunput()
1036 - fixed bug detecting NUL's at the end of a buffer
1039 Changes between 2.2 Patch #1 (23Mar90) and 2.2 (alpha) release:
1041 - Makefile fixes: definition of MAKE variable for systems
1042 which don't have it; installation of flexdoc.1 along with
1043 flex.1; fixed two bugs which could cause "bigtest" to fail.
1045 - flex.skel fix for compiling with g++.
1047 - README and flexdoc.1 no longer list an out-of-date BITNET address
1050 - minor typos and formatting changes to flex.1 and flexdoc.1.
1053 Changes between 2.2 (alpha) release of March '90 and previous release:
1057 - Full user documentation now available.
1059 - Support for 8-bit scanners.
1061 - Scanners now accept NUL's.
1063 - A facility has been added for dealing with multiple
1066 - Two manual entries now. One which fully describes flex
1067 (rather than just its differences from lex), and the
1068 other for quick(er) reference.
1070 - A number of changes to bring flex closer into compliance
1071 with the latest POSIX lex draft:
1074 flex now accepts multiple input files and concatenates
1075 them together to form its input
1076 previous -c (compress) flag renamed -C
1077 do-nothing -c and -n flags added
1078 Any indented code or code within %{}'s in section 2 is
1079 now copied to the output
1081 - yyleng is now a bona fide global integer.
1083 - -d debug information now gives the line number of the
1084 matched rule instead of which number rule it was from
1085 the beginning of the file.
1087 - -v output now includes a summary of the flags used to generate
1090 - unput() and yyrestart() are now globally callable.
1092 - yyrestart() no longer closes the previous value of yyin.
1094 - C++ support; generated scanners can be compiled with C++ compiler.
1096 - Primitive -lfl library added, containing default main()
1097 which calls yylex(). A number of routines currently living
1098 in the scanner skeleton will probably migrate to here
1099 in the future (in particular, yywrap() will probably cease
1100 to be a macro and instead be a function in the -lfl library).
1102 - Hexadecimal (\x) escape sequences added.
1104 - Support for MS-DOS, VMS, and Turbo-C integrated.
1106 - The %used/%unused operators have been deprecated. They
1112 - Makefile enhanced for easier testing and installation.
1113 - The parser has been tweaked to detect some erroneous
1114 constructions which previously were missed.
1115 - Scanner input buffer overflow is now detected.
1116 - Bugs with missing "const" declarations fixed.
1117 - Out-of-date Minix/Atari patches provided.
1118 - Scanners no longer require printf() unless FLEX_DEBUG is being used.
1119 - A subtle input() bug has been fixed.
1120 - Line numbers for "continued action" rules (those following
1121 the special '|' action) are now correct.
1122 - unput() bug fixed; had been causing problems porting flex to VMS.
1123 - yymore() handling rewritten to fix bug with interaction
1124 between yymore() and trailing context.
1125 - EOF in actions now generates an error message.
1126 - Bug involving -CFe and generating equivalence classes fixed.
1127 - Bug which made -CF be treated as -Cf fixed.
1128 - Support for SysV tmpnam() added.
1129 - Unused #define's for scanner no longer generated.
1130 - Error messages which are associated with a particular input
1131 line are now all identified with their input line in standard
1133 - % directives which are valid to lex but not to flex are
1134 now ignored instead of generating warnings.
1135 - -DSYS_V flag can now also be specified -DUSG for System V
1139 Changes between 2.1 beta-test release of June '89 and previous release:
1143 - -p flag generates a performance report to stderr. The report
1144 consists of comments regarding features of the scanner rules
1145 which result in slower scanners.
1147 - -b flag generates backtracking information to lex.backtrack.
1148 This is a list of scanner states which require backtracking
1149 and the characters on which they do so. By adding rules
1150 one can remove backtracking states. If all backtracking states
1151 are eliminated, the generated scanner will run faster.
1152 Backtracking is not yet documented in the manual entry.
1154 - Variable trailing context now works, i.e., one can have
1155 rules like "(foo)*/[ \t]*bletch". Some trailing context
1156 patterns still cannot be properly matched and generate
1157 error messages. These are patterns where the ending of the
1158 first part of the rule matches the beginning of the second
1159 part, such as "zx*/xy*", where the 'x*' matches the 'x' at
1160 the beginning of the trailing context. Lex won't get these
1161 patterns right either.
1165 - End-of-file rules. The special rule "<<EOF>>" indicates
1166 actions which are to be taken when an end-of-file is
1167 encountered and yywrap() returns non-zero (i.e., indicates
1168 no further files to process). See manual entry for example.
1170 - The -r (reject used) flag is gone. flex now scans the input
1171 for occurrences of the string "REJECT" to determine if the
1172 action is needed. It tries to be intelligent about this but
1173 can be fooled. One can force the presence or absence of
1174 REJECT by adding a line in the first section of the form
1175 "%used REJECT" or "%unused REJECT".
1177 - yymore() has been implemented. Similarly to REJECT, flex
1178 detects the use of yymore(), which can be overridden using
1179 "%used" or "%unused".
1181 - Patterns like "x{0,3}" now work (i.e., with lower-limit == 0).
1183 - Removed '\^x' for ctrl-x misfeature.
1185 - Added '\a' and '\v' escape sequences.
1187 - \<digits> now works for octal escape sequences; previously
1188 \0<digits> was required.
1190 - Better error reporting; line numbers are associated with rules.
1192 - yyleng is a macro; it cannot be accessed outside of the
1193 scanner source file.
1195 - yytext and yyleng should not be modified within a flex action.
1197 - Generated scanners #define the name FLEX_SCANNER.
1199 - Rules are internally separated by YY_BREAK in lex.yy.c rather
1200 than break, to allow redefinition.
1202 - The macro YY_USER_ACTION can be redefined to provide an action
1203 which is always executed prior to the matched rule's action.
1205 - yyrestart() is a new action which can be used to restart
1206 the scanner after it has seen an end-of-file (a "real" one,
1207 that is, one for which yywrap() returned non-zero). It takes
1208 a FILE* argument indicating a new file to scan and sets
1209 things up so that a subsequent call to yylex() will start
1212 - Internal scanner names all preceded by "yy_"
1214 - lex.yy.c is deleted if errors are encountered during processing.
1216 - Comments may be put in the first section of the input by preceding
1223 - Some portability-related bugs fixed, in particular for machines
1224 with unsigned characters or sizeof( int* ) != sizeof( int ).
1225 Also, tweaks for VMS and Microsoft C (MS-DOS), and identifiers all
1226 trimmed to be 31 or fewer characters. Shortened file names
1227 for dinosaur OS's. Checks for allocating > 64K memory
1228 on 16 bit'ers. Amiga tweaks. Compiles using gcc on a Sun-3.
1229 - Compressed and fast scanner skeletons merged.
1230 - Skeleton header files done away with.
1231 - Generated scanner uses prototypes and "const" for __STDC__.
1232 - -DSV flag is now -DSYS_V for System V compilation.
1233 - Removed all references to FTL language.
1234 - Software now covered by BSD Copyright.
1235 - flex will replace lex in subsequent BSD releases.