Mercurial > hg > octave-lyh
changeset 17255:e993fa124b46
Deprecate \ as continuation marker outside of double-quoted character strings.
* lex.ll: Issue deprecated-syntax warning about \ used as a
continuation marker outside of double-quoted character strings.
* NEWS: Note that \ is deprecated as a continuation marker outside of
double-quoted character strings.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 14 Aug 2013 12:33:15 -0400 |
parents | 8be8a65d3ca8 |
children | 0b2a0acd0315 |
files | NEWS libinterp/parse-tree/lex.ll |
diffstat | 2 files changed, 36 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -88,6 +88,18 @@ be followed immediately by the newline character. No whitespace or end-of-linecomment may appear between them. + ** Backslash as a continuation marker outside of double-quoted strings + is now deprecated. + + Using '\' as a continuation marker outside fo double quoted strings + is now deprecated and will be removed from a future version of + Octave. When that is done, the behavior of + + (a \ + b) + + will be consistent with other binary operators. + ** Warning IDs renamed: Octave:array-as-scalar => Octave:array-to-scalar
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -960,15 +960,33 @@ } %{ -// Continuation lines. Allow comments after continuations. +// Continuation lines. Allow arbitrary text after continuations. +%} + +\.\.\..*{NL} { + curr_lexer->lexer_debug ("\\.\\.\\..*{NL}"); + + curr_lexer->handle_continuation (); + } + +%{ +// Deprecated C preprocessor style continuation markers. %} \\{S}*{NL} | -\\{S}*{CCHAR}.*{NL} | -\.\.\..*{NL} { - curr_lexer->lexer_debug ("\\.\\.\\..*{NL}|\\\\{S}*{NL}|\\\\{S}*{CCHAR}.*{NL}"); - - curr_lexer->handle_continuation (); +\\{S}*{CCHAR}.*{NL} { + curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}.*{NL}"); + + static const char *msg = "using continuation marker \\ outside of double quoted strings is deprecated and will be removed in a future version of Octave"; + + std::string nm = curr_lexer->fcn_file_full_name; + + if (nm.empty ()) + warning_with_id ("Octave:deprecated-syntax", "%s", msg); + else + warning_with_id ("Octave:deprecated-syntax", + "%s; near line %d of file '%s'", msg, + curr_lexer->input_line_number, nm.c_str ()); } %{