changeset 17684:1e8f8900a041

clean up partially constructed parse tree objects on parse errors (bug #40231) * oct-parse.in.yy (%destructor): New declaration of cleanup actions to take for items on the parser stack when a parse error occurs.
author John W. Eaton <jwe@octave.org>
date Fri, 11 Oct 2013 09:05:54 -0400
parents 99ffa521ecec
children 484c9a6f4f27
files libinterp/parse-tree/oct-parse.in.yy
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy
+++ b/libinterp/parse-tree/oct-parse.in.yy
@@ -298,6 +298,13 @@
 %right PLUS_PLUS MINUS_MINUS
 %left '(' '.' '{'
 
+// How to clean up if there is a parse error.  We handle deleting tokens
+// and comments seperately and separators are just characters.  The
+// remaining items are dynamically allocated parse tree objects that
+// must be deleted.
+%destructor { } <sep_type> <tok_val> <comment_type> <dummy_type> <>
+%destructor { delete $$; } <*>
+
 // Where to start.
 %start input