- Timestamp:
- 02/11/08 06:29:28 (17 years ago)
- Location:
- trunk/ICeCoffEE/ICeCoffEE
- Files:
-
- 2 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) { -
trunk/ICeCoffEE/ICeCoffEE/urls.plist
r374 r382 9 9 }, 10 10 11 { /* Start with caret-delimited selection */ 12 uri = "https://www-s.acm.uiuc.edu/wiki/space/^(user)^mloar2"; 13 }, 14 15 { 16 uri = "https://www-s.acm.uiuc.edu/wiki/space/(u^ser)m^loar2"; 17 }, 18 19 { 20 uri = "https://www-s.acm.uiuc.edu/wiki/space/mloar2^(user)^"; 21 }, 22 11 23 { 12 24 uri = "https://www-s.acm.uiuc.edu/wiki/space/usermloar2"; 13 text = "|<https://www-s.acm.uiuc.edu/wiki/space/usermloar2>| 25 text = "|<https://www-s.acm.uiuc.edu/wiki/space/usermloar2>|foo"; 14 26 }, 15 27 … … 68 80 }, 69 81 82 { 83 uri = "telnet:foo"; 84 text = "foo bar baz|[telnet:foo]|baz bar foo"; 85 }, 86 87 { 88 uri = "http://en.wikipedia.org/wiki/Paprika_(2006_film)"; 89 text = "|<http://en.wikipedia.org/wiki/Paprika_(2006_film)>|foo"; 90 }, 70 91 ) 71 92
Note:
See TracChangeset
for help on using the changeset viewer.