diff libinterp/parse-tree/oct-parse.in.yy @ 17316:8e2906e2fb26

avoid reduce/reduce conflict in parser rules * oct-parse.in.yy (return_list): Don't accept multiple values outside of square brackets by using identifier instead of return_list1. * pt-misc.h (tree_argument_list::tree_argument_list): New constructor with tree_identifier* as argument. * test/nest/varg_nest2.m: Fix syntax of function declaration.
author John W. Eaton <jwe@octave.org>
date Thu, 22 Aug 2013 14:48:09 -0400
parents e6c0ac8ce5b6
children 56fe31b248de
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Thu Aug 22 18:03:09 2013 +0200
+++ b/libinterp/parse-tree/oct-parse.in.yy	Thu Aug 22 14:48:09 2013 -0400
@@ -1086,19 +1086,31 @@
 return_list     : '[' ']'
                   {
                     lexer.looking_at_return_list = false;
+
                     $$ = new tree_parameter_list ();
                   }
-                | return_list1
+                | identifier
                   {
                     lexer.looking_at_return_list = false;
-                    if ($1->validate (tree_parameter_list::out))
-                      $$ = $1;
+
+                    tree_parameter_list *tmp = new tree_parameter_list ($1);
+
+                    // Even though this parameter list can contain only
+                    // a single identifier, we still need to validate it
+                    // to check for varargin or varargout.
+
+                    if (tmp->validate (tree_parameter_list::out))
+                      $$ = tmp;
                     else
                       ABORT_PARSE;
                   }
                 | '[' return_list1 ']'
                   {
                     lexer.looking_at_return_list = false;
+
+                    // Check for duplicate parameter names, varargin,
+                    // or varargout.
+
                     if ($2->validate (tree_parameter_list::out))
                       $$ = $2;
                     else