Mercurial > octave
comparison libinterp/parse-tree/lex.ll @ 26059:da2bbcf1fbcd
Deprecate C++ function is_keyword in favor of iskeyword for readability.
* token.h (iskeyword): New function with same code as is_keyword.
* token.h (is_keyword): Add OCTAVE_DEPRECATED decoration on function.
Change code to call iskeyword.
* NEWS: Announce deprecation.
* ls-mat-ascii.cc, utils.cc, variables.cc, lex.h, lex.ll, oct-parse.yy:
Replace instances of is_keyword with iskeyword.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 11 Nov 2018 14:31:10 -0800 |
parents | f881d3e271d2 |
children | 00f796120a6d |
comparison
equal
deleted
inserted
replaced
26058:ecd86b8b8979 | 26059:da2bbcf1fbcd |
---|---|
1950 } | 1950 } |
1951 | 1951 |
1952 namespace octave | 1952 namespace octave |
1953 { | 1953 { |
1954 bool | 1954 bool |
1955 is_keyword (const std::string& s) | 1955 iskeyword (const std::string& s) |
1956 { | 1956 { |
1957 // Parsing function names like "set.property_name" inside | 1957 // Parsing function names like "set.property_name" inside |
1958 // classdef-style class definitions is simplified by handling the | 1958 // classdef-style class definitions is simplified by handling the |
1959 // "set" and "get" portions of the names using the same mechanism | 1959 // "set" and "get" portions of the names using the same mechanism |
1960 // as is used for keywords. However, they are not really keywords | 1960 // as is used for keywords. However, they are not really keywords |
1987 print_usage (); | 1987 print_usage (); |
1988 | 1988 |
1989 if (nargin == 0) | 1989 if (nargin == 0) |
1990 { | 1990 { |
1991 // Neither set nor get are keywords. See the note in the | 1991 // Neither set nor get are keywords. See the note in the |
1992 // is_keyword function for additional details. | 1992 // iskeyword function for additional details. |
1993 | 1993 |
1994 string_vector lst (TOTAL_KEYWORDS); | 1994 string_vector lst (TOTAL_KEYWORDS); |
1995 | 1995 |
1996 int j = 0; | 1996 int j = 0; |
1997 | 1997 |
2008 retval = Cell (lst.sort ()); | 2008 retval = Cell (lst.sort ()); |
2009 } | 2009 } |
2010 else | 2010 else |
2011 { | 2011 { |
2012 std::string name = args(0).xstring_value ("iskeyword: NAME must be a string"); | 2012 std::string name = args(0).xstring_value ("iskeyword: NAME must be a string"); |
2013 retval = octave::is_keyword (name); | 2013 retval = octave::iskeyword (name); |
2014 } | 2014 } |
2015 | 2015 |
2016 return retval; | 2016 return retval; |
2017 } | 2017 } |
2018 | 2018 |
2192 | 2192 |
2193 bool | 2193 bool |
2194 lexical_feedback::previous_token_is_keyword (void) const | 2194 lexical_feedback::previous_token_is_keyword (void) const |
2195 { | 2195 { |
2196 const token *tok = m_tokens.front (); | 2196 const token *tok = m_tokens.front (); |
2197 return tok ? tok->is_keyword () : false; | 2197 return tok ? tok->iskeyword () : false; |
2198 } | 2198 } |
2199 | 2199 |
2200 bool | 2200 bool |
2201 lexical_feedback::previous_token_may_be_command (void) const | 2201 lexical_feedback::previous_token_may_be_command (void) const |
2202 { | 2202 { |