Mercurial > hg > octave-nkf
diff libinterp/parse-tree/lex.ll @ 16337:6bfd8dbd7d3c
don't swallow statements that follow comment lines (bug #38549)
* lex.h, lex.ll (finish_comment): Delete second arg,
looking_at_continuation. Never unput '\n'. Change all callers.
(<LINE_COMMENT_START>{S}*{CCHAR}.*{NL}): Unput '\n' here if looking at
end of line comment.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 19 Mar 2013 18:03:23 -0400 |
parents | 06aa4c0f2018 |
children | 11115c237231 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -537,6 +537,9 @@ curr_lexer->finish_comment (octave_comment_elt::end_of_line); curr_lexer->pop_start_state (); + + curr_lexer->xunput ('\n'); + curr_lexer->input_line_number--; } } @@ -2116,7 +2119,7 @@ { comment_text = &yytxt[offset]; - finish_comment (octave_comment_elt::end_of_line, true); + finish_comment (octave_comment_elt::end_of_line); } decrement_promptflag (); @@ -2125,8 +2128,7 @@ } void -octave_base_lexer::finish_comment (octave_comment_elt::comment_type typ, - bool looking_at_continuation) +octave_base_lexer::finish_comment (octave_comment_elt::comment_type typ) { bool copyright = looks_like_copyright (comment_text); @@ -2142,13 +2144,6 @@ comment_text = ""; at_beginning_of_statement = true; - - if (! looking_at_continuation) - { - xunput ('\n'); - // Adjust for newline that was not really in the input stream. - input_line_number--; - } } // We have seen a backslash and need to find out if it should be