Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
17315:3abed16370ad | 17316:8e2906e2fb26 |
---|---|
1084 // =================================== | 1084 // =================================== |
1085 | 1085 |
1086 return_list : '[' ']' | 1086 return_list : '[' ']' |
1087 { | 1087 { |
1088 lexer.looking_at_return_list = false; | 1088 lexer.looking_at_return_list = false; |
1089 | |
1089 $$ = new tree_parameter_list (); | 1090 $$ = new tree_parameter_list (); |
1090 } | 1091 } |
1091 | return_list1 | 1092 | identifier |
1092 { | 1093 { |
1093 lexer.looking_at_return_list = false; | 1094 lexer.looking_at_return_list = false; |
1094 if ($1->validate (tree_parameter_list::out)) | 1095 |
1095 $$ = $1; | 1096 tree_parameter_list *tmp = new tree_parameter_list ($1); |
1097 | |
1098 // Even though this parameter list can contain only | |
1099 // a single identifier, we still need to validate it | |
1100 // to check for varargin or varargout. | |
1101 | |
1102 if (tmp->validate (tree_parameter_list::out)) | |
1103 $$ = tmp; | |
1096 else | 1104 else |
1097 ABORT_PARSE; | 1105 ABORT_PARSE; |
1098 } | 1106 } |
1099 | '[' return_list1 ']' | 1107 | '[' return_list1 ']' |
1100 { | 1108 { |
1101 lexer.looking_at_return_list = false; | 1109 lexer.looking_at_return_list = false; |
1110 | |
1111 // Check for duplicate parameter names, varargin, | |
1112 // or varargout. | |
1113 | |
1102 if ($2->validate (tree_parameter_list::out)) | 1114 if ($2->validate (tree_parameter_list::out)) |
1103 $$ = $2; | 1115 $$ = $2; |
1104 else | 1116 else |
1105 ABORT_PARSE; | 1117 ABORT_PARSE; |
1106 } | 1118 } |