Mercurial > octave-nkf
diff libinterp/parse-tree/lex.ll @ 17247: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 | 6470a113eae2 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll Mon Aug 12 17:36:54 2013 +0200 +++ b/libinterp/parse-tree/lex.ll Wed Aug 14 12:33:15 2013 -0400 @@ -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 ()); } %{