From 68a2f6250684d9bd51f6281c9bcbb20b10d26876 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 27 Sep 2010 08:36:14 +0000 Subject: - Fix support for delimiters at the very end of a query string/file --- Source/SPSQLParser.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/SPSQLParser.m') diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m index 8173170d..4cb0aaa4 100644 --- a/Source/SPSQLParser.m +++ b/Source/SPSQLParser.m @@ -765,14 +765,14 @@ TO_BUFFER_STATE to_scan_string (const char *); switch((unichar)(long)(*charAtIndex)(self, @selector(_charAtIndex:), currentStringIndex+3)) { case 'i': case 'I': - if([self isMatchedByRegex:@"^(delimiter[ \\t]+(\\S+))(?=\\s)" + if([self isMatchedByRegex:@"^(delimiter[ \\t]+(\\S+))(?=\\s|\\Z)" options:RKLCaseless inRange:NSMakeRange(currentStringIndex, stringLength - currentStringIndex) error:nil]) { // Delimiter command found. Extract the delimiter string itself - NSArray *delimiterCommandParts = [[self arrayOfCaptureComponentsMatchedByRegex:@"(?i)^(delimiter[ \\t]+(\\S+))(?=\\s)" + NSArray *delimiterCommandParts = [[self arrayOfCaptureComponentsMatchedByRegex:@"(?i)^(delimiter[ \\t]+(\\S+))(?=\\s|\\Z)" range:NSMakeRange(currentStringIndex, stringLength - currentStringIndex)] objectAtIndex:0]; if (delimiter) [delimiter release]; delimiter = [[NSString alloc] initWithString:[delimiterCommandParts objectAtIndex:2]]; -- cgit v1.2.3