bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 9/9] lalr1.cc: document exception safety


From: Akim Demaille
Subject: [PATCH 9/9] lalr1.cc: document exception safety
Date: Tue, 2 Oct 2012 19:11:14 +0200

* NEWS: here.
* doc/bison.texi (Destructor Decl, C++ Parser Interface): and there.
---
 NEWS           | 9 +++++++++
 doc/bison.texi | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/NEWS b/NEWS
index ad5f738..6589667 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,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
diff --git a/doc/bison.texi b/doc/bison.texi
index 6983611..36621e9 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -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
address@hidden,
address@hidden
 the start symbol, when the parser succeeds.
 @end itemize
 
@@ -9405,6 +9409,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.
+
address@hidden 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 ()
-- 
1.7.12.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]