mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Added code to parse literal strings.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27001 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
324a31ab97
commit
33ee6e2bef
2 changed files with 30 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
* Tools/gdomap.c: Improve error messages and information about
|
||||
the -a option.
|
||||
* Source/NSPredicate.m: parse literal strings
|
||||
|
||||
2008-10-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -756,6 +756,12 @@
|
|||
case NSCustomSelectorPredicateOperatorType:
|
||||
comp = NSStringFromSelector(_selector);
|
||||
break;
|
||||
case NSContainsPredicateOperatorType:
|
||||
comp = @"CONTAINS";
|
||||
break;
|
||||
case NSBetweenPredicateOperatorType:
|
||||
comp = @"BETWEEN";
|
||||
break;
|
||||
}
|
||||
switch (_options)
|
||||
{
|
||||
|
@ -2061,15 +2067,35 @@
|
|||
|
||||
if ([self scanString: @"\"" intoString: NULL])
|
||||
{
|
||||
NSString *str = @"string constant";
|
||||
|
||||
NSCharacterSet *skip = [self charactersToBeSkipped];
|
||||
NSString *str = nil;
|
||||
|
||||
[self setCharactersToBeSkipped: nil];
|
||||
if ([self scanUpToString: @"\"" intoString: &str] == NO)
|
||||
{
|
||||
[self setCharactersToBeSkipped: skip];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Invalid double quoted literal at %u", location];
|
||||
}
|
||||
[self setCharactersToBeSkipped: skip];
|
||||
[self scanString: @"\"" intoString: NULL];
|
||||
return [NSExpression expressionForConstantValue: str];
|
||||
}
|
||||
|
||||
if ([self scanString: @"'" intoString: NULL])
|
||||
{
|
||||
NSString *str = @"string constant";
|
||||
NSCharacterSet *skip = [self charactersToBeSkipped];
|
||||
NSString *str = nil;
|
||||
|
||||
[self setCharactersToBeSkipped: nil];
|
||||
if ([self scanUpToString: @"'" intoString: &str] == NO)
|
||||
{
|
||||
[self setCharactersToBeSkipped: skip];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Invalid single quoted literal at %u", location];
|
||||
}
|
||||
[self setCharactersToBeSkipped: skip];
|
||||
[self scanString: @"'" intoString: NULL];
|
||||
return [NSExpression expressionForConstantValue: str];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue