changeset 14293:71a198cca35b

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.
author John W. Eaton <jwe@octave.org>
date Mon, 30 Jan 2012 23:06:01 -0500
parents d1810b2ca809
children 9e3983c8963c
files doc/interpreter/grammar.txi src/oct-parse.yy
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/grammar.txi	Mon Jan 30 23:03:00 2012 -0500
+++ b/doc/interpreter/grammar.txi	Mon Jan 30 23:06:01 2012 -0500
@@ -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
--- a/src/oct-parse.yy	Mon Jan 30 23:03:00 2012 -0500
+++ b/src/oct-parse.yy	Mon Jan 30 23:06:01 2012 -0500
@@ -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
             {