Changeset 473


Ignore:
Timestamp:
04/30/08 00:22:52 (17 years ago)
Author:
Nicholas Riley
Message:

Fix asymmetric parsing of single words wrapped in ambiguous delimiters. Strip trailing exclamation points like commas, semicolons, periods and commas.

Location:
trunk/ICeCoffEE/ICeCoffEE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEParser.m

    r436 r473  
    7474   
    7575    @try {
    76         if ([[NSCharacterSet characterSetWithCharactersInString: @";,."] characterIsMember:
     76        if ([[NSCharacterSet characterSetWithCharactersInString: @";,.!"] characterIsMember:
    7777            [string characterAtIndex: selEnd - 1]]) {
    7878            selEnd--;
    7979        }
    8080        NSCharacterSet *alphanumericCharacterSet = [NSCharacterSet alphanumericCharacterSet];
    81         while (![alphanumericCharacterSet characterIsMember: [string characterAtIndex: selStart]]) {
     81        unichar opening, closing;
     82        while (![alphanumericCharacterSet characterIsMember:
     83                 (opening = [string characterAtIndex: selStart])]) {
     84            closing = [string characterAtIndex: selEnd - 1];
     85            if ((opening == '(' && closing == ')') ||
     86                (opening == '{' && closing == '}') ||
     87                (opening == '[' && closing == ']')) {
     88                selEnd--;
     89            }
    8290            selStart++;
    8391            NSCAssert(selStart < selEnd, @"No URL is selected");
  • trunk/ICeCoffEE/ICeCoffEE/urls.plist

    r388 r473  
    8181 
    8282  {
     83    uri = "foo";
     84    text = "blah blah |(foo)| blah blah";
     85  },
     86
     87  {
     88    uri = "foo";
     89    text = "blah blah |(foo)|! blah blah";
     90  },
     91 
     92  {
    8393    uri = "telnet:foo";
    8494    text = "foo bar baz|[telnet:foo]|baz bar foo";
Note: See TracChangeset for help on using the changeset viewer.