# HG changeset patch # User John W. Eaton # Date 1389162409 18000 # Node ID 1f072ae35ede74cacef9256a69488acf551085ca # Parent 36057e2411f8285e07b2666027bcbb96a8d37bef fix parsing of single quote after continuation and comment (bug #41048) * lex.ll (octave_base_lexer::handle_continuation): Preserve state of at_beginning_of_statement across call to finish_comment. * parser.tst: New test. diff -r 36057e2411f8 -r 1f072ae35ede libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Tue Jan 07 22:06:37 2014 -0500 +++ b/libinterp/parse-tree/lex.ll Wed Jan 08 01:26:49 2014 -0500 @@ -2531,7 +2531,15 @@ { comment_text = &yytxt[offset]; + // finish_comment sets at_beginning_of_statement to true but + // that's not be correct if we are handling a continued + // statement. Preserve the current state. + + bool saved_bos = at_beginning_of_statement; + finish_comment (octave_comment_elt::end_of_line); + + at_beginning_of_statement = saved_bos; } decrement_promptflag (); diff -r 36057e2411f8 -r 1f072ae35ede test/parser.tst --- a/test/parser.tst Tue Jan 07 22:06:37 2014 -0500 +++ b/test/parser.tst Wed Jan 08 01:26:49 2014 -0500 @@ -283,3 +283,7 @@ %! xyz(1) = 1; xyz /= 1; %! assert (xyz, 1); +%!test +%! a = [97 ... % comment +%! 'b']; +%! assert (a, 'ab');