# HG changeset patch # User Rik # Date 1386272214 28800 # Node ID e0775b4f41dde9c3a08e1eeefa2286ec8ae1d052 # Parent 889e2c0832537f412a07379bc7e2eea2bde27cb4 maint: backout cset d48ef9e24324 on gui-release branch. diff -r 889e2c083253 -r e0775b4f41dd doc/interpreter/grammar.txi --- a/doc/interpreter/grammar.txi Thu Dec 05 11:36:10 2013 -0800 +++ b/doc/interpreter/grammar.txi Thu Dec 05 11:36:54 2013 -0800 @@ -49,8 +49,9 @@ @item @code{function} @tab @code{global} @tab @code{if} @item @code{methods} @tab @code{otherwise} @tab @code{parfor} @item @code{persistent} @tab @code{properties} @tab @code{return} -@item @code{switch} @tab @code{try} @tab @code{until} -@item @code{unwind_protect} @tab @code{unwind_protect_cleanup} @tab @code{while} +@item @code{static} @tab @code{switch} @tab @code{try} +@item @code{until} @tab @code{unwind_protect} @tab @code{unwind_protect_cleanup} +@item @code{while} @end multitable The function @code{iskeyword} can be used to quickly check whether an diff -r 889e2c083253 -r e0775b4f41dd doc/interpreter/var.txi --- a/doc/interpreter/var.txi Thu Dec 05 11:36:10 2013 -0800 +++ b/doc/interpreter/var.txi Thu Dec 05 11:36:54 2013 -0800 @@ -221,7 +221,8 @@ @end example The behavior of persistent variables is equivalent to the behavior of -static variables in C@. +static variables in C@. The command @code{static} in Octave is also +recognized and is equivalent to @code{persistent}. Like global variables, a persistent variable may only be initialized once. For example, after executing the following code diff -r 889e2c083253 -r e0775b4f41dd libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Thu Dec 05 11:36:10 2013 -0800 +++ b/libinterp/parse-tree/lex.ll Thu Dec 05 11:36:54 2013 -0800 @@ -2224,6 +2224,20 @@ at_beginning_of_statement = true; break; + case static_kw: + if ((reading_fcn_file || reading_script_file + || reading_classdef_file) + && ! 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, + 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: case global_kw: looking_at_decl_list = true; diff -r 889e2c083253 -r e0775b4f41dd libinterp/parse-tree/octave.gperf --- a/libinterp/parse-tree/octave.gperf Thu Dec 05 11:36:10 2013 -0800 +++ b/libinterp/parse-tree/octave.gperf Thu Dec 05 11:36:54 2013 -0800 @@ -64,6 +64,7 @@ properties_kw, return_kw, set_kw, + static_kw, switch_kw, try_kw, until_kw, @@ -110,6 +111,7 @@ properties, PROPERTIES, properties_kw return, FUNC_RET, return_kw set, SET, set_kw +static, PERSISTENT, static_kw switch, SWITCH, switch_kw try, TRY, try_kw until, UNTIL, until_kw