lalr1.cc: document exception safety

* NEWS: here.
* doc/bison.texi (Destructor Decl, C++ Parser Interface): and there.
This commit is contained in:
Akim Demaille
2012-10-01 11:41:26 +02:00
parent e8b86af83d
commit d3e4409ad1
2 changed files with 18 additions and 0 deletions

9
NEWS
View File

@@ -39,6 +39,15 @@ GNU Bison NEWS
will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
** Exception safety (lalr1.cc)
The parse function now catches exceptions, uses the %destructors to
release memory (the lookahead symbol and the symbols pushed on the stack)
before rethrowing the exception.
This feature is somewhat experimental. User feedback would be
appreciated.
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
** Bug fixes

View File

@@ -4701,6 +4701,10 @@ incoming terminals during the second phase of error recovery,
the current lookahead and the entire stack (except the current
right-hand side symbols) when the parser returns immediately, and
@item
the current lookahead and the entire stack (including the current right-hand
side symbols) when the C++ parser (@file{lalr1.cc}) catches an exception in
@code{parse},
@item
the start symbol, when the parser succeeds.
@end itemize
@@ -9415,6 +9419,11 @@ Build a new parser object. There are no arguments by default, unless
@deftypemethod {parser} {int} parse ()
Run the syntactic analysis, and return 0 on success, 1 otherwise.
@cindex exceptions
The whole function is wrapped in a @code{try}/@code{catch} block, so that
when an exception is thrown, the @code{%destructor}s are called to release
the lookahead symbol, and the symbols pushed on the stack.
@end deftypemethod
@deftypemethod {parser} {std::ostream&} debug_stream ()