Mercurial > hg > octave-nkf
diff libinterp/parse-tree/pt-fcn-handle.cc @ 16681:d3619d4d267c
recognize character string at beginning of statement (bug #38926, #38958)
* lex.ll ("'"): Always begin a character string if at the beginning of
a statement.
* oct-parse.in.yy (stmt_begin): New non-terminal.
(anon_fcn_handle, if_cmd_list1, elseif_clause, switch_case,
loop_command): Use it.
* pt-fcn-handle.cc, for.tst, if.tst, switch.tst, while.tst:
New tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 18 May 2013 16:21:32 -0400 |
parents | 2fc554ffbc28 |
children | d63878346099 |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-fcn-handle.cc +++ b/libinterp/parse-tree/pt-fcn-handle.cc @@ -159,6 +159,19 @@ %! g = @(f, x) h (x); %! f = @() g (@(x) h, pi); %! assert (f () == sin (pi)); + +The next two tests are intended to test parsing of a character string +vs. hermitian operator at the beginning of an anonymous function +expression. The use of ' for the character string and the spacing is +intentional, so don't change it. + +%!test +%! f = @() 'foo'; +%! assert (f (), 'foo'); + +%!test +%! f = @()'foo'; +%! assert (f (), 'foo'); */ octave_value_list