bugGNU Octave - Bugs: bug #36475, classdef: parsing fails if :end...

 
 

bug #36475: classdef: parsing fails if :end syntax is used

Submitter:  None
Submitted:  Tue 15 May 2012 11:20:01 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  James Laird Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 17 May 2012 04:48:23 AM UTC, comment #4: 
John W. Eaton <jwe>
Group administrator
Wed 16 May 2012 09:27:09 PM UTC, comment #3: 

Yeah, well, I can't say I really like the looks of that conditional either way.  But I'll try to check in the change later tonight.

I don't really understand why classdef files are given special treatment by this section of code.

John W. Eaton <jwe>
Group administrator
Wed 16 May 2012 09:15:35 PM UTC, comment #2: 

You're right, of course. I chose the easy way while I was chasing it down and should have cleaned up the patch. Sorry!

Anonymous
Wed 16 May 2012 08:33:54 PM UTC, comment #1: 

Your patch changes


if (! reading_classdef_file
    && (inside_any_object_index ()
        || (lexer_flags.defining_func
            && ! (lexer_flags.looking_at_return_list
                  || lexer_flags.parsed_function_name.top ()))))


to


if (! reading_classdef_file
    && (inside_any_object_index ()
        || (lexer_flags.defining_func
            && ! (lexer_flags.looking_at_return_list
                  || lexer_flags.parsed_function_name.top ()))))
if (reading_classdef_file && inside_any_object_index ())
  return 0;


Isn't that equivalent to


if (inside_any_object_index ()
    || (! reading_classdef_file
        && (lexer_flags.defining_func
            && ! (lexer_flags.looking_at_return_list
                  || lexer_flags.parsed_function_name.top ())))
  return 0;


?

John W. Eaton <jwe>
Group administrator
Tue 15 May 2012 11:20:01 PM UTC, original submission:  

Any classdef code containing 'end'-based indexing fails to parse, as the 'end' is treated as an end token rather than an indexing keyword.

A test case and patch are attached.

:2> classdef_test_end
parse error near line 5 of file /home/jhl/classdef_test_end.m
  syntax error

>>>             foo(end-5:end) = [];

                      ^

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25863:  classdef_test_end.m added by None (142B - text/x-objcsrc)
file #25864:  classdef_end.patch added by None (527B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-05-17 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2012-05-15 None Attached File- Added classdef_test_end.m, #25863
        Attached File- Added classdef_end.patch, #25864

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code