lunaPC / objectiveclipse

Automatically exported from code.google.com/p/objectiveclipse
0 stars 0 forks source link

Parser recovery at subsequent @implementation point #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When we hit a second @implementation, the parser falls over completely. This 
might occur when 
writing a class from scratch, and before we hit @end.

--- 8< ---

@implementation First

-(void)first
{

}

// @end // uncomment this line, outline appears. Comment it and everything 
(above/below) 
disappears.

@implementation Second

-(void)second
{

}

@end

--- 8< ---

Since we can't nest @ends, any @implementation or @interface (or @protocol, 
come to think of it) 
is implicitly going to be an @end for the above. It'll still be a syntax error, 
but the parser should 
keep on going if possible. Otherwise, when typing out new classes, the outline 
will 
appear/disappear.

A degenerate case is when we haven't got an @end at the end of the file:

--- 8< ---

@implementation First

-(void)first
{

}

--- 8< ---

This doesn't show up anything in the outline view (fairly reasonably, since 
it's not a valid 
implementation at this point, but would be nice to give coverage if possible). 
Maybe we have an 
AST that looks like [implementation][syntax error missing @end] ?

Original issue reported on code.google.com by alex.ble...@gmail.com on 11 Jul 2009 at 9:32

GoogleCodeExporter commented 8 years ago
Committed patch in bug 30 and verified. Also added test case so that we can 
trap this in the future.

http://code.google.com/p/objectiveclipse/source/detail?r=118

Original comment by alex.ble...@gmail.com on 19 Jul 2009 at 9:45