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