Mercurial > hg > octave-nkf
diff src/lex.ll @ 14294:9e3983c8963c
deprecate the static keyword
* octave.gperf: Use PERSISTENT as the token for "static" and
"persistent" but use separate static_kw and persistent_kw values so we
can distinguish them.
* lex.ll (is_keyword_token): Handle static_kw and persistent_kw
separately. Generate deprecated keyword warning for static_kw.
* oct-parse.cc: Use PERSISTENT token instead of STATIC.
* pt-decl.h, pt-decl.cc (tree_persistent_command): Rename from
tree_static_command. Change all uses.
* pt-walk.h (tree_walker::visit_persistent_command):
Rename from visit_static_command. Change all derived classes.
* NEWS: note that static has been deprecated.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 30 Jan 2012 23:42:41 -0500 |
parents | d1810b2ca809 |
children | 8d1ae996c122 |
line wrap: on
line diff
--- a/src/lex.ll +++ b/src/lex.ll @@ -1497,10 +1497,26 @@ lexer_flags.at_beginning_of_statement = true; break; + case static_kw: + if ((reading_fcn_file || reading_script_file + || reading_classdef_file) + && ! curr_fcn_file_full_name.empty ()) + warning_with_id ("Octave:deprecated-keyword", + "the `static' keyword is obsolete and will be removed from a future version of Octave; please use `persistent' instead; near line %d of file `%s'", + input_line_number, + curr_fcn_file_full_name.c_str ()); + else + warning_with_id ("Octave:deprecated-keyword", + "the `static' keyword is obsolete and will be removed from a future version of Octave; please use `persistent' instead; near line %d", + input_line_number); + // fall through ... + + case persistent_kw: + break; + case case_kw: case elseif_kw: case global_kw: - case static_kw: case until_kw: break; @@ -3694,7 +3710,7 @@ case TRY: std::cerr << "TRY\n"; break; case CATCH: std::cerr << "CATCH\n"; break; case GLOBAL: std::cerr << "GLOBAL\n"; break; - case STATIC: std::cerr << "STATIC\n"; break; + case PERSISTENT: std::cerr << "PERSISTENT\n"; break; case FCN_HANDLE: std::cerr << "FCN_HANDLE\n"; break; case END_OF_INPUT: std::cerr << "END_OF_INPUT\n\n"; break; case LEXICAL_ERROR: std::cerr << "LEXICAL_ERROR\n\n"; break;