# HG changeset patch # User John W. Eaton # Date 1327982761 18000 # Node ID 71a198cca35b820354b85e77eaf0eb64ae5e590a # Parent d1810b2ca809970a2596d07d4e3bdefbfa0675e9 improve parsing of classdef methods * oct-parse.yy (fcn_name): also set lexer_flags.parsed_function_name.top() to true when recognizing classdef set.PROPERTY or get.PROPERTY methods. (parse_fcn_file): Also set reading_script_file to true when reading classdef files. diff --git a/doc/interpreter/grammar.txi b/doc/interpreter/grammar.txi --- a/doc/interpreter/grammar.txi +++ b/doc/interpreter/grammar.txi @@ -46,12 +46,12 @@ @item @code{endif} @tab @code{endmethods} @tab @code{endparfor} @item @code{endproperties} @tab @code{endswitch} @tab @code{endwhile} @item @code{enumeration} @tab @code{events} @tab @code{for} -@item @code{function} @tab @code{get} @tab @code{global} -@item @code{if} @tab @code{methods} @tab @code{otherwise} -@item @code{parfor} @tab @code{persistent} @tab @code{properties} -@item @code{return} @tab @code{set} @tab @code{static} -@item @code{switch} @tab @code{try} @tab @code{until} -@item @code{unwind_protect} @tab @code{unwind_protect_cleanup} @tab @code{while} +@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{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 --git a/src/oct-parse.yy b/src/oct-parse.yy --- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -1395,11 +1395,13 @@ } | GET '.' identifier { + lexer_flags.parsed_function_name.top () = true; lexer_flags.maybe_classdef_get_set_method = false; $$ = $3; } | SET '.' identifier { + lexer_flags.parsed_function_name.top () = true; lexer_flags.maybe_classdef_get_set_method = false; $$ = $3; } @@ -3515,7 +3517,11 @@ reading_classdef_file = true; reading_fcn_file = false; - reading_script_file = false; + // FIXME -- Should classdef files be handled as + // scripts or separately? Currently, without setting up + // for reading script files, parsing classdef files + // fails. + reading_script_file = true; } else {