13e102307SJung-uk KimChanges between release 2.5.4 (11Sep96) and release 2.5.3: 23e102307SJung-uk Kim 33e102307SJung-uk Kim - Fixed a bug introduced in 2.5.3 that blew it when a call 43e102307SJung-uk Kim to input() occurred at the end of an input file. 53e102307SJung-uk Kim 63e102307SJung-uk Kim - Fixed scanner skeleton so the example in the man page of 73e102307SJung-uk Kim scanning strings using exclusive start conditions works. 83e102307SJung-uk Kim 93e102307SJung-uk Kim - Minor Makefile tweaks. 103e102307SJung-uk Kim 113e102307SJung-uk Kim 123e102307SJung-uk KimChanges between release 2.5.3 (29May96) and release 2.5.2: 133e102307SJung-uk Kim 143e102307SJung-uk Kim - Some serious bugs in yymore() have been fixed. In particular, 153e102307SJung-uk Kim when using AT&T-lex-compatibility or %array, you can intermix 163e102307SJung-uk Kim calls to input(), unput(), and yymore(). (This still doesn't 173e102307SJung-uk Kim work for %pointer, and isn't likely to in the future.) 183e102307SJung-uk Kim 193e102307SJung-uk Kim - A bug in handling NUL's in the input stream of scanners using 203e102307SJung-uk Kim REJECT has been fixed. 213e102307SJung-uk Kim 223e102307SJung-uk Kim - The default main() in libfl.a now repeatedly calls yylex() until 233e102307SJung-uk Kim it returns 0, rather than just calling it once. 243e102307SJung-uk Kim 253e102307SJung-uk Kim - Minor tweak for Windows NT Makefile, MISC/NT/Makefile. 263e102307SJung-uk Kim 273e102307SJung-uk Kim 283e102307SJung-uk KimChanges between release 2.5.2 (25Apr95) and release 2.5.1: 293e102307SJung-uk Kim 303e102307SJung-uk Kim - The --prefix configuration option now works. 313e102307SJung-uk Kim 323e102307SJung-uk Kim - A bug that completely broke the "-Cf" table compression 333e102307SJung-uk Kim option has been fixed. 343e102307SJung-uk Kim 353e102307SJung-uk Kim - A major headache involving "const" declarators and Solaris 363e102307SJung-uk Kim systems has been fixed. 373e102307SJung-uk Kim 383e102307SJung-uk Kim - An octal escape sequence in a flex regular expression must 393e102307SJung-uk Kim now contain only the digits 0-7. 403e102307SJung-uk Kim 413e102307SJung-uk Kim - You can now use "--" on the flex command line to mark the 423e102307SJung-uk Kim end of flex options. 433e102307SJung-uk Kim 443e102307SJung-uk Kim - You can now specify the filename '-' as a synonym for stdin. 453e102307SJung-uk Kim 463e102307SJung-uk Kim - By default, the scanners generated by flex no longer 473e102307SJung-uk Kim statically initialize yyin and yyout to stdin and stdout. 483e102307SJung-uk Kim This change is necessary because in some ANSI environments, 493e102307SJung-uk Kim stdin and stdout are not compile-time constant. You can 503e102307SJung-uk Kim force the initialization using "%option stdinit" in the first 513e102307SJung-uk Kim section of your flex input. 523e102307SJung-uk Kim 533e102307SJung-uk Kim - "%option nounput" now correctly omits the unput() routine 543e102307SJung-uk Kim from the output. 553e102307SJung-uk Kim 563e102307SJung-uk Kim - "make clean" now removes config.log, config.cache, and the 573e102307SJung-uk Kim flex binary. The fact that it removes the flex binary means 583e102307SJung-uk Kim you should take care if making changes to scan.l, to make 593e102307SJung-uk Kim sure you don't wind up in a bootstrap problem. 603e102307SJung-uk Kim 613e102307SJung-uk Kim - In general, the Makefile has been reworked somewhat (thanks 623e102307SJung-uk Kim to Francois Pinard) for added flexibility - more changes will 633e102307SJung-uk Kim follow in subsequent releases. 643e102307SJung-uk Kim 653e102307SJung-uk Kim - The .texi and .info files in MISC/texinfo/ have been updated, 663e102307SJung-uk Kim thanks also to Francois Pinard. 673e102307SJung-uk Kim 683e102307SJung-uk Kim - The FlexLexer::yylex(istream* new_in, ostream* new_out) method 693e102307SJung-uk Kim now does not have a default for the first argument, to disambiguate 703e102307SJung-uk Kim it from FlexLexer::yylex(). 713e102307SJung-uk Kim 723e102307SJung-uk Kim - A bug in destructing a FlexLexer object before doing any scanning 733e102307SJung-uk Kim with it has been fixed. 743e102307SJung-uk Kim 753e102307SJung-uk Kim - A problem with including FlexLexer.h multiple times has been fixed. 763e102307SJung-uk Kim 773e102307SJung-uk Kim - The alloca() chud necessary to accommodate bison has grown 783e102307SJung-uk Kim even uglier, but hopefully more correct. 793e102307SJung-uk Kim 803e102307SJung-uk Kim - A portability tweak has been added to accommodate compilers that 813e102307SJung-uk Kim use char* generic pointers. 823e102307SJung-uk Kim 833e102307SJung-uk Kim - EBCDIC contact information in the file MISC/EBCDIC has been updated. 843e102307SJung-uk Kim 853e102307SJung-uk Kim - An OS/2 Makefile and config.h for flex 2.5 is now available in 863e102307SJung-uk Kim MISC/OS2/, contributed by Kai Uwe Rommel. 873e102307SJung-uk Kim 883e102307SJung-uk Kim - The descrip.mms file for building flex under VMS has been updated, 893e102307SJung-uk Kim thanks to Pat Rankin. 903e102307SJung-uk Kim 913e102307SJung-uk Kim - The notes on building flex for the Amiga have been updated for 923e102307SJung-uk Kim flex 2.5, contributed by Andreas Scherer. 933e102307SJung-uk Kim 943e102307SJung-uk Kim 953e102307SJung-uk KimChanges between release 2.5.1 (28Mar95) and release 2.4.7: 963e102307SJung-uk Kim 973e102307SJung-uk Kim - A new concept of "start condition" scope has been introduced. 983e102307SJung-uk Kim A start condition scope is begun with: 993e102307SJung-uk Kim 1003e102307SJung-uk Kim <SCs>{ 1013e102307SJung-uk Kim 1023e102307SJung-uk Kim where SCs is a list of one or more start conditions. Inside 1033e102307SJung-uk Kim the start condition scope, every rule automatically has the 1043e102307SJung-uk Kim prefix <SCs> applied to it, until a '}' which matches the 1053e102307SJung-uk Kim initial '{'. So, for example: 1063e102307SJung-uk Kim 1073e102307SJung-uk Kim <ESC>{ 1083e102307SJung-uk Kim "\\n" return '\n'; 1093e102307SJung-uk Kim "\\r" return '\r'; 1103e102307SJung-uk Kim "\\f" return '\f'; 1113e102307SJung-uk Kim "\\0" return '\0'; 1123e102307SJung-uk Kim } 1133e102307SJung-uk Kim 1143e102307SJung-uk Kim is equivalent to: 1153e102307SJung-uk Kim 1163e102307SJung-uk Kim <ESC>"\\n" return '\n'; 1173e102307SJung-uk Kim <ESC>"\\r" return '\r'; 1183e102307SJung-uk Kim <ESC>"\\f" return '\f'; 1193e102307SJung-uk Kim <ESC>"\\0" return '\0'; 1203e102307SJung-uk Kim 1213e102307SJung-uk Kim As indicated in this example, rules inside start condition scopes 1223e102307SJung-uk Kim (and any rule, actually, other than the first) can be indented, 1233e102307SJung-uk Kim to better show the extent of the scope. 1243e102307SJung-uk Kim 1253e102307SJung-uk Kim Start condition scopes may be nested. 1263e102307SJung-uk Kim 1273e102307SJung-uk Kim - The new %option directive can be used in the first section of 1283e102307SJung-uk Kim a flex scanner to control scanner-generation options. Most 1293e102307SJung-uk Kim options are given simply as names, optionally preceded by the 1303e102307SJung-uk Kim word "no" (with no intervening whitespace) to negate their 1313e102307SJung-uk Kim meaning. Some are equivalent to flex flags, so putting them 1323e102307SJung-uk Kim in your scanner source is equivalent to always specifying 1333e102307SJung-uk Kim the flag (%option's take precedence over flags): 1343e102307SJung-uk Kim 1353e102307SJung-uk Kim 7bit -7 option 1363e102307SJung-uk Kim 8bit -8 option 1373e102307SJung-uk Kim align -Ca option 1383e102307SJung-uk Kim backup -b option 1393e102307SJung-uk Kim batch -B option 1403e102307SJung-uk Kim c++ -+ option 1413e102307SJung-uk Kim caseful opposite of -i option (caseful is the default); 1423e102307SJung-uk Kim case-sensitive same as above 1433e102307SJung-uk Kim caseless -i option; 1443e102307SJung-uk Kim case-insensitive same as above 1453e102307SJung-uk Kim debug -d option 1463e102307SJung-uk Kim default opposite of -s option 1473e102307SJung-uk Kim ecs -Ce option 1483e102307SJung-uk Kim fast -F option 1493e102307SJung-uk Kim full -f option 1503e102307SJung-uk Kim interactive -I option 1513e102307SJung-uk Kim lex-compat -l option 1523e102307SJung-uk Kim meta-ecs -Cm option 1533e102307SJung-uk Kim perf-report -p option 1543e102307SJung-uk Kim read -Cr option 1553e102307SJung-uk Kim stdout -t option 1563e102307SJung-uk Kim verbose -v option 1573e102307SJung-uk Kim warn opposite of -w option (so use "%option nowarn" for -w) 1583e102307SJung-uk Kim 1593e102307SJung-uk Kim array equivalent to "%array" 1603e102307SJung-uk Kim pointer equivalent to "%pointer" (default) 1613e102307SJung-uk Kim 1623e102307SJung-uk Kim Some provide new features: 1633e102307SJung-uk Kim 1643e102307SJung-uk Kim always-interactive generate a scanner which always 1653e102307SJung-uk Kim considers its input "interactive" (no call to isatty() 1663e102307SJung-uk Kim will be made when the scanner runs) 1673e102307SJung-uk Kim main supply a main program for the scanner, which 1683e102307SJung-uk Kim simply calls yylex(). Implies %option noyywrap. 1693e102307SJung-uk Kim never-interactive generate a scanner which never 1703e102307SJung-uk Kim considers its input "interactive" (no call to isatty() 1713e102307SJung-uk Kim will be made when the scanner runs) 1723e102307SJung-uk Kim stack if set, enable start condition stacks (see below) 1733e102307SJung-uk Kim stdinit if unset ("%option nostdinit"), initialize yyin 1743e102307SJung-uk Kim and yyout statically to nil FILE* pointers, instead 1753e102307SJung-uk Kim of stdin and stdout 1763e102307SJung-uk Kim yylineno if set, keep track of the current line 1773e102307SJung-uk Kim number in global yylineno (this option is expensive 1783e102307SJung-uk Kim in terms of performance). The line number is available 1793e102307SJung-uk Kim to C++ scanning objects via the new member function 1803e102307SJung-uk Kim lineno(). 1813e102307SJung-uk Kim yywrap if unset ("%option noyywrap"), scanner does not 1823e102307SJung-uk Kim call yywrap() upon EOF but simply assumes there 1833e102307SJung-uk Kim are no more files to scan 1843e102307SJung-uk Kim 1853e102307SJung-uk Kim Flex scans your rule actions to determine whether you use the 1863e102307SJung-uk Kim REJECT or yymore features (this is not new). Two %options can be 1873e102307SJung-uk Kim used to override its decision, either by setting them to indicate 1883e102307SJung-uk Kim the feature is indeed used, or unsetting them to indicate it 1893e102307SJung-uk Kim actually is not used: 1903e102307SJung-uk Kim 1913e102307SJung-uk Kim reject 1923e102307SJung-uk Kim yymore 1933e102307SJung-uk Kim 1943e102307SJung-uk Kim Three %option's take string-delimited values, offset with '=': 1953e102307SJung-uk Kim 1963e102307SJung-uk Kim outfile="<name>" equivalent to -o<name> 1973e102307SJung-uk Kim prefix="<name>" equivalent to -P<name> 1983e102307SJung-uk Kim yyclass="<name>" set the name of the C++ scanning class 1993e102307SJung-uk Kim (see below) 2003e102307SJung-uk Kim 2013e102307SJung-uk Kim A number of %option's are available for lint purists who 2023e102307SJung-uk Kim want to suppress the appearance of unneeded routines in 2033e102307SJung-uk Kim the generated scanner. Each of the following, if unset, 2043e102307SJung-uk Kim results in the corresponding routine not appearing in the 2053e102307SJung-uk Kim generated scanner: 2063e102307SJung-uk Kim 2073e102307SJung-uk Kim input, unput 2083e102307SJung-uk Kim yy_push_state, yy_pop_state, yy_top_state 2093e102307SJung-uk Kim yy_scan_buffer, yy_scan_bytes, yy_scan_string 2103e102307SJung-uk Kim 2113e102307SJung-uk Kim You can specify multiple options with a single %option directive, 2123e102307SJung-uk Kim and multiple directives in the first section of your flex input file. 2133e102307SJung-uk Kim 2143e102307SJung-uk Kim - The new function: 2153e102307SJung-uk Kim 2163e102307SJung-uk Kim YY_BUFFER_STATE yy_scan_string( const char *str ) 2173e102307SJung-uk Kim 2183e102307SJung-uk Kim returns a YY_BUFFER_STATE (which also becomes the current input 2193e102307SJung-uk Kim buffer) for scanning the given string, which occurs starting 2203e102307SJung-uk Kim with the next call to yylex(). The string must be NUL-terminated. 2213e102307SJung-uk Kim A related function: 2223e102307SJung-uk Kim 2233e102307SJung-uk Kim YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) 2243e102307SJung-uk Kim 2253e102307SJung-uk Kim creates a buffer for scanning "len" bytes (including possibly NUL's) 2263e102307SJung-uk Kim starting at location "bytes". 2273e102307SJung-uk Kim 2283e102307SJung-uk Kim Note that both of these functions create and scan a *copy* of 2293e102307SJung-uk Kim the string/bytes. (This may be desirable, since yylex() modifies 2303e102307SJung-uk Kim the contents of the buffer it is scanning.) You can avoid the 2313e102307SJung-uk Kim copy by using: 2323e102307SJung-uk Kim 2333e102307SJung-uk Kim YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) 2343e102307SJung-uk Kim 2353e102307SJung-uk Kim which scans in place the buffer starting at "base", consisting 2363e102307SJung-uk Kim of "size" bytes, the last two bytes of which *must* be 2373e102307SJung-uk Kim YY_END_OF_BUFFER_CHAR (these bytes are not scanned; thus, scanning 2383e102307SJung-uk Kim consists of base[0] through base[size-2], inclusive). If you 2393e102307SJung-uk Kim fail to set up "base" in this manner, yy_scan_buffer returns a 2403e102307SJung-uk Kim nil pointer instead of creating a new input buffer. 2413e102307SJung-uk Kim 2423e102307SJung-uk Kim The type yy_size_t is an integral type to which you can cast 2433e102307SJung-uk Kim an integer expression reflecting the size of the buffer. 2443e102307SJung-uk Kim 2453e102307SJung-uk Kim - Three new routines are available for manipulating stacks of 2463e102307SJung-uk Kim start conditions: 2473e102307SJung-uk Kim 2483e102307SJung-uk Kim void yy_push_state( int new_state ) 2493e102307SJung-uk Kim 2503e102307SJung-uk Kim pushes the current start condition onto the top of the stack 2513e102307SJung-uk Kim and BEGIN's "new_state" (recall that start condition names are 2523e102307SJung-uk Kim also integers). 2533e102307SJung-uk Kim 2543e102307SJung-uk Kim void yy_pop_state() 2553e102307SJung-uk Kim 2563e102307SJung-uk Kim pops the top of the stack and BEGIN's to it, and 2573e102307SJung-uk Kim 2583e102307SJung-uk Kim int yy_top_state() 2593e102307SJung-uk Kim 2603e102307SJung-uk Kim returns the top of the stack without altering the stack's 2613e102307SJung-uk Kim contents. 2623e102307SJung-uk Kim 2633e102307SJung-uk Kim The start condition stack grows dynamically and so has no built-in 2643e102307SJung-uk Kim size limitation. If memory is exhausted, program execution 2653e102307SJung-uk Kim is aborted. 2663e102307SJung-uk Kim 2673e102307SJung-uk Kim To use start condition stacks, your scanner must include 2683e102307SJung-uk Kim a "%option stack" directive. 2693e102307SJung-uk Kim 2703e102307SJung-uk Kim - flex now supports POSIX character class expressions. These 2713e102307SJung-uk Kim are expressions enclosed inside "[:" and ":]" delimiters (which 2723e102307SJung-uk Kim themselves must appear between the '[' and ']' of a character 2733e102307SJung-uk Kim class; other elements may occur inside the character class, too). 2743e102307SJung-uk Kim The expressions flex recognizes are: 2753e102307SJung-uk Kim 2763e102307SJung-uk Kim [:alnum:] [:alpha:] [:blank:] [:cntrl:] [:digit:] [:graph:] 2773e102307SJung-uk Kim [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:] 2783e102307SJung-uk Kim 2793e102307SJung-uk Kim These expressions all designate a set of characters equivalent to 2803e102307SJung-uk Kim the corresponding isXXX function (for example, [:alnum:] designates 2813e102307SJung-uk Kim those characters for which isalnum() returns true - i.e., any 2823e102307SJung-uk Kim alphabetic or numeric). Some systems don't provide isblank(), 2833e102307SJung-uk Kim so flex defines [:blank:] as a blank or a tab. 2843e102307SJung-uk Kim 2853e102307SJung-uk Kim For example, the following character classes are all equivalent: 2863e102307SJung-uk Kim 2873e102307SJung-uk Kim [[:alnum:]] 2883e102307SJung-uk Kim [[:alpha:][:digit:] 2893e102307SJung-uk Kim [[:alpha:]0-9] 2903e102307SJung-uk Kim [a-zA-Z0-9] 2913e102307SJung-uk Kim 2923e102307SJung-uk Kim If your scanner is case-insensitive (-i flag), then [:upper:] 2933e102307SJung-uk Kim and [:lower:] are equivalent to [:alpha:]. 2943e102307SJung-uk Kim 2953e102307SJung-uk Kim - The promised rewrite of the C++ FlexLexer class has not yet 2963e102307SJung-uk Kim been done. Support for FlexLexer is limited at the moment to 2973e102307SJung-uk Kim fixing show-stopper bugs, so, for example, the new functions 2983e102307SJung-uk Kim yy_scan_string() & friends are not available to FlexLexer 2993e102307SJung-uk Kim objects. 3003e102307SJung-uk Kim 3013e102307SJung-uk Kim - The new macro 3023e102307SJung-uk Kim 3033e102307SJung-uk Kim yy_set_interactive(is_interactive) 3043e102307SJung-uk Kim 3053e102307SJung-uk Kim can be used to control whether the current buffer is considered 3063e102307SJung-uk Kim "interactive". An interactive buffer is processed more slowly, 3073e102307SJung-uk Kim but must be used when the scanner's input source is indeed 3083e102307SJung-uk Kim interactive to avoid problems due to waiting to fill buffers 3093e102307SJung-uk Kim (see the discussion of the -I flag in flex.1). A non-zero value 3103e102307SJung-uk Kim in the macro invocation marks the buffer as interactive, a zero 3113e102307SJung-uk Kim value as non-interactive. Note that use of this macro overrides 3123e102307SJung-uk Kim "%option always-interactive" or "%option never-interactive". 3133e102307SJung-uk Kim 3143e102307SJung-uk Kim yy_set_interactive() must be invoked prior to beginning to 3153e102307SJung-uk Kim scan the buffer. 3163e102307SJung-uk Kim 3173e102307SJung-uk Kim - The new macro 3183e102307SJung-uk Kim 3193e102307SJung-uk Kim yy_set_bol(at_bol) 3203e102307SJung-uk Kim 3213e102307SJung-uk Kim can be used to control whether the current buffer's scanning 3223e102307SJung-uk Kim context for the next token match is done as though at the 3233e102307SJung-uk Kim beginning of a line (non-zero macro argument; makes '^' anchored 3243e102307SJung-uk Kim rules active) or not at the beginning of a line (zero argument, 3253e102307SJung-uk Kim '^' rules inactive). 3263e102307SJung-uk Kim 3273e102307SJung-uk Kim - Related to this change, the mechanism for determining when a scan is 3283e102307SJung-uk Kim starting at the beginning of a line has changed. It used to be 3293e102307SJung-uk Kim that '^' was active iff the character prior to that at which the 3303e102307SJung-uk Kim scan started was a newline. The mechanism now is that '^' is 3313e102307SJung-uk Kim active iff the last token ended in a newline (or the last call to 3323e102307SJung-uk Kim input() returned a newline). For most users, the difference in 3333e102307SJung-uk Kim mechanisms is negligible. Where it will make a difference, 3343e102307SJung-uk Kim however, is if unput() or yyless() is used to alter the input 3353e102307SJung-uk Kim stream. When in doubt, use yy_set_bol(). 3363e102307SJung-uk Kim 3373e102307SJung-uk Kim - The new beginning-of-line mechanism involved changing some fairly 3383e102307SJung-uk Kim twisted code, so it may have introduced bugs - beware ... 3393e102307SJung-uk Kim 3403e102307SJung-uk Kim - The macro YY_AT_BOL() returns true if the next token scanned from 3413e102307SJung-uk Kim the current buffer will have '^' rules active, false otherwise. 3423e102307SJung-uk Kim 3433e102307SJung-uk Kim - The new function 3443e102307SJung-uk Kim 3453e102307SJung-uk Kim void yy_flush_buffer( struct yy_buffer_state* b ) 3463e102307SJung-uk Kim 3473e102307SJung-uk Kim flushes the contents of the current buffer (i.e., next time 3483e102307SJung-uk Kim the scanner attempts to match a token using b as the current 3493e102307SJung-uk Kim buffer, it will begin by invoking YY_INPUT to fill the buffer). 3503e102307SJung-uk Kim This routine is also available to C++ scanners (unlike some 3513e102307SJung-uk Kim of the other new routines). 3523e102307SJung-uk Kim 3533e102307SJung-uk Kim The related macro 3543e102307SJung-uk Kim 3553e102307SJung-uk Kim YY_FLUSH_BUFFER 3563e102307SJung-uk Kim 3573e102307SJung-uk Kim flushes the contents of the current buffer. 3583e102307SJung-uk Kim 3593e102307SJung-uk Kim - A new "-ooutput" option writes the generated scanner to "output". 3603e102307SJung-uk Kim If used with -t, the scanner is still written to stdout, but 3613e102307SJung-uk Kim its internal #line directives (see previous item) use "output". 3623e102307SJung-uk Kim 3633e102307SJung-uk Kim - Flex now generates #line directives relating the code it 3643e102307SJung-uk Kim produces to the output file; this means that error messages 3653e102307SJung-uk Kim in the flex-generated code should be correctly pinpointed. 3663e102307SJung-uk Kim 3673e102307SJung-uk Kim - When generating #line directives, filenames with embedded '\'s 3683e102307SJung-uk Kim have those characters escaped (i.e., turned into '\\'). This 3693e102307SJung-uk Kim feature helps with reporting filenames for some MS-DOS and OS/2 3703e102307SJung-uk Kim systems. 3713e102307SJung-uk Kim 3723e102307SJung-uk Kim - The FlexLexer class includes two new public member functions: 3733e102307SJung-uk Kim 3743e102307SJung-uk Kim virtual void switch_streams( istream* new_in = 0, 3753e102307SJung-uk Kim ostream* new_out = 0 ) 3763e102307SJung-uk Kim 3773e102307SJung-uk Kim reassigns yyin to new_in (if non-nil) and yyout to new_out 3783e102307SJung-uk Kim (ditto), deleting the previous input buffer if yyin is 3793e102307SJung-uk Kim reassigned. It is used by: 3803e102307SJung-uk Kim 3813e102307SJung-uk Kim int yylex( istream* new_in = 0, ostream* new_out = 0 ) 3823e102307SJung-uk Kim 3833e102307SJung-uk Kim which first calls switch_streams() and then returns the value 3843e102307SJung-uk Kim of calling yylex(). 3853e102307SJung-uk Kim 3863e102307SJung-uk Kim - C++ scanners now have yy_flex_debug as a member variable of 3873e102307SJung-uk Kim FlexLexer rather than a global, and member functions for testing 3883e102307SJung-uk Kim and setting it. 3893e102307SJung-uk Kim 3903e102307SJung-uk Kim - When generating a C++ scanning class, you can now use 3913e102307SJung-uk Kim 3923e102307SJung-uk Kim %option yyclass="foo" 3933e102307SJung-uk Kim 3943e102307SJung-uk Kim to inform flex that you have derived "foo" as a subclass of 3953e102307SJung-uk Kim yyFlexLexer, so flex will place your actions in the member 3963e102307SJung-uk Kim function foo::yylex() instead of yyFlexLexer::yylex(). It also 3973e102307SJung-uk Kim generates a yyFlexLexer::yylex() member function that generates a 3983e102307SJung-uk Kim run-time error if called (by invoking yyFlexLexer::LexerError()). 3993e102307SJung-uk Kim This feature is necessary if your subclass "foo" introduces some 4003e102307SJung-uk Kim additional member functions or variables that you need to access 4013e102307SJung-uk Kim from yylex(). 4023e102307SJung-uk Kim 4033e102307SJung-uk Kim - Current texinfo files in MISC/texinfo, contributed by Francois 4043e102307SJung-uk Kim Pinard. 4053e102307SJung-uk Kim 4063e102307SJung-uk Kim - You can now change the name "flex" to something else (e.g., "lex") 4073e102307SJung-uk Kim by redefining $(FLEX) in the Makefile. 4083e102307SJung-uk Kim 4093e102307SJung-uk Kim - Two bugs (one serious) that could cause "bigcheck" to fail have 4103e102307SJung-uk Kim been fixed. 4113e102307SJung-uk Kim 4123e102307SJung-uk Kim - A number of portability/configuration changes have been made 4133e102307SJung-uk Kim for easier portability. 4143e102307SJung-uk Kim 4153e102307SJung-uk Kim - You can use "YYSTATE" in your scanner as an alias for YY_START 4163e102307SJung-uk Kim (for AT&T lex compatibility). 4173e102307SJung-uk Kim 4183e102307SJung-uk Kim - input() now maintains yylineno. 4193e102307SJung-uk Kim 4203e102307SJung-uk Kim - input() no longer trashes yytext. 4213e102307SJung-uk Kim 4223e102307SJung-uk Kim - interactive scanners now read characters in YY_INPUT up to a 4233e102307SJung-uk Kim newline, a large performance gain. 4243e102307SJung-uk Kim 4253e102307SJung-uk Kim - C++ scanner objects now work with the -P option. You include 4263e102307SJung-uk Kim <FlexLexer.h> once per scanner - see comments in <FlexLexer.h> 4273e102307SJung-uk Kim (or flex.1) for details. 4283e102307SJung-uk Kim 4293e102307SJung-uk Kim - C++ FlexLexer objects now use the "cerr" stream to report -d output 4303e102307SJung-uk Kim instead of stdio. 4313e102307SJung-uk Kim 4323e102307SJung-uk Kim - The -c flag now has its full glorious POSIX interpretation (do 4333e102307SJung-uk Kim nothing), rather than being interpreted as an old-style -C flag. 4343e102307SJung-uk Kim 4353e102307SJung-uk Kim - Scanners generated by flex now include two #define's giving 4363e102307SJung-uk Kim the major and minor version numbers (YY_FLEX_MAJOR_VERSION, 4373e102307SJung-uk Kim YY_FLEX_MINOR_VERSION). These can then be tested to see 4383e102307SJung-uk Kim whether certain flex features are available. 4393e102307SJung-uk Kim 4403e102307SJung-uk Kim - Scanners generated using -l lex compatibility now have the symbol 4413e102307SJung-uk Kim YY_FLEX_LEX_COMPAT #define'd. 4423e102307SJung-uk Kim 4433e102307SJung-uk Kim - When initializing (i.e., yy_init is non-zero on entry to yylex()), 4443e102307SJung-uk Kim generated scanners now set yy_init to zero before executing 4453e102307SJung-uk Kim YY_USER_INIT. This means that you can set yy_init back to a 4463e102307SJung-uk Kim non-zero value in YY_USER_INIT if you need the scanner to be 4473e102307SJung-uk Kim reinitialized on the next call. 4483e102307SJung-uk Kim 4493e102307SJung-uk Kim - You can now use "#line" directives in the first section of your 4503e102307SJung-uk Kim scanner specification. 4513e102307SJung-uk Kim 4523e102307SJung-uk Kim - When generating full-table scanners (-Cf), flex now puts braces 4533e102307SJung-uk Kim around each row of the 2-d array initialization, to silence warnings 4543e102307SJung-uk Kim on over-zealous compilers. 4553e102307SJung-uk Kim 4563e102307SJung-uk Kim - Improved support for MS-DOS. The flex sources have been successfully 4573e102307SJung-uk Kim built, unmodified, for Borland 4.02 (all that's required is a 4583e102307SJung-uk Kim Borland Makefile and config.h file, which are supplied in 4593e102307SJung-uk Kim MISC/Borland - contributed by Terrence O Kane). 4603e102307SJung-uk Kim 4613e102307SJung-uk Kim - Improved support for Macintosh using Think C - the sources should 4623e102307SJung-uk Kim build for this platform "out of the box". Contributed by Scott 4633e102307SJung-uk Kim Hofmann. 4643e102307SJung-uk Kim 4653e102307SJung-uk Kim - Improved support for VMS, in MISC/VMS/, contributed by Pat Rankin. 4663e102307SJung-uk Kim 4673e102307SJung-uk Kim - Support for the Amiga, in MISC/Amiga/, contributed by Andreas 4683e102307SJung-uk Kim Scherer. Note that the contributed files were developed for 4693e102307SJung-uk Kim flex 2.4 and have not been tested with flex 2.5. 4703e102307SJung-uk Kim 4713e102307SJung-uk Kim - Some notes on support for the NeXT, in MISC/NeXT, contributed 4723e102307SJung-uk Kim by Raf Schietekat. 4733e102307SJung-uk Kim 4743e102307SJung-uk Kim - The MISC/ directory now includes a preformatted version of flex.1 4753e102307SJung-uk Kim in flex.man, and pre-yacc'd versions of parse.y in parse.{c,h}. 4763e102307SJung-uk Kim 4773e102307SJung-uk Kim - The flex.1 and flexdoc.1 manual pages have been merged. There 4783e102307SJung-uk Kim is now just one document, flex.1, which includes an overview 4793e102307SJung-uk Kim at the beginning to help you find the section you need. 4803e102307SJung-uk Kim 4813e102307SJung-uk Kim - Documentation now clarifies that start conditions persist across 4823e102307SJung-uk Kim switches to new input files or different input buffers. If you 4833e102307SJung-uk Kim want to e.g., return to INITIAL, you must explicitly do so. 4843e102307SJung-uk Kim 4853e102307SJung-uk Kim - The "Performance Considerations" section of the manual has been 4863e102307SJung-uk Kim updated. 4873e102307SJung-uk Kim 4883e102307SJung-uk Kim - Documented the "yy_act" variable, which when YY_USER_ACTION is 4893e102307SJung-uk Kim invoked holds the number of the matched rule, and added an 4903e102307SJung-uk Kim example of using yy_act to profile how often each rule is matched. 4913e102307SJung-uk Kim 4923e102307SJung-uk Kim - Added YY_NUM_RULES, a definition that gives the total number 4933e102307SJung-uk Kim of rules in the file, including the default rule (even if you 4943e102307SJung-uk Kim use -s). 4953e102307SJung-uk Kim 4963e102307SJung-uk Kim - Documentation now clarifies that you can pass a nil FILE* pointer 4973e102307SJung-uk Kim to yy_create_buffer() or yyrestart() if you've arrange YY_INPUT 4983e102307SJung-uk Kim to not need yyin. 4993e102307SJung-uk Kim 5003e102307SJung-uk Kim - Documentation now clarifies that YY_BUFFER_STATE is a pointer to 5013e102307SJung-uk Kim an opaque "struct yy_buffer_state". 5023e102307SJung-uk Kim 5033e102307SJung-uk Kim - Documentation now stresses that you gain the benefits of removing 5043e102307SJung-uk Kim backing-up states only if you remove *all* of them. 5053e102307SJung-uk Kim 5063e102307SJung-uk Kim - Documentation now points out that traditional lex allows you 5073e102307SJung-uk Kim to put the action on a separate line from the rule pattern if 5083e102307SJung-uk Kim the pattern has trailing whitespace (ugh!), but flex doesn't 5093e102307SJung-uk Kim support this. 5103e102307SJung-uk Kim 5113e102307SJung-uk Kim - A broken example in documentation of the difference between 5123e102307SJung-uk Kim inclusive and exclusive start conditions is now fixed. 5133e102307SJung-uk Kim 5143e102307SJung-uk Kim - Usage (-h) report now goes to stdout. 5153e102307SJung-uk Kim 5163e102307SJung-uk Kim - Version (-V) info now goes to stdout. 5173e102307SJung-uk Kim 5183e102307SJung-uk Kim - More #ifdef chud has been added to the parser in attempt to 5193e102307SJung-uk Kim deal with bison's use of alloca(). 5203e102307SJung-uk Kim 5213e102307SJung-uk Kim - "make clean" no longer deletes emacs backup files (*~). 5223e102307SJung-uk Kim 5233e102307SJung-uk Kim - Some memory leaks have been fixed. 5243e102307SJung-uk Kim 5253e102307SJung-uk Kim - A bug was fixed in which dynamically-expanded buffers were 5263e102307SJung-uk Kim reallocated a couple of bytes too small. 5273e102307SJung-uk Kim 5283e102307SJung-uk Kim - A bug was fixed which could cause flex to read and write beyond 5293e102307SJung-uk Kim the end of the input buffer. 5303e102307SJung-uk Kim 5313e102307SJung-uk Kim - -S will not be going away. 5323e102307SJung-uk Kim 5333e102307SJung-uk Kim 5343e102307SJung-uk KimChanges between release 2.4.7 (03Aug94) and release 2.4.6: 5353e102307SJung-uk Kim 5363e102307SJung-uk Kim - Fixed serious bug in reading multiple files. 5373e102307SJung-uk Kim 5383e102307SJung-uk Kim - Fixed bug in scanning NUL's. 5393e102307SJung-uk Kim 5403e102307SJung-uk Kim - Fixed bug in input() returning 8-bit characters. 5413e102307SJung-uk Kim 5423e102307SJung-uk Kim - Fixed bug in matching text with embedded NUL's when 5433e102307SJung-uk Kim using %array or lex compatibility. 5443e102307SJung-uk Kim 5453e102307SJung-uk Kim - Fixed multiple invocations of YY_USER_ACTION when using '|' 5463e102307SJung-uk Kim continuation action. 5473e102307SJung-uk Kim 5483e102307SJung-uk Kim - Minor prototyping fixes. 5493e102307SJung-uk Kim 5503e102307SJung-uk KimChanges between release 2.4.6 (04Jan94) and release 2.4.5: 5513e102307SJung-uk Kim 5523e102307SJung-uk Kim - Linking with -lfl no longer required if your program includes 5533e102307SJung-uk Kim its own yywrap() and main() functions. (This change will cause 5543e102307SJung-uk Kim problems if you have a non-ANSI compiler on a system for which 5553e102307SJung-uk Kim sizeof(int) != sizeof(void*) or sizeof(int) != sizeof(size_t).) 5563e102307SJung-uk Kim 5573e102307SJung-uk Kim - The use of 'extern "C++"' in FlexLexer.h has been modified to 5583e102307SJung-uk Kim get around an incompatibility with g++'s header files. 5593e102307SJung-uk Kim 5603e102307SJung-uk KimChanges between release 2.4.5 (11Dec93) and release 2.4.4: 5613e102307SJung-uk Kim 5623e102307SJung-uk Kim - Fixed bug breaking C++ scanners that use REJECT or variable 5633e102307SJung-uk Kim trailing context. 5643e102307SJung-uk Kim 5653e102307SJung-uk Kim - Fixed serious input problem for interactive scanners on 5663e102307SJung-uk Kim systems for which char is unsigned. 5673e102307SJung-uk Kim 5683e102307SJung-uk Kim - Fixed bug in incorrectly treating '$' operator as variable 5693e102307SJung-uk Kim trailing context. 5703e102307SJung-uk Kim 5713e102307SJung-uk Kim - Fixed bug in -CF table representation that could lead to 5723e102307SJung-uk Kim corrupt tables. 5733e102307SJung-uk Kim 5743e102307SJung-uk Kim - Fixed fairly benign memory leak. 5753e102307SJung-uk Kim 5763e102307SJung-uk Kim - Added `extern "C++"' wrapper to FlexLexer.h header. This 5773e102307SJung-uk Kim should overcome the g++ 2.5.X problems mentioned in the 5783e102307SJung-uk Kim NEWS for release 2.4.3. 5793e102307SJung-uk Kim 5803e102307SJung-uk Kim - Changed #include of FlexLexer.h to use <> instead of "". 5813e102307SJung-uk Kim 5823e102307SJung-uk Kim - Added feature to control whether the scanner attempts to 5833e102307SJung-uk Kim refill the input buffer once it's exhausted. This feature 5843e102307SJung-uk Kim will be documented in the 2.5 release. 5853e102307SJung-uk Kim 5863e102307SJung-uk Kim 5873e102307SJung-uk KimChanges between release 2.4.4 (07Dec93) and release 2.4.3: 5883e102307SJung-uk Kim 5893e102307SJung-uk Kim - Fixed two serious bugs in scanning 8-bit characters. 5903e102307SJung-uk Kim 5913e102307SJung-uk Kim - Fixed bug in YY_USER_ACTION that caused it to be executed 5923e102307SJung-uk Kim inappropriately (on the scanner's own internal actions, and 5933e102307SJung-uk Kim with incorrect yytext/yyleng values). 5943e102307SJung-uk Kim 5953e102307SJung-uk Kim - Fixed bug in pointing yyin at a new file and resuming scanning. 5963e102307SJung-uk Kim 5973e102307SJung-uk Kim - Portability fix regarding min/max/abs macros conflicting with 5983e102307SJung-uk Kim function definitions in standard header files. 5993e102307SJung-uk Kim 6003e102307SJung-uk Kim - Added a virtual LexerError() method to the C++ yyFlexLexer class 6013e102307SJung-uk Kim for reporting error messages instead of always using cerr. 6023e102307SJung-uk Kim 6033e102307SJung-uk Kim - Added warning in flexdoc that the C++ scanning class is presently 6043e102307SJung-uk Kim experimental and subject to considerable change between major 6053e102307SJung-uk Kim releases. 6063e102307SJung-uk Kim 6073e102307SJung-uk Kim 6083e102307SJung-uk KimChanges between release 2.4.3 (03Dec93) and release 2.4.2: 6093e102307SJung-uk Kim 6103e102307SJung-uk Kim - Fixed bug causing fatal scanner messages to fail to print. 6113e102307SJung-uk Kim 6123e102307SJung-uk Kim - Fixed things so FlexLexer.h can be included in other C++ 6133e102307SJung-uk Kim sources. One side-effect of this change is that -+ and -CF 6143e102307SJung-uk Kim are now incompatible. 6153e102307SJung-uk Kim 616*e1fc1971SJung-uk Kim - libfl.a now supplies private versions of the <string.h>/ 6173e102307SJung-uk Kim <strings.h> string routines needed by flex and the scanners 6183e102307SJung-uk Kim it generates, to enhance portability to some BSD systems. 6193e102307SJung-uk Kim 6203e102307SJung-uk Kim - More robust solution to 2.4.2's flexfatal() bug fix. 6213e102307SJung-uk Kim 6223e102307SJung-uk Kim - Added ranlib of installed libfl.a. 6233e102307SJung-uk Kim 6243e102307SJung-uk Kim - Some lint tweaks. 6253e102307SJung-uk Kim 6263e102307SJung-uk Kim - NOTE: problems have been encountered attempting to build flex 6273e102307SJung-uk Kim C++ scanners using g++ version 2.5.X. The problem is due to an 6283e102307SJung-uk Kim unfortunate heuristic in g++ 2.5.X that attempts to discern between 6293e102307SJung-uk Kim C and C++ headers. Because FlexLexer.h is installed (by default) 6303e102307SJung-uk Kim in /usr/local/include and not /usr/local/lib/g++-include, g++ 2.5.X 6313e102307SJung-uk Kim decides that it's a C header :-(. So if you have problems, install 6323e102307SJung-uk Kim the header in /usr/local/lib/g++-include instead. 6333e102307SJung-uk Kim 6343e102307SJung-uk Kim 6353e102307SJung-uk KimChanges between release 2.4.2 (01Dec93) and release 2.4.1: 6363e102307SJung-uk Kim 6373e102307SJung-uk Kim - Fixed bug in libfl.a referring to non-existent "flexfatal" function. 6383e102307SJung-uk Kim 6393e102307SJung-uk Kim - Modified to produce both compress'd and gzip'd tar files for 6403e102307SJung-uk Kim distributions (you probably don't care about this change!). 6413e102307SJung-uk Kim 6423e102307SJung-uk Kim 6433e102307SJung-uk KimChanges between release 2.4.1 (30Nov93) and release 2.3.8: 6443e102307SJung-uk Kim 6453e102307SJung-uk Kim - The new '-+' flag instructs flex to generate a C++ scanner class 6463e102307SJung-uk Kim (thanks to Kent Williams). flex writes an implementation of the 6473e102307SJung-uk Kim class defined in FlexLexer.h to lex.yy.cc. You may include 6483e102307SJung-uk Kim multiple scanner classes in your program using the -P flag. Note 6493e102307SJung-uk Kim that the scanner class also provides a mechanism for creating 6503e102307SJung-uk Kim reentrant scanners. The scanner class uses C++ streams for I/O 6513e102307SJung-uk Kim instead of FILE*'s (thanks to Tom Epperly). If the flex executable's 6523e102307SJung-uk Kim name ends in '+' then the '-+' flag is automatically on, so creating 6533e102307SJung-uk Kim a symlink or copy of "flex" to "flex++" results in a version of 6543e102307SJung-uk Kim flex that can be used exclusively for C++ scanners. 6553e102307SJung-uk Kim 6563e102307SJung-uk Kim Note that without the '-+' flag, flex-generated scanners can still 6573e102307SJung-uk Kim be compiled using C++ compilers, though they use FILE*'s for I/O 6583e102307SJung-uk Kim instead of streams. 6593e102307SJung-uk Kim 6603e102307SJung-uk Kim See the "GENERATING C++ SCANNERS" section of flexdoc for details. 6613e102307SJung-uk Kim 6623e102307SJung-uk Kim - The new '-l' flag turns on maximum AT&T lex compatibility. In 6633e102307SJung-uk Kim particular, -l includes support for "yylineno" and makes yytext 6643e102307SJung-uk Kim be an array instead of a pointer. It does not, however, do away 6653e102307SJung-uk Kim with all incompatibilities. See the "INCOMPATIBILITIES WITH LEX 6663e102307SJung-uk Kim AND POSIX" section of flexdoc for details. 6673e102307SJung-uk Kim 6683e102307SJung-uk Kim - The new '-P' option specifies a prefix to use other than "yy" 6693e102307SJung-uk Kim for the scanner's globally-visible variables, and for the 6703e102307SJung-uk Kim "lex.yy.c" filename. Using -P you can link together multiple 6713e102307SJung-uk Kim flex scanners in the same executable. 6723e102307SJung-uk Kim 6733e102307SJung-uk Kim - The distribution includes a "texinfo" version of flexdoc.1, 6743e102307SJung-uk Kim contributed by Roland Pesch (thanks also to Marq Kole, who 6753e102307SJung-uk Kim contributed another version). It has not been brought up to 6763e102307SJung-uk Kim date, but reflects version 2.3. See MISC/flex.texinfo. 6773e102307SJung-uk Kim 6783e102307SJung-uk Kim The flex distribution will soon include G.T. Nicol's flex 6793e102307SJung-uk Kim manual; he is presently bringing it up-to-date for version 2.4. 6803e102307SJung-uk Kim 6813e102307SJung-uk Kim - yywrap() is now a function, and you now *must* link flex scanners 6823e102307SJung-uk Kim with libfl.a. 6833e102307SJung-uk Kim 6843e102307SJung-uk Kim - Site-configuration is now done via an autoconf-generated 6853e102307SJung-uk Kim "configure" script contributed by Francois Pinard. 6863e102307SJung-uk Kim 6873e102307SJung-uk Kim - Scanners now use fread() (or getc(), if interactive) and not 6883e102307SJung-uk Kim read() for input. A new "table compression" option, -Cr, 6893e102307SJung-uk Kim overrides this change and causes the scanner to use read() 6903e102307SJung-uk Kim (because read() is a bit faster than fread()). -f and -F 6913e102307SJung-uk Kim are now equivalent to -Cfr and -CFr; i.e., they imply the 6923e102307SJung-uk Kim -Cr option. 6933e102307SJung-uk Kim 6943e102307SJung-uk Kim - In the blessed name of POSIX compliance, flex supports "%array" 6953e102307SJung-uk Kim and "%pointer" directives in the definitions (first) section of 6963e102307SJung-uk Kim the scanner specification. The former specifies that yytext 6973e102307SJung-uk Kim should be an array (of size YYLMAX), the latter, that it should 6983e102307SJung-uk Kim be a pointer. The array version of yytext is universally slower 6993e102307SJung-uk Kim than the pointer version, but has the advantage that its contents 7003e102307SJung-uk Kim remain unmodified across calls to input() and unput() (the pointer 7013e102307SJung-uk Kim version of yytext is, still, trashed by such calls). 7023e102307SJung-uk Kim 7033e102307SJung-uk Kim "%array" cannot be used with the '-+' C++ scanner class option. 7043e102307SJung-uk Kim 7053e102307SJung-uk Kim - The new '-Ca' option directs flex to trade off memory for 7063e102307SJung-uk Kim natural alignment when generating a scanner's tables. In 7073e102307SJung-uk Kim particular, table entries that would otherwise be "short" 7083e102307SJung-uk Kim become "long". 7093e102307SJung-uk Kim 7103e102307SJung-uk Kim - The new '-h' option produces a summary of the flex flags. 7113e102307SJung-uk Kim 7123e102307SJung-uk Kim - The new '-V' option reports the flex version number and exits. 7133e102307SJung-uk Kim 7143e102307SJung-uk Kim - The new scanner macro YY_START returns an integer value 7153e102307SJung-uk Kim corresponding to the current start condition. You can return 7163e102307SJung-uk Kim to that start condition by passing the value to a subsequent 7173e102307SJung-uk Kim "BEGIN" action. You also can implement "start condition stacks" 7183e102307SJung-uk Kim by storing the values in an integer stack. 7193e102307SJung-uk Kim 7203e102307SJung-uk Kim - You can now redefine macros such as YY_INPUT by just #define'ing 7213e102307SJung-uk Kim them to some other value in the first section of the flex input; 7223e102307SJung-uk Kim no need to first #undef them. 7233e102307SJung-uk Kim 7243e102307SJung-uk Kim - flex now generates warnings for rules that can't be matched. 7253e102307SJung-uk Kim These warnings can be turned off using the new '-w' flag. If 7263e102307SJung-uk Kim your scanner uses REJECT then you will not get these warnings. 7273e102307SJung-uk Kim 7283e102307SJung-uk Kim - If you specify the '-s' flag but the default rule can be matched, 7293e102307SJung-uk Kim flex now generates a warning. 7303e102307SJung-uk Kim 7313e102307SJung-uk Kim - "yyleng" is now a global, and may be modified by the user (though 7323e102307SJung-uk Kim doing so and then using yymore() will yield weird results). 7333e102307SJung-uk Kim 7343e102307SJung-uk Kim - Name definitions in the first section of a scanner specification 7353e102307SJung-uk Kim can now include a leading '^' or trailing '$' operator. In this 7363e102307SJung-uk Kim case, the definition is *not* pushed back inside of parentheses. 7373e102307SJung-uk Kim 7383e102307SJung-uk Kim - Scanners with compressed tables are now "interactive" (-I option) 7393e102307SJung-uk Kim by default. You can suppress this attribute (which makes them 7403e102307SJung-uk Kim run slightly slower) using the new '-B' flag. 7413e102307SJung-uk Kim 7423e102307SJung-uk Kim - Flex now generates 8-bit scanners by default, unless you use the 7433e102307SJung-uk Kim -Cf or -CF compression options (-Cfe and -CFe result in 8-bit 7443e102307SJung-uk Kim scanners). You can force it to generate a 7-bit scanner using 7453e102307SJung-uk Kim the new '-7' flag. You can build flex to generate 8-bit scanners 7463e102307SJung-uk Kim for -Cf and -CF, too, by adding -DDEFAULT_CSIZE=256 to CFLAGS 7473e102307SJung-uk Kim in the Makefile. 7483e102307SJung-uk Kim 7493e102307SJung-uk Kim - You no longer need to call the scanner routine yyrestart() to 7503e102307SJung-uk Kim inform the scanner that you have switched to a new file after 7513e102307SJung-uk Kim having seen an EOF on the current input file. Instead, just 7523e102307SJung-uk Kim point yyin at the new file and continue scanning. 7533e102307SJung-uk Kim 7543e102307SJung-uk Kim - You no longer need to invoke YY_NEW_FILE in an <<EOF>> action 7553e102307SJung-uk Kim to indicate you wish to continue scanning. Simply point yyin 7563e102307SJung-uk Kim at a new file. 7573e102307SJung-uk Kim 7583e102307SJung-uk Kim - A leading '#' no longer introduces a comment in a flex input. 7593e102307SJung-uk Kim 7603e102307SJung-uk Kim - flex no longer considers formfeed ('\f') a whitespace character. 7613e102307SJung-uk Kim 7623e102307SJung-uk Kim - %t, I'm happy to report, has been nuked. 7633e102307SJung-uk Kim 7643e102307SJung-uk Kim - The '-p' option may be given twice ('-pp') to instruct flex to 7653e102307SJung-uk Kim report minor performance problems as well as major ones. 7663e102307SJung-uk Kim 7673e102307SJung-uk Kim - The '-v' verbose output no longer includes start/finish time 7683e102307SJung-uk Kim information. 7693e102307SJung-uk Kim 7703e102307SJung-uk Kim - Newlines in flex inputs can optionally include leading or 7713e102307SJung-uk Kim trailing carriage-returns ('\r'), in support of several PC/Mac 7723e102307SJung-uk Kim run-time libraries that automatically include these. 7733e102307SJung-uk Kim 7743e102307SJung-uk Kim - A start condition of the form "<*>" makes the following rule 7753e102307SJung-uk Kim active in every start condition, whether exclusive or inclusive. 7763e102307SJung-uk Kim 7773e102307SJung-uk Kim - The following items have been corrected in the flex documentation: 7783e102307SJung-uk Kim 7793e102307SJung-uk Kim - '-C' table compression options *are* cumulative. 7803e102307SJung-uk Kim 7813e102307SJung-uk Kim - You may modify yytext but not lengthen it by appending 7823e102307SJung-uk Kim characters to the end. Modifying its final character 7833e102307SJung-uk Kim will affect '^' anchoring for the next rule matched 7843e102307SJung-uk Kim if the character is changed to or from a newline. 7853e102307SJung-uk Kim 7863e102307SJung-uk Kim - The term "backtracking" has been renamed "backing up", 7873e102307SJung-uk Kim since it is a one-time repositioning and not a repeated 7883e102307SJung-uk Kim search. What used to be the "lex.backtrack" file is now 7893e102307SJung-uk Kim "lex.backup". 7903e102307SJung-uk Kim 7913e102307SJung-uk Kim - Unindented "/* ... */" comments are allowed in the first 7923e102307SJung-uk Kim flex input section, but not in the second. 7933e102307SJung-uk Kim 7943e102307SJung-uk Kim - yyless() can only be used in the flex input source, not 7953e102307SJung-uk Kim externally. 7963e102307SJung-uk Kim 7973e102307SJung-uk Kim - You can use "yyrestart(yyin)" to throw away the 7983e102307SJung-uk Kim current contents of the input buffer. 7993e102307SJung-uk Kim 8003e102307SJung-uk Kim - To write high-speed scanners, attempt to match as much 8013e102307SJung-uk Kim text as possible with each rule. See MISC/fastwc/README 8023e102307SJung-uk Kim for more information. 8033e102307SJung-uk Kim 8043e102307SJung-uk Kim - Using the beginning-of-line operator ('^') is fairly 8053e102307SJung-uk Kim cheap. Using unput() is expensive. Using yyless() is 8063e102307SJung-uk Kim cheap. 8073e102307SJung-uk Kim 8083e102307SJung-uk Kim - An example of scanning strings with embedded escape 8093e102307SJung-uk Kim sequences has been added. 8103e102307SJung-uk Kim 8113e102307SJung-uk Kim - The example of backing-up in flexdoc was erroneous; it 8123e102307SJung-uk Kim has been corrected. 8133e102307SJung-uk Kim 8143e102307SJung-uk Kim - A flex scanner's internal buffer now dynamically grows if needed 8153e102307SJung-uk Kim to match large tokens. Note that growing the buffer presently 8163e102307SJung-uk Kim requires rescanning the (large) token, so consuming a lot of 8173e102307SJung-uk Kim text this way is a slow process. Also note that presently the 8183e102307SJung-uk Kim buffer does *not* grow if you unput() more text than can fit 8193e102307SJung-uk Kim into the buffer. 8203e102307SJung-uk Kim 8213e102307SJung-uk Kim - The MISC/ directory has been reorganized; see MISC/README for 8223e102307SJung-uk Kim details. 8233e102307SJung-uk Kim 8243e102307SJung-uk Kim - yyless() can now be used in the third (user action) section 8253e102307SJung-uk Kim of a scanner specification, thanks to Ceriel Jacobs. yyless() 8263e102307SJung-uk Kim remains a macro and cannot be used outside of the scanner source. 8273e102307SJung-uk Kim 8283e102307SJung-uk Kim - The skeleton file is no longer opened at run-time, but instead 8293e102307SJung-uk Kim compiled into a large string array (thanks to John Gilmore and 8303e102307SJung-uk Kim friends at Cygnus). You can still use the -S flag to point flex 8313e102307SJung-uk Kim at a different skeleton file. 8323e102307SJung-uk Kim 8333e102307SJung-uk Kim - flex no longer uses a temporary file to store the scanner's 8343e102307SJung-uk Kim actions. 8353e102307SJung-uk Kim 8363e102307SJung-uk Kim - A number of changes have been made to decrease porting headaches. 8373e102307SJung-uk Kim In particular, flex no longer uses memset() or ctime(), and 8383e102307SJung-uk Kim provides a single simple mechanism for dealing with C compilers 8393e102307SJung-uk Kim that still define malloc() as returning char* instead of void*. 8403e102307SJung-uk Kim 8413e102307SJung-uk Kim - Flex now detects if the scanner specification requires the -8 flag 8423e102307SJung-uk Kim but the flag was not given or on by default. 8433e102307SJung-uk Kim 8443e102307SJung-uk Kim - A number of table-expansion fencepost bugs have been fixed, 8453e102307SJung-uk Kim making flex more robust for generating large scanners. 8463e102307SJung-uk Kim 8473e102307SJung-uk Kim - flex more consistently identifies the location of errors in 8483e102307SJung-uk Kim its input. 8493e102307SJung-uk Kim 8503e102307SJung-uk Kim - YY_USER_ACTION is now invoked only for "real" actions, not for 8513e102307SJung-uk Kim internal actions used by the scanner for things like filling 8523e102307SJung-uk Kim the buffer or handling EOF. 8533e102307SJung-uk Kim 8543e102307SJung-uk Kim - The rule "[^]]" now matches any character other than a ']'; 8553e102307SJung-uk Kim formerly it matched any character at all followed by a ']'. 8563e102307SJung-uk Kim This change was made for compatibility with AT&T lex. 8573e102307SJung-uk Kim 8583e102307SJung-uk Kim - A large number of miscellaneous bugs have been found and fixed 8593e102307SJung-uk Kim thanks to Gerhard Wilhelms. 8603e102307SJung-uk Kim 8613e102307SJung-uk Kim - The source code has been heavily reformatted, making patches 8623e102307SJung-uk Kim relative to previous flex releases no longer accurate. 8633e102307SJung-uk Kim 8643e102307SJung-uk Kim 8653e102307SJung-uk KimChanges between 2.3 Patch #8 (21Feb93) and 2.3 Patch #7: 8663e102307SJung-uk Kim 8673e102307SJung-uk Kim - Fixed bugs in dynamic memory allocation leading to grievous 8683e102307SJung-uk Kim fencepost problems when generating large scanners. 8693e102307SJung-uk Kim - Fixed bug causing infinite loops on character classes with 8-bit 8703e102307SJung-uk Kim characters in them. 8713e102307SJung-uk Kim - Fixed bug in matching repetitions with a lower bound of 0. 8723e102307SJung-uk Kim - Fixed bug in scanning NUL characters using an "interactive" scanner. 8733e102307SJung-uk Kim - Fixed bug in using yymore() at the end of a file. 8743e102307SJung-uk Kim - Fixed bug in misrecognizing rules with variable trailing context. 8753e102307SJung-uk Kim - Fixed bug compiling flex on Suns using gcc 2. 8763e102307SJung-uk Kim - Fixed bug in not recognizing that input files with the character 8773e102307SJung-uk Kim ASCII 128 in them require the -8 flag. 8783e102307SJung-uk Kim - Fixed bug that could cause an infinite loop writing out 8793e102307SJung-uk Kim error messages. 8803e102307SJung-uk Kim - Fixed bug in not recognizing old-style lex % declarations if 8813e102307SJung-uk Kim followed by a tab instead of a space. 8823e102307SJung-uk Kim - Fixed potential crash when flex terminated early (usually due 8833e102307SJung-uk Kim to a bad flag) and the -v flag had been given. 8843e102307SJung-uk Kim - Added some missing declarations of void functions. 8853e102307SJung-uk Kim - Changed to only use '\a' for __STDC__ compilers. 8863e102307SJung-uk Kim - Updated mailing addresses. 8873e102307SJung-uk Kim 8883e102307SJung-uk Kim 8893e102307SJung-uk KimChanges between 2.3 Patch #7 (28Mar91) and 2.3 Patch #6: 8903e102307SJung-uk Kim 8913e102307SJung-uk Kim - Fixed out-of-bounds array access that caused bad tables 8923e102307SJung-uk Kim to be produced on machines where the bad reference happened 8933e102307SJung-uk Kim to yield a 1. This caused problems installing or running 8943e102307SJung-uk Kim flex on some Suns, in particular. 8953e102307SJung-uk Kim 8963e102307SJung-uk Kim 8973e102307SJung-uk KimChanges between 2.3 Patch #6 (29Aug90) and 2.3 Patch #5: 8983e102307SJung-uk Kim 8993e102307SJung-uk Kim - Fixed a serious bug in yymore() which basically made it 9003e102307SJung-uk Kim completely broken. Thanks goes to Jean Christophe of 9013e102307SJung-uk Kim the Nethack development team for finding the problem 9023e102307SJung-uk Kim and passing along the fix. 9033e102307SJung-uk Kim 9043e102307SJung-uk Kim 9053e102307SJung-uk KimChanges between 2.3 Patch #5 (16Aug90) and 2.3 Patch #4: 9063e102307SJung-uk Kim 9073e102307SJung-uk Kim - An up-to-date version of initscan.c so "make test" will 9083e102307SJung-uk Kim work after applying the previous patches 9093e102307SJung-uk Kim 9103e102307SJung-uk Kim 9113e102307SJung-uk KimChanges between 2.3 Patch #4 (14Aug90) and 2.3 Patch #3: 9123e102307SJung-uk Kim 9133e102307SJung-uk Kim - Fixed bug in hexadecimal escapes which allowed only digits, 9143e102307SJung-uk Kim not letters, in escapes 9153e102307SJung-uk Kim - Fixed bug in previous "Changes" file! 9163e102307SJung-uk Kim 9173e102307SJung-uk Kim 9183e102307SJung-uk KimChanges between 2.3 Patch #3 (03Aug90) and 2.3 Patch #2: 9193e102307SJung-uk Kim 9203e102307SJung-uk Kim - Correction to patch #2 for gcc compilation; thanks goes to 9213e102307SJung-uk Kim Paul Eggert for catching this. 9223e102307SJung-uk Kim 9233e102307SJung-uk Kim 9243e102307SJung-uk KimChanges between 2.3 Patch #2 (02Aug90) and original 2.3 release: 9253e102307SJung-uk Kim 9263e102307SJung-uk Kim - Fixed (hopefully) headaches involving declaring malloc() 9273e102307SJung-uk Kim and free() for gcc, which defines __STDC__ but (often) doesn't 9283e102307SJung-uk Kim come with the standard include files such as <stdlib.h>. 9293e102307SJung-uk Kim Reordered #ifdef maze in the scanner skeleton in the hope of 9303e102307SJung-uk Kim getting the declarations right for cfront and g++, too. 9313e102307SJung-uk Kim 9323e102307SJung-uk Kim - Note that this patch supercedes patch #1 for release 2.3, 9333e102307SJung-uk Kim which was never announced but was available briefly for 9343e102307SJung-uk Kim anonymous ftp. 9353e102307SJung-uk Kim 9363e102307SJung-uk Kim 9373e102307SJung-uk KimChanges between 2.3 (full) release of 28Jun90 and 2.2 (alpha) release: 9383e102307SJung-uk Kim 9393e102307SJung-uk KimUser-visible: 9403e102307SJung-uk Kim 9413e102307SJung-uk Kim - A lone <<EOF>> rule (that is, one which is not qualified with 9423e102307SJung-uk Kim a list of start conditions) now specifies the EOF action for 9433e102307SJung-uk Kim *all* start conditions which haven't already had <<EOF>> actions 9443e102307SJung-uk Kim given. To specify an end-of-file action for just the initial 9453e102307SJung-uk Kim state, use <INITIAL><<EOF>>. 9463e102307SJung-uk Kim 947*e1fc1971SJung-uk Kim - -d debug output is now contingent on the global yy_flex_debug 9483e102307SJung-uk Kim being set to a non-zero value, which it is by default. 9493e102307SJung-uk Kim 9503e102307SJung-uk Kim - A new macro, YY_USER_INIT, is provided for the user to specify 9513e102307SJung-uk Kim initialization action to be taken on the first call to the 9523e102307SJung-uk Kim scanner. This action is done before the scanner does its 9533e102307SJung-uk Kim own initialization. 9543e102307SJung-uk Kim 9553e102307SJung-uk Kim - yy_new_buffer() has been added as an alias for yy_create_buffer() 9563e102307SJung-uk Kim 9573e102307SJung-uk Kim - Comments beginning with '#' and extending to the end of the line 9583e102307SJung-uk Kim now work, but have been deprecated (in anticipation of making 9593e102307SJung-uk Kim flex recognize #line directives). 9603e102307SJung-uk Kim 9613e102307SJung-uk Kim - The funky restrictions on when semi-colons could follow the 9623e102307SJung-uk Kim YY_NEW_FILE and yyless macros have been removed. They now 9633e102307SJung-uk Kim behave identically to functions. 9643e102307SJung-uk Kim 9653e102307SJung-uk Kim - A bug in the sample redefinition of YY_INPUT in the documentation 9663e102307SJung-uk Kim has been corrected. 9673e102307SJung-uk Kim 9683e102307SJung-uk Kim - A bug in the sample simple tokener in the documentation has 9693e102307SJung-uk Kim been corrected. 9703e102307SJung-uk Kim 9713e102307SJung-uk Kim - The documentation on the incompatibilities between flex and 9723e102307SJung-uk Kim lex has been reordered so that the discussion of yylineno 9733e102307SJung-uk Kim and input() come first, as it's anticipated that these will 9743e102307SJung-uk Kim be the most common source of headaches. 9753e102307SJung-uk Kim 9763e102307SJung-uk Kim 9773e102307SJung-uk KimThings which didn't used to be documented but now are: 9783e102307SJung-uk Kim 9793e102307SJung-uk Kim - flex interprets "^foo|bar" differently from lex. flex interprets 9803e102307SJung-uk Kim it as "match either a 'foo' or a 'bar', providing it comes at the 9813e102307SJung-uk Kim beginning of a line", whereas lex interprets it as "match either 9823e102307SJung-uk Kim a 'foo' at the beginning of a line, or a 'bar' anywhere". 9833e102307SJung-uk Kim 9843e102307SJung-uk Kim - flex initializes the global "yyin" on the first call to the 9853e102307SJung-uk Kim scanner, while lex initializes it at compile-time. 9863e102307SJung-uk Kim 9873e102307SJung-uk Kim - yy_switch_to_buffer() can be used in the yywrap() macro/routine. 9883e102307SJung-uk Kim 9893e102307SJung-uk Kim - flex scanners do not use stdio for their input, and hence when 990*e1fc1971SJung-uk Kim writing an interactive scanner one must explicitly call fflush() 9913e102307SJung-uk Kim after writing out a prompt. 9923e102307SJung-uk Kim 9933e102307SJung-uk Kim - flex scanner can be made reentrant (after a fashion) by using 9943e102307SJung-uk Kim "yyrestart( yyin );". This is useful for interactive scanners 9953e102307SJung-uk Kim which have interrupt handlers that long-jump out of the scanner. 9963e102307SJung-uk Kim 9973e102307SJung-uk Kim - a defense of why yylineno is not supported is included, along 9983e102307SJung-uk Kim with a suggestion on how to convert scanners which rely on it. 9993e102307SJung-uk Kim 10003e102307SJung-uk Kim 10013e102307SJung-uk KimOther changes: 10023e102307SJung-uk Kim 10033e102307SJung-uk Kim - Prototypes and proper declarations of void routines have 10043e102307SJung-uk Kim been added to the flex source code, courtesy of Kevin B. Kenny. 10053e102307SJung-uk Kim 10063e102307SJung-uk Kim - Routines dealing with memory allocation now use void* pointers 10073e102307SJung-uk Kim instead of char* - see Makefile for porting implications. 10083e102307SJung-uk Kim 10093e102307SJung-uk Kim - Error-checking is now done when flex closes a file. 10103e102307SJung-uk Kim 10113e102307SJung-uk Kim - Various lint tweaks were added to reduce the number of gripes. 10123e102307SJung-uk Kim 10133e102307SJung-uk Kim - Makefile has been further parameterized to aid in porting. 10143e102307SJung-uk Kim 10153e102307SJung-uk Kim - Support for SCO Unix added. 10163e102307SJung-uk Kim 10173e102307SJung-uk Kim - Flex now sports the latest & greatest UC copyright notice 10183e102307SJung-uk Kim (which is only slightly different from the previous one). 10193e102307SJung-uk Kim 10203e102307SJung-uk Kim - A note has been added to flexdoc.1 mentioning work in progress 10213e102307SJung-uk Kim on modifying flex to generate straight C code rather than a 10223e102307SJung-uk Kim table-driven automaton, with an email address of whom to contact 10233e102307SJung-uk Kim if you are working along similar lines. 10243e102307SJung-uk Kim 10253e102307SJung-uk Kim 10263e102307SJung-uk KimChanges between 2.2 Patch #3 (30Mar90) and 2.2 Patch #2: 10273e102307SJung-uk Kim 10283e102307SJung-uk Kim - fixed bug which caused -I scanners to bomb 10293e102307SJung-uk Kim 10303e102307SJung-uk Kim 10313e102307SJung-uk KimChanges between 2.2 Patch #2 (27Mar90) and 2.2 Patch #1: 10323e102307SJung-uk Kim 10333e102307SJung-uk Kim - fixed bug writing past end of input buffer in yyunput() 10343e102307SJung-uk Kim - fixed bug detecting NUL's at the end of a buffer 10353e102307SJung-uk Kim 10363e102307SJung-uk Kim 10373e102307SJung-uk KimChanges between 2.2 Patch #1 (23Mar90) and 2.2 (alpha) release: 10383e102307SJung-uk Kim 10393e102307SJung-uk Kim - Makefile fixes: definition of MAKE variable for systems 10403e102307SJung-uk Kim which don't have it; installation of flexdoc.1 along with 10413e102307SJung-uk Kim flex.1; fixed two bugs which could cause "bigtest" to fail. 10423e102307SJung-uk Kim 10433e102307SJung-uk Kim - flex.skel fix for compiling with g++. 10443e102307SJung-uk Kim 10453e102307SJung-uk Kim - README and flexdoc.1 no longer list an out-of-date BITNET address 10463e102307SJung-uk Kim for contacting me. 10473e102307SJung-uk Kim 10483e102307SJung-uk Kim - minor typos and formatting changes to flex.1 and flexdoc.1. 10493e102307SJung-uk Kim 10503e102307SJung-uk Kim 10513e102307SJung-uk KimChanges between 2.2 (alpha) release of March '90 and previous release: 10523e102307SJung-uk Kim 10533e102307SJung-uk KimUser-visible: 10543e102307SJung-uk Kim 10553e102307SJung-uk Kim - Full user documentation now available. 10563e102307SJung-uk Kim 10573e102307SJung-uk Kim - Support for 8-bit scanners. 10583e102307SJung-uk Kim 10593e102307SJung-uk Kim - Scanners now accept NUL's. 10603e102307SJung-uk Kim 10613e102307SJung-uk Kim - A facility has been added for dealing with multiple 10623e102307SJung-uk Kim input buffers. 10633e102307SJung-uk Kim 10643e102307SJung-uk Kim - Two manual entries now. One which fully describes flex 10653e102307SJung-uk Kim (rather than just its differences from lex), and the 10663e102307SJung-uk Kim other for quick(er) reference. 10673e102307SJung-uk Kim 10683e102307SJung-uk Kim - A number of changes to bring flex closer into compliance 10693e102307SJung-uk Kim with the latest POSIX lex draft: 10703e102307SJung-uk Kim 10713e102307SJung-uk Kim %t support 10723e102307SJung-uk Kim flex now accepts multiple input files and concatenates 10733e102307SJung-uk Kim them together to form its input 10743e102307SJung-uk Kim previous -c (compress) flag renamed -C 10753e102307SJung-uk Kim do-nothing -c and -n flags added 10763e102307SJung-uk Kim Any indented code or code within %{}'s in section 2 is 10773e102307SJung-uk Kim now copied to the output 10783e102307SJung-uk Kim 10793e102307SJung-uk Kim - yyleng is now a bona fide global integer. 10803e102307SJung-uk Kim 10813e102307SJung-uk Kim - -d debug information now gives the line number of the 10823e102307SJung-uk Kim matched rule instead of which number rule it was from 10833e102307SJung-uk Kim the beginning of the file. 10843e102307SJung-uk Kim 10853e102307SJung-uk Kim - -v output now includes a summary of the flags used to generate 10863e102307SJung-uk Kim the scanner. 10873e102307SJung-uk Kim 10883e102307SJung-uk Kim - unput() and yyrestart() are now globally callable. 10893e102307SJung-uk Kim 10903e102307SJung-uk Kim - yyrestart() no longer closes the previous value of yyin. 10913e102307SJung-uk Kim 10923e102307SJung-uk Kim - C++ support; generated scanners can be compiled with C++ compiler. 10933e102307SJung-uk Kim 10943e102307SJung-uk Kim - Primitive -lfl library added, containing default main() 10953e102307SJung-uk Kim which calls yylex(). A number of routines currently living 10963e102307SJung-uk Kim in the scanner skeleton will probably migrate to here 10973e102307SJung-uk Kim in the future (in particular, yywrap() will probably cease 10983e102307SJung-uk Kim to be a macro and instead be a function in the -lfl library). 10993e102307SJung-uk Kim 11003e102307SJung-uk Kim - Hexadecimal (\x) escape sequences added. 11013e102307SJung-uk Kim 11023e102307SJung-uk Kim - Support for MS-DOS, VMS, and Turbo-C integrated. 11033e102307SJung-uk Kim 11043e102307SJung-uk Kim - The %used/%unused operators have been deprecated. They 11053e102307SJung-uk Kim may go away soon. 11063e102307SJung-uk Kim 11073e102307SJung-uk Kim 11083e102307SJung-uk KimOther changes: 11093e102307SJung-uk Kim 11103e102307SJung-uk Kim - Makefile enhanced for easier testing and installation. 11113e102307SJung-uk Kim - The parser has been tweaked to detect some erroneous 11123e102307SJung-uk Kim constructions which previously were missed. 11133e102307SJung-uk Kim - Scanner input buffer overflow is now detected. 11143e102307SJung-uk Kim - Bugs with missing "const" declarations fixed. 11153e102307SJung-uk Kim - Out-of-date Minix/Atari patches provided. 11163e102307SJung-uk Kim - Scanners no longer require printf() unless FLEX_DEBUG is being used. 11173e102307SJung-uk Kim - A subtle input() bug has been fixed. 11183e102307SJung-uk Kim - Line numbers for "continued action" rules (those following 11193e102307SJung-uk Kim the special '|' action) are now correct. 11203e102307SJung-uk Kim - unput() bug fixed; had been causing problems porting flex to VMS. 11213e102307SJung-uk Kim - yymore() handling rewritten to fix bug with interaction 11223e102307SJung-uk Kim between yymore() and trailing context. 11233e102307SJung-uk Kim - EOF in actions now generates an error message. 11243e102307SJung-uk Kim - Bug involving -CFe and generating equivalence classes fixed. 11253e102307SJung-uk Kim - Bug which made -CF be treated as -Cf fixed. 11263e102307SJung-uk Kim - Support for SysV tmpnam() added. 11273e102307SJung-uk Kim - Unused #define's for scanner no longer generated. 11283e102307SJung-uk Kim - Error messages which are associated with a particular input 11293e102307SJung-uk Kim line are now all identified with their input line in standard 11303e102307SJung-uk Kim format. 11313e102307SJung-uk Kim - % directives which are valid to lex but not to flex are 11323e102307SJung-uk Kim now ignored instead of generating warnings. 11333e102307SJung-uk Kim - -DSYS_V flag can now also be specified -DUSG for System V 11343e102307SJung-uk Kim compilation. 11353e102307SJung-uk Kim 11363e102307SJung-uk Kim 11373e102307SJung-uk KimChanges between 2.1 beta-test release of June '89 and previous release: 11383e102307SJung-uk Kim 11393e102307SJung-uk KimUser-visible: 11403e102307SJung-uk Kim 11413e102307SJung-uk Kim - -p flag generates a performance report to stderr. The report 11423e102307SJung-uk Kim consists of comments regarding features of the scanner rules 11433e102307SJung-uk Kim which result in slower scanners. 11443e102307SJung-uk Kim 11453e102307SJung-uk Kim - -b flag generates backtracking information to lex.backtrack. 11463e102307SJung-uk Kim This is a list of scanner states which require backtracking 11473e102307SJung-uk Kim and the characters on which they do so. By adding rules 11483e102307SJung-uk Kim one can remove backtracking states. If all backtracking states 11493e102307SJung-uk Kim are eliminated, the generated scanner will run faster. 11503e102307SJung-uk Kim Backtracking is not yet documented in the manual entry. 11513e102307SJung-uk Kim 11523e102307SJung-uk Kim - Variable trailing context now works, i.e., one can have 11533e102307SJung-uk Kim rules like "(foo)*/[ \t]*bletch". Some trailing context 11543e102307SJung-uk Kim patterns still cannot be properly matched and generate 11553e102307SJung-uk Kim error messages. These are patterns where the ending of the 11563e102307SJung-uk Kim first part of the rule matches the beginning of the second 11573e102307SJung-uk Kim part, such as "zx*/xy*", where the 'x*' matches the 'x' at 11583e102307SJung-uk Kim the beginning of the trailing context. Lex won't get these 11593e102307SJung-uk Kim patterns right either. 11603e102307SJung-uk Kim 11613e102307SJung-uk Kim - Faster scanners. 11623e102307SJung-uk Kim 11633e102307SJung-uk Kim - End-of-file rules. The special rule "<<EOF>>" indicates 11643e102307SJung-uk Kim actions which are to be taken when an end-of-file is 11653e102307SJung-uk Kim encountered and yywrap() returns non-zero (i.e., indicates 11663e102307SJung-uk Kim no further files to process). See manual entry for example. 11673e102307SJung-uk Kim 11683e102307SJung-uk Kim - The -r (reject used) flag is gone. flex now scans the input 11693e102307SJung-uk Kim for occurrences of the string "REJECT" to determine if the 11703e102307SJung-uk Kim action is needed. It tries to be intelligent about this but 11713e102307SJung-uk Kim can be fooled. One can force the presence or absence of 11723e102307SJung-uk Kim REJECT by adding a line in the first section of the form 11733e102307SJung-uk Kim "%used REJECT" or "%unused REJECT". 11743e102307SJung-uk Kim 11753e102307SJung-uk Kim - yymore() has been implemented. Similarly to REJECT, flex 11763e102307SJung-uk Kim detects the use of yymore(), which can be overridden using 11773e102307SJung-uk Kim "%used" or "%unused". 11783e102307SJung-uk Kim 11793e102307SJung-uk Kim - Patterns like "x{0,3}" now work (i.e., with lower-limit == 0). 11803e102307SJung-uk Kim 11813e102307SJung-uk Kim - Removed '\^x' for ctrl-x misfeature. 11823e102307SJung-uk Kim 11833e102307SJung-uk Kim - Added '\a' and '\v' escape sequences. 11843e102307SJung-uk Kim 11853e102307SJung-uk Kim - \<digits> now works for octal escape sequences; previously 11863e102307SJung-uk Kim \0<digits> was required. 11873e102307SJung-uk Kim 11883e102307SJung-uk Kim - Better error reporting; line numbers are associated with rules. 11893e102307SJung-uk Kim 11903e102307SJung-uk Kim - yyleng is a macro; it cannot be accessed outside of the 11913e102307SJung-uk Kim scanner source file. 11923e102307SJung-uk Kim 11933e102307SJung-uk Kim - yytext and yyleng should not be modified within a flex action. 11943e102307SJung-uk Kim 11953e102307SJung-uk Kim - Generated scanners #define the name FLEX_SCANNER. 11963e102307SJung-uk Kim 11973e102307SJung-uk Kim - Rules are internally separated by YY_BREAK in lex.yy.c rather 11983e102307SJung-uk Kim than break, to allow redefinition. 11993e102307SJung-uk Kim 12003e102307SJung-uk Kim - The macro YY_USER_ACTION can be redefined to provide an action 12013e102307SJung-uk Kim which is always executed prior to the matched rule's action. 12023e102307SJung-uk Kim 12033e102307SJung-uk Kim - yyrestart() is a new action which can be used to restart 12043e102307SJung-uk Kim the scanner after it has seen an end-of-file (a "real" one, 12053e102307SJung-uk Kim that is, one for which yywrap() returned non-zero). It takes 12063e102307SJung-uk Kim a FILE* argument indicating a new file to scan and sets 12073e102307SJung-uk Kim things up so that a subsequent call to yylex() will start 12083e102307SJung-uk Kim scanning that file. 12093e102307SJung-uk Kim 12103e102307SJung-uk Kim - Internal scanner names all preceded by "yy_" 12113e102307SJung-uk Kim 12123e102307SJung-uk Kim - lex.yy.c is deleted if errors are encountered during processing. 12133e102307SJung-uk Kim 12143e102307SJung-uk Kim - Comments may be put in the first section of the input by preceding 12153e102307SJung-uk Kim them with '#'. 12163e102307SJung-uk Kim 12173e102307SJung-uk Kim 12183e102307SJung-uk Kim 12193e102307SJung-uk KimOther changes: 12203e102307SJung-uk Kim 12213e102307SJung-uk Kim - Some portability-related bugs fixed, in particular for machines 12223e102307SJung-uk Kim with unsigned characters or sizeof( int* ) != sizeof( int ). 12233e102307SJung-uk Kim Also, tweaks for VMS and Microsoft C (MS-DOS), and identifiers all 12243e102307SJung-uk Kim trimmed to be 31 or fewer characters. Shortened file names 12253e102307SJung-uk Kim for dinosaur OS's. Checks for allocating > 64K memory 12263e102307SJung-uk Kim on 16 bit'ers. Amiga tweaks. Compiles using gcc on a Sun-3. 12273e102307SJung-uk Kim - Compressed and fast scanner skeletons merged. 12283e102307SJung-uk Kim - Skeleton header files done away with. 12293e102307SJung-uk Kim - Generated scanner uses prototypes and "const" for __STDC__. 12303e102307SJung-uk Kim - -DSV flag is now -DSYS_V for System V compilation. 12313e102307SJung-uk Kim - Removed all references to FTL language. 12323e102307SJung-uk Kim - Software now covered by BSD Copyright. 12333e102307SJung-uk Kim - flex will replace lex in subsequent BSD releases. 1234