ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/selection
(Generate patch)

Comparing rxvt-unicode/src/perl/selection (file contents):
Revision 1.24 by root, Thu Jan 12 23:11:23 2006 UTC vs.
Revision 1.25 by root, Thu Jan 12 23:30:51 2006 UTC

21} 21}
22 22
23# "find interetsing things"-patterns 23# "find interetsing things"-patterns
24my @mark_patterns = ( 24my @mark_patterns = (
25 # common types of "parentheses" 25 # common types of "parentheses"
26 qr{(?:^|\s) ‘ ([^‘’]+?) ’ (?:\s|\)|$)}x, 26 qr{ (?<![^[:space:]]) ‘ ([^‘’]+) ’ (?![^[:space]]) }x,
27 qr{(?:^|\s) ` ([^`']+?) ' (?:\s|\)|$)}x, 27 qr{ (?<![^[:space:]]) ` ([^`']+) ' (?![^[:space]]) }x,
28 qr{ \{ ([^{}]+?) \} }x, 28 qr{ (?<![^[:space:]]) (" [^[:space:]] [^"]* ") }x,
29 qr{ \[ ([^{}]+?) \] }x, 29 qr{ (" [^"]* [^[:space:]] ") (?![^[:space]]) }x,
30 qr{ \( ([^()]+?) \) }x, 30 qr{ \< ([^<>[:space:]]+) \> }x,
31 qr{ \{ ([^{}[:space:]]+) \} }x,
32 qr{ \[ ([^{}[:space:]]+) \] }x,
33 qr{ \( ([^()[:space:]]+) \) }x,
31 34
32 # urls, just a heuristic 35 # urls, just a heuristic
33 qr{( 36 qr{(
34 (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+ 37 (?:https?|ftp|news|mailto|file)://[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~]+
35 [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic) 38 [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic)
68 while ($text =~ /$regex/g) { 71 while ($text =~ /$regex/g) {
69 if ($-[1] <= $markofs and $markofs <= $+[1]) { 72 if ($-[1] <= $markofs and $markofs <= $+[1]) {
70 my $ofs = $-[1]; 73 my $ofs = $-[1];
71 my $match = $1; 74 my $match = $1;
72 75
73 push @matches, [$ofs, length $match];
74
75 for my $regex (@simplify_patterns) { 76 for my $regex (@simplify_patterns) {
76 if ($match =~ $regex) { 77 if ($match =~ $regex) {
77 $match = $1; 78 $match = $1;
78 $ofs += $-[1]; 79 $ofs += $-[1];
79 } 80 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines