diff test/test_parser.m @ 13237:1bfca2bbea8b

fix parsing of anonymous functions inside cell array lists. * lex.h (lexer_flags::looking_at_anon_fcn_args): New data member. (lexer_flags::lexer_flags): Initialize it. Initialize looking_at_function_handle to 0, not false. * lex.ll (lexer_flags::init): Reset looking_at_anon_fcn_args to 0. * oct-parse.yy (param_list_beg): Set lexer_flags.looking_at_anon_fcn_args to true if lexer_flags.looking_at_function_handle is non-zero. (")"): Set lexer_flags.looking_at_anon_fcn_args to false. * test_parser.m: New tests.
author John W. Eaton <jwe@octave.org>
date Tue, 27 Sep 2011 03:22:48 -0400
parents 53c0ed961de8
children c3309e1ec50d
line wrap: on
line diff
--- a/test/test_parser.m	Tue Sep 27 02:06:41 2011 -0400
+++ b/test/test_parser.m	Tue Sep 27 03:22:48 2011 -0400
@@ -247,3 +247,10 @@
 %! assert (a += b *= c += 1, 42)
 %! assert (b == 40 && c == 8)
 
+%!test
+%! af_in_cell = {@(x) [1 2]};
+%! assert (af_in_cell{1}(), [1, 2]);
+
+%!test
+%! R = @(rot) [cos(rot) -sin(rot); sin(rot) cos(rot)];
+%! assert (R(pi/2), [cos(pi/2), -sin(pi/2); sin(pi/2),cos(pi/2)]);