Corrected issue with importing of Headers where comments were

being and imported into the outlets list.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@16995 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-06-22 05:13:11 +00:00
parent 904f61cf9b
commit cb11fd65de
2 changed files with 21 additions and 4 deletions

View file

@ -1,4 +1,12 @@
2003-05-19 Gregory John Casamento <greg_casamento@yahoo.com>
2003-06-22 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: parseHeader added logic to prevent the
addition of outlets/actions with illegal characters when
importing from a header. This also prevents a problem
where comments were being imported into the class as
outlets.
2003-06-19 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: Moved declaration of GSNibItem in instantiateClass:
to the top of the method so that it will compile on gcc < 3.0.

View file

@ -773,12 +773,15 @@ static NSImage *classesImage = nil;
NSScanner *headerScanner = [NSScanner scannerWithString: headerFile];
GormClassManager *cm = [self classManager];
NSCharacterSet *superClassStopSet = [NSCharacterSet characterSetWithCharactersInString: @" \n"];
NSCharacterSet *commentStopSet = [NSCharacterSet characterSetWithCharactersInString: @"\n"];
NSCharacterSet *classStopSet = [NSCharacterSet characterSetWithCharactersInString: @" :"];
NSCharacterSet *typeStopSet = [NSCharacterSet characterSetWithCharactersInString: @" "];
NSCharacterSet *actionStopSet = [NSCharacterSet characterSetWithCharactersInString: @";:"];
NSCharacterSet *outletStopSet = [NSCharacterSet characterSetWithCharactersInString: @";,"];
NSCharacterSet *illegalSet = [NSCharacterSet characterSetWithCharactersInString: @"~`@#$%^&*()+={}|[]\\:;'<>?,./"];
NSArray *outletTokens = [NSArray arrayWithObjects: @"id", @"IBOutlet", nil];
NSArray *actionTokens = [NSArray arrayWithObjects: @"(void)", @"(IBAction)", @"(id)", nil];
NSRange notFoundRange = NSMakeRange(NSNotFound,0);
while (![headerScanner isAtEnd])
{
@ -858,7 +861,7 @@ static NSImage *classesImage = nil;
intoString: NULL];
[ivarScanner scanUpToCharactersFromSet: typeStopSet
intoString: &type];
NSLog(@"outlet type = %@",type);
NSDebugLog(@"outlet type = %@",type);
}
[ivarScanner scanUpToCharactersFromSet: outletStopSet
@ -869,7 +872,10 @@ static NSImage *classesImage = nil;
&& [outlets indexOfObject: outlet] == NSNotFound)
{
NSDebugLog(@"outlet = %@", outlet);
[outlets addObject: outlet];
if(NSEqualRanges([outlet rangeOfCharacterFromSet: illegalSet],notFoundRange))
{
[outlets addObject: outlet];
}
}
}
}
@ -912,7 +918,10 @@ static NSImage *classesImage = nil;
/* Add the ':' back */
action = [action stringByAppendingString: @":"];
NSDebugLog(@"action = %@", action);
[actions addObject: action];
if(NSEqualRanges([action rangeOfCharacterFromSet: illegalSet],notFoundRange))
{
[actions addObject: action];
}
}
else
{