@@ -47,7 +47,7 @@ fn encode_inner(s: ~str, full_url: bool) -> ~str {
47
47
48
48
while !rdr. eof ( ) {
49
49
let ch = rdr. read_byte ( ) as char ;
50
- alt ch {
50
+ match ch {
51
51
// unreserved:
52
52
'A' to 'Z' |
53
53
'a' to 'z' |
@@ -57,7 +57,7 @@ fn encode_inner(s: ~str, full_url: bool) -> ~str {
57
57
}
58
58
_ {
59
59
if full_url {
60
- alt ch {
60
+ match ch {
61
61
// gen-delims:
62
62
':' | '/' | '?' | '#' | '[' | ']' | '@' |
63
63
@@ -105,14 +105,14 @@ fn decode_inner(s: ~str, full_url: bool) -> ~str {
105
105
let mut out = ~"";
106
106
107
107
while !rdr. eof( ) {
108
- alt rdr. read_char ( ) {
108
+ match rdr. read_char( ) {
109
109
'%' {
110
110
let bytes = rdr. read_bytes( 2 u) ;
111
111
let ch = uint:: parse_buf( bytes, 16 u) . get( ) as char ;
112
112
113
113
if full_url {
114
114
// Only decode some characters:
115
- alt ch {
115
+ match ch {
116
116
// gen-delims:
117
117
':' | '/' | '?' | '#' | '[' | ']' | '@' |
118
118
@@ -160,7 +160,7 @@ fn encode_plus(s: ~str) -> ~str {
160
160
161
161
while !rdr. eof( ) {
162
162
let ch = rdr. read_byte( ) as char ;
163
- alt ch {
163
+ match ch {
164
164
'A' to 'Z' | 'a' to 'z' | '0' to '9' | '_' | '.' | '-' {
165
165
str :: push_char( out, ch) ;
166
166
}
@@ -211,10 +211,10 @@ fn decode_form_urlencoded(s: ~[u8]) ->
211
211
let mut parsing_key = true ;
212
212
213
213
while !rdr. eof( ) {
214
- alt rdr. read_char ( ) {
214
+ match rdr. read_char( ) {
215
215
'&' | ';' {
216
216
if key != ~"" && value != ~"" {
217
- let values = alt m. find ( key) {
217
+ let values = match m. find( key) {
218
218
some( values) { values }
219
219
none {
220
220
let values = @dvec( ) ;
@@ -231,7 +231,7 @@ fn decode_form_urlencoded(s: ~[u8]) ->
231
231
}
232
232
'=' { parsing_key = false ; }
233
233
ch {
234
- let ch = alt ch {
234
+ let ch = match ch {
235
235
'%' {
236
236
uint:: parse_buf( rdr. read_bytes( 2 u) , 16 u) . get( ) as char
237
237
}
@@ -249,7 +249,7 @@ fn decode_form_urlencoded(s: ~[u8]) ->
249
249
}
250
250
251
251
if key != ~"" && value != ~"" {
252
- let values = alt m. find ( key) {
252
+ let values = match m. find( key) {
253
253
some( values) { values }
254
254
none {
255
255
let values = @dvec( ) ;
@@ -268,24 +268,24 @@ fn decode_form_urlencoded(s: ~[u8]) ->
268
268
fn split_char_first( s: ~str , c: char ) -> ( ~str , ~str ) {
269
269
let len = str :: len( s) ;
270
270
let mut index = len;
271
- let mut match_ = 0 ;
271
+ let mut mat = 0 ;
272
272
do io:: with_str_reader( s) |rdr| {
273
273
let mut ch : char ;
274
274
while !rdr. eof( ) {
275
275
ch = rdr. read_byte( ) as char ;
276
276
if ch == c {
277
277
// found a match, adjust markers
278
278
index = rdr. tell( ) -1 ;
279
- match_ = 1 ;
279
+ mat = 1 ;
280
280
break ;
281
281
}
282
282
}
283
283
}
284
- if index+match_ == len {
284
+ if index+mat == len {
285
285
return ( str :: slice( s, 0 , index) , ~"") ;
286
286
} else {
287
287
return ( str :: slice( s, 0 , index) ,
288
- str:: slice ( s, index + match_ , str:: len ( s) ) ) ;
288
+ str :: slice( s, index + mat , str :: len( s) ) ) ;
289
289
}
290
290
}
291
291
@@ -332,7 +332,7 @@ fn query_to_str(query: query) -> ~str {
332
332
// returns the scheme and the rest of the url, or a parsing error
333
333
fn get_scheme(rawurl: ~str) -> result::result<(~str, ~str), @~str> {
334
334
for str::each_chari(rawurl) |i,c| {
335
- alt c {
335
+ match c {
336
336
'A' to 'Z' | 'a' to 'z' { again; }
337
337
'0' to '9' | '+' | '-' | '.' {
338
338
if i == 0 {
@@ -392,7 +392,7 @@ fn get_authority(rawurl: ~str) ->
392
392
if i < 2 { again; } // ignore the leading //
393
393
394
394
// deal with input class first
395
- alt c {
395
+ match c {
396
396
'0' to '9' { }
397
397
'A' to 'F' | 'a' to 'f' {
398
398
if in == digit {
@@ -412,10 +412,10 @@ fn get_authority(rawurl: ~str) ->
412
412
}
413
413
414
414
// now process states
415
- alt c {
415
+ match c {
416
416
':' {
417
417
colon_count += 1;
418
- alt st {
418
+ match st {
419
419
start {
420
420
pos = i;
421
421
st = pass_host_port;
@@ -458,7 +458,7 @@ fn get_authority(rawurl: ~str) ->
458
458
'@' {
459
459
in = digit; // reset input class
460
460
colon_count = 0; // reset count
461
- alt st {
461
+ match st {
462
462
start {
463
463
let user = str::slice(rawurl, begin, i);
464
464
userinfo = option::some({user : user,
@@ -489,7 +489,7 @@ fn get_authority(rawurl: ~str) ->
489
489
}
490
490
491
491
// finish up
492
- alt st {
492
+ match st {
493
493
start {
494
494
if end+1 == len {
495
495
host = str::slice(rawurl, begin, end+1);
@@ -527,7 +527,7 @@ fn get_path(rawurl: ~str, authority : bool) ->
527
527
let len = str::len(rawurl);
528
528
let mut end = len;
529
529
for str::each_chari(rawurl) |i,c| {
530
- alt c {
530
+ match c {
531
531
'A' to 'Z' | 'a' to 'z' | '0' to '9' | '&' |'\' ' | '(' | ')' | '.'
532
532
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '=' {
533
533
again;
@@ -657,11 +657,11 @@ fn to_str(url: url) -> ~str {
657
657
};
658
658
659
659
return str::concat(~[copy url.scheme,
660
- ~": ",
661
- authority,
662
- copy url. path ,
663
- query,
664
- fragment] ) ;
660
+ ~" : ",
661
+ authority,
662
+ copy url.path,
663
+ query,
664
+ fragment]);
665
665
}
666
666
667
667
impl of to_str::to_str for url {
0 commit comments