diff libinterp/parse-tree/oct-parse.in.yy @ 24283:81557c74be7f

improve error message for invalid anonymous functions * oct-parse.in.yy (anon_fcn_handle): Improve error message produced for anonymous function parse errors.
author John W. Eaton <jwe@octave.org>
date Sun, 19 Nov 2017 16:01:05 -0500
parents bc3819b7cca1
children 9a1b193ddd01
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Sun Nov 19 12:49:15 2017 -0500
+++ b/libinterp/parse-tree/oct-parse.in.yy	Sun Nov 19 16:01:05 2017 -0500
@@ -608,6 +608,14 @@
                     $$ = parser.make_anon_fcn_handle ($2, $4);
                     lexer.nesting_level.remove ();
                   }
+                | '@' param_list stmt_begin error
+                  {
+                    YYUSE ($2);
+
+                    $$ = nullptr;
+                    parser.bison_error ("anonymous function bodies must be single expressions");
+                    YYABORT;
+                  }
                 ;
 
 primary_expr    : identifier