# HG changeset patch # User John W. Eaton # Date 1327982580 18000 # Node ID d1810b2ca809970a2596d07d4e3bdefbfa0675e9 # Parent 2633baa831e2d31307b7841729dad3143fb861f2 iskeyword: don't consider get and set as keywords * lex.ll (is_keyword): Don't recognize get and set as keywords. (Fiskeyword): Don't include get and set in the list of keywords. * grammar.txi: Remove get and set from the list of keywords. diff --git a/src/lex.ll b/src/lex.ll --- a/src/lex.ll +++ b/src/lex.ll @@ -3451,7 +3451,14 @@ bool is_keyword (const std::string& s) { - return octave_kw_hash::in_word_set (s.c_str (), s.length ()) != 0; + // Parsing function names like "set.property_name" inside + // classdef-style class definitions is simplified by handling the + // "set" and "get" portions of the names using the same mechanism as + // is used for keywords. However, they are not really keywords in + // the language, so omit them from the list of possible keywords. + + return (octave_kw_hash::in_word_set (s.c_str (), s.length ()) != 0 + && ! (s == "set" || s == "get")); } DEFUN (iskeyword, args, , @@ -3474,10 +3481,22 @@ if (argc == 1) { + // Neither set and get are keywords. See the note in the + // is_keyword function for additional details. + string_vector lst (TOTAL_KEYWORDS); + int j = 0; + for (int i = 0; i < TOTAL_KEYWORDS; i++) - lst[i] = wordlist[i].name; + { + std::string tmp = wordlist[i].name; + + if (! (tmp == "set" || tmp == "get")) + lst[j++] = tmp; + } + + lst.resize (j); retval = Cell (lst.sort ()); }