Changeset 382 for trunk/ICeCoffEE/ICeCoffEE/TestParser.m
- Timestamp:
- 02/11/08 06:29:28 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/TestParser.m
r377 r382 11 11 12 12 #include <stdarg.h> 13 14 NSString *ICCF_ErrString(OSStatus err, NSString *context) {15 return [NSString stringWithFormat: @"%@ (%d)", context, (int)err];16 }17 18 void ICCF_CheckRange(NSRange range) {}19 13 20 14 static void ps(NSString *format, ...) { … … 32 26 [@"" stringByPaddingToLength: r.length withString: @"-" startingAtIndex: 0]]); 33 27 } 28 29 NSString *ICCF_ErrString(OSStatus err, NSString *context) { 30 return [NSString stringWithFormat: @"%@ (%d)", context, (int)err]; 31 } 32 33 void ICCF_CheckRange(NSRange range) { 34 if (range.length > 0) 35 return; 36 37 pr(@"Invalid ", range); 38 @throw([NSException exceptionWithName: NSRangeException 39 reason: @"No URL is selected" 40 userInfo: nil]); 41 } 42 34 43 35 44 static BOOL check_parse(NSString *uri, NSString *text, … … 97 106 delimitedURIRange.location = 0; 98 107 delimitedURIRange.length = [uri length]; 99 } // XXX add ^ ^ to indicate initialSelectionRange? 108 } 109 110 NSArray *bits = [text componentsSeparatedByString: @"^"]; 111 if ([bits count] == 3) { 112 NSString *joined = [bits componentsJoinedByString: @""]; 113 NSRange initialSelectionRange = { 114 [(NSString *)[bits objectAtIndex: 0] length], 115 [(NSString *)[bits objectAtIndex: 1] length] 116 }; 117 delimitedURIRange.length -= 2; // remove ^^ 118 if (check_parse(uri == text ? joined : uri, joined, 119 delimitedURIRange, initialSelectionRange)) { 120 pass++; 121 } else { 122 fail++; 123 goto summary; 124 } 125 if (uri == text) 126 continue; 127 text = joined; 128 } 100 129 101 130 for (unsigned startOffset = 0 ; startOffset < delimitedURIRange.length ; ++startOffset) {
Note:
See TracChangeset
for help on using the changeset viewer.