mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 01:21:08 +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
1f1e64dac5
commit
2e6a328757
2 changed files with 30 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
* Tools/gdomap.c: Improve error messages and information about
|
* Tools/gdomap.c: Improve error messages and information about
|
||||||
the -a option.
|
the -a option.
|
||||||
|
* Source/NSPredicate.m: parse literal strings
|
||||||
|
|
||||||
2008-10-29 Richard Frith-Macdonald <rfm@gnu.org>
|
2008-10-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -756,6 +756,12 @@
|
||||||
case NSCustomSelectorPredicateOperatorType:
|
case NSCustomSelectorPredicateOperatorType:
|
||||||
comp = NSStringFromSelector(_selector);
|
comp = NSStringFromSelector(_selector);
|
||||||
break;
|
break;
|
||||||
|
case NSContainsPredicateOperatorType:
|
||||||
|
comp = @"CONTAINS";
|
||||||
|
break;
|
||||||
|
case NSBetweenPredicateOperatorType:
|
||||||
|
comp = @"BETWEEN";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
switch (_options)
|
switch (_options)
|
||||||
{
|
{
|
||||||
|
@ -2061,15 +2067,35 @@
|
||||||
|
|
||||||
if ([self scanString: @"\"" intoString: NULL])
|
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];
|
return [NSExpression expressionForConstantValue: str];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self scanString: @"'" intoString: NULL])
|
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];
|
return [NSExpression expressionForConstantValue: str];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue