comparison 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
comparison
equal deleted inserted replaced
13236:8bb526fb3349 13237:1bfca2bbea8b
245 %!test 245 %!test
246 %! a = 2; b = 5; c = 7; 246 %! a = 2; b = 5; c = 7;
247 %! assert (a += b *= c += 1, 42) 247 %! assert (a += b *= c += 1, 42)
248 %! assert (b == 40 && c == 8) 248 %! assert (b == 40 && c == 8)
249 249
250 %!test
251 %! af_in_cell = {@(x) [1 2]};
252 %! assert (af_in_cell{1}(), [1, 2]);
253
254 %!test
255 %! R = @(rot) [cos(rot) -sin(rot); sin(rot) cos(rot)];
256 %! assert (R(pi/2), [cos(pi/2), -sin(pi/2); sin(pi/2),cos(pi/2)]);