📄 news
字号:
scan started was a newline. The mechanism now is that '^' is
active iff the last token ended in a newline (or the last call to
input() returned a newline). For most users, the difference in
mechanisms is negligible. Where it will make a difference,
however, is if unput() or yyless() is used to alter the input
stream. When in doubt, use yy_set_bol().
- The new beginning-of-line mechanism involved changing some fairly
twisted code, so it may have introduced bugs - beware ...
- The macro YY_AT_BOL() returns true if the next token scanned from
the current buffer will have '^' rules active, false otherwise.
- The new function
void yy_flush_buffer( struct yy_buffer_state* b )
flushes the contents of the current buffer (i.e., next time
the scanner attempts to match a token using b as the current
buffer, it will begin by invoking YY_INPUT to fill the buffer).
This routine is also available to C++ scanners (unlike some
of the other new routines).
The related macro
YY_FLUSH_BUFFER
flushes the contents of the current buffer.
- A new "-ooutput" option writes the generated scanner to "output".
If used with -t, the scanner is still written to stdout, but
its internal #line directives (see previous item) use "output".
- Flex now generates #line directives relating the code it
produces to the output file; this means that error messages
in the flex-generated code should be correctly pinpointed.
- When generating #line directives, filenames with embedded '\'s
have those characters escaped (i.e., turned into '\\'). This
feature helps with reporting filenames for some MS-DOS and OS/2
systems.
- The FlexLexer class includes two new public member functions:
virtual void switch_streams( istream* new_in = 0,
ostream* new_out = 0 )
reassigns yyin to new_in (if non-nil) and yyout to new_out
(ditto), deleting the previous input buffer if yyin is
reassigned. It is used by:
int yylex( istream* new_in = 0, ostream* new_out = 0 )
which first calls switch_streams() and then returns the value
of calling yylex().
- C++ scanners now have yy_flex_debug as a member variable of
FlexLexer rather than a global, and member functions for testing
and setting it.
- When generating a C++ scanning class, you can now use
%option yyclass="foo"
to inform flex that you have derived "foo" as a subclass of
yyFlexLexer, so flex will place your actions in the member
function foo::yylex() instead of yyFlexLexer::yylex(). It also
generates a yyFlexLexer::yylex() member function that generates a
run-time error if called (by invoking yyFlexLexer::LexerError()).
This feature is necessary if your subclass "foo" introduces some
additional member functions or variables that you need to access
from yylex().
- Current texinfo files in MISC/texinfo, contributed by Francois
Pinard.
- You can now change the name "flex" to something else (e.g., "lex")
by redefining $(FLEX) in the Makefile.
- Two bugs (one serious) that could cause "bigcheck" to fail have
been fixed.
- A number of portability/configuration changes have been made
for easier portability.
- You can use "YYSTATE" in your scanner as an alias for YY_START
(for AT&T lex compatibility).
- input() now maintains yylineno.
- input() no longer trashes yytext.
- interactive scanners now read characters in YY_INPUT up to a
newline, a large performance gain.
- C++ scanner objects now work with the -P option. You include
<FlexLexer.h> once per scanner - see comments in <FlexLexer.h>
(or flex.1) for details.
- C++ FlexLexer objects now use the "cerr" stream to report -d output
instead of stdio.
- The -c flag now has its full glorious POSIX interpretation (do
nothing), rather than being interpreted as an old-style -C flag.
- Scanners generated by flex now include two #define's giving
the major and minor version numbers (YY_FLEX_MAJOR_VERSION,
YY_FLEX_MINOR_VERSION). These can then be tested to see
whether certain flex features are available.
- Scanners generated using -l lex compatibility now have the symbol
YY_FLEX_LEX_COMPAT #define'd.
- When initializing (i.e., yy_init is non-zero on entry to yylex()),
generated scanners now set yy_init to zero before executing
YY_USER_INIT. This means that you can set yy_init back to a
non-zero value in YY_USER_INIT if you need the scanner to be
reinitialized on the next call.
- You can now use "#line" directives in the first section of your
scanner specification.
- When generating full-table scanners (-Cf), flex now puts braces
around each row of the 2-d array initialization, to silence warnings
on over-zealous compilers.
- Improved support for MS-DOS. The flex sources have been successfully
built, unmodified, for Borland 4.02 (all that's required is a
Borland Makefile and config.h file, which are supplied in
MISC/Borland - contributed by Terrence O Kane).
- Improved support for Macintosh using Think C - the sources should
build for this platform "out of the box". Contributed by Scott
Hofmann.
- Improved support for VMS, in MISC/VMS/, contributed by Pat Rankin.
- Support for the Amiga, in MISC/Amiga/, contributed by Andreas
Scherer. Note that the contributed files were developed for
flex 2.4 and have not been tested with flex 2.5.
- Some notes on support for the NeXT, in MISC/NeXT, contributed
by Raf Schietekat.
- The MISC/ directory now includes a preformatted version of flex.1
in flex.man, and pre-yacc'd versions of parse.y in parse.{c,h}.
- The flex.1 and flexdoc.1 manual pages have been merged. There
is now just one document, flex.1, which includes an overview
at the beginning to help you find the section you need.
- Documentation now clarifies that start conditions persist across
switches to new input files or different input buffers. If you
want to e.g., return to INITIAL, you must explicitly do so.
- The "Performance Considerations" section of the manual has been
updated.
- Documented the "yy_act" variable, which when YY_USER_ACTION is
invoked holds the number of the matched rule, and added an
example of using yy_act to profile how often each rule is matched.
- Added YY_NUM_RULES, a definition that gives the total number
of rules in the file, including the default rule (even if you
use -s).
- Documentation now clarifies that you can pass a nil FILE* pointer
to yy_create_buffer() or yyrestart() if you've arrange YY_INPUT
to not need yyin.
- Documentation now clarifies that YY_BUFFER_STATE is a pointer to
an opaque "struct yy_buffer_state".
- Documentation now stresses that you gain the benefits of removing
backing-up states only if you remove *all* of them.
- Documentation now points out that traditional lex allows you
to put the action on a separate line from the rule pattern if
the pattern has trailing whitespace (ugh!), but flex doesn't
support this.
- A broken example in documentation of the difference between
inclusive and exclusive start conditions is now fixed.
- Usage (-h) report now goes to stdout.
- Version (-V) info now goes to stdout.
- More #ifdef chud has been added to the parser in attempt to
deal with bison's use of alloca().
- "make clean" no longer deletes emacs backup files (*~).
- Some memory leaks have been fixed.
- A bug was fixed in which dynamically-expanded buffers were
reallocated a couple of bytes too small.
- A bug was fixed which could cause flex to read and write beyond
the end of the input buffer.
- -S will not be going away.
Changes between release 2.4.7 (03Aug94) and release 2.4.6:
- Fixed serious bug in reading multiple files.
- Fixed bug in scanning NUL's.
- Fixed bug in input() returning 8-bit characters.
- Fixed bug in matching text with embedded NUL's when
using %array or lex compatibility.
- Fixed multiple invocations of YY_USER_ACTION when using '|'
continuation action.
- Minor prototyping fixes.
Changes between release 2.4.6 (04Jan94) and release 2.4.5:
- Linking with -lfl no longer required if your program includes
its own yywrap() and main() functions. (This change will cause
problems if you have a non-ANSI compiler on a system for which
sizeof(int) != sizeof(void*) or sizeof(int) != sizeof(size_t).)
- The use of 'extern "C++"' in FlexLexer.h has been modified to
get around an incompatibility with g++'s header files.
Changes between release 2.4.5 (11Dec93) and release 2.4.4:
- Fixed bug breaking C++ scanners that use REJECT or variable
trailing context.
- Fixed serious input problem for interactive scanners on
systems for which char is unsigned.
- Fixed bug in incorrectly treating '$' operator as variable
trailing context.
- Fixed bug in -CF table representation that could lead to
corrupt tables.
- Fixed fairly benign memory leak.
- Added `extern "C++"' wrapper to FlexLexer.h header. This
should overcome the g++ 2.5.X problems mentioned in the
NEWS for release 2.4.3.
- Changed #include of FlexLexer.h to use <> instead of "".
- Added feature to control whether the scanner attempts to
refill the input buffer once it's exhausted. This feature
will be documented in the 2.5 release.
Changes between release 2.4.4 (07Dec93) and release 2.4.3:
- Fixed two serious bugs in scanning 8-bit characters.
- Fixed bug in YY_USER_ACTION that caused it to be executed
inappropriately (on the scanner's own internal actions, and
with incorrect yytext/yyleng values).
- Fixed bug in pointing yyin at a new file and resuming scanning.
- Portability fix regarding min/max/abs macros conflicting with
function definitions in standard header files.
- Added a virtual LexerError() method to the C++ yyFlexLexer class
for reporting error messages instead of always using cerr.
- Added warning in flexdoc that the C++ scanning class is presently
experimental and subject to considerable change between major
releases.
Changes between release 2.4.3 (03Dec93) and release 2.4.2:
- Fixed bug causing fatal scanner messages to fail to print.
- Fixed things so FlexLexer.h can be included in other C++
sources. One side-effect of this change is that -+ and -CF
are now incompatible.
- libfl.a now supplies private versions of the the <string.h>/
<strings.h> string routines needed by flex and the scanners
it generates, to enhance portability to some BSD systems.
- More robust solution to 2.4.2's flexfatal() bug fix.
- Added ranlib of installed libfl.a.
- Some lint tweaks.
- NOTE: problems have been encountered attempting to build flex
C++ scanners using g++ version 2.5.X. The problem is due to an
unfortunate heuristic in g++ 2.5.X that attempts to discern between
C and C++ headers. Because FlexLexer.h is installed (by default)
in /usr/local/include and not /usr/local/lib/g++-include, g++ 2.5.X
decides that it's a C header :-(. So if you have problems, install
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -