Mercurial > hg > octave-nkf
changeset 18105:e0775b4f41dd gui-release
maint: backout cset d48ef9e24324 on gui-release branch.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 05 Dec 2013 11:36:54 -0800 |
parents | 889e2c083253 |
children | b3f443b4802b |
files | doc/interpreter/grammar.txi doc/interpreter/var.txi libinterp/parse-tree/lex.ll libinterp/parse-tree/octave.gperf |
diffstat | 4 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/grammar.txi +++ b/doc/interpreter/grammar.txi @@ -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
--- a/doc/interpreter/var.txi +++ b/doc/interpreter/var.txi @@ -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
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -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;
--- a/libinterp/parse-tree/octave.gperf +++ b/libinterp/parse-tree/octave.gperf @@ -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