diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/json.rs | 18 | ||||
| -rw-r--r-- | src/libstd/net_url.rs | 20 | ||||
| -rw-r--r-- | src/libstd/time.rs | 2 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 7c5a6187a57..6dca7701bf7 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -267,7 +267,7 @@ impl Parser { 'n' => self.parse_ident(~"ull", Null), 't' => self.parse_ident(~"rue", Boolean(true)), 'f' => self.parse_ident(~"alse", Boolean(false)), - '0' to '9' | '-' => self.parse_number(), + '0' .. '9' | '-' => self.parse_number(), '"' => match self.parse_str() { Ok(s) => Ok(String(s)), Err(e) => Err(e) @@ -330,14 +330,14 @@ impl Parser { // There can be only one leading '0'. match self.ch { - '0' to '9' => return self.error(~"invalid number"), + '0' .. '9' => return self.error(~"invalid number"), _ => () } } - '1' to '9' => { + '1' .. '9' => { while !self.eof() { match self.ch { - '0' to '9' => { + '0' .. '9' => { res *= 10f; res += ((self.ch as int) - ('0' as int)) as float; @@ -358,7 +358,7 @@ impl Parser { // Make sure a digit follows the decimal place. match self.ch { - '0' to '9' => (), + '0' .. '9' => (), _ => return self.error(~"invalid number") } @@ -366,7 +366,7 @@ impl Parser { let mut dec = 1f; while !self.eof() { match self.ch { - '0' to '9' => { + '0' .. '9' => { dec /= 10f; res += (((self.ch as int) - ('0' as int)) as float) * dec; @@ -394,13 +394,13 @@ impl Parser { // Make sure a digit follows the exponent place. match self.ch { - '0' to '9' => (), + '0' .. '9' => (), _ => return self.error(~"invalid number") } while !self.eof() { match self.ch { - '0' to '9' => { + '0' .. '9' => { exp *= 10u; exp += (self.ch as uint) - ('0' as uint); @@ -443,7 +443,7 @@ impl Parser { let mut n = 0u; while i < 4u { match self.next_char() { - '0' to '9' => { + '0' .. '9' => { n = n * 16u + (self.ch as uint) - ('0' as uint); }, diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index b1e1209cbb5..c32e0466bba 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -50,9 +50,9 @@ fn encode_inner(s: ~str, full_url: bool) -> ~str { let ch = rdr.read_byte() as char; match ch { // unreserved: - 'A' to 'Z' | - 'a' to 'z' | - '0' to '9' | + 'A' .. 'Z' | + 'a' .. 'z' | + '0' .. '9' | '-' | '.' | '_' | '~' => { str::push_char(out, ch); } @@ -162,7 +162,7 @@ fn encode_plus(s: ~str) -> ~str { while !rdr.eof() { let ch = rdr.read_byte() as char; match ch { - 'A' to 'Z' | 'a' to 'z' | '0' to '9' | '_' | '.' | '-' => { + 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '.' | '-' => { str::push_char(out, ch); } ' ' => str::push_char(out, '+'), @@ -340,8 +340,8 @@ fn query_to_str(query: Query) -> ~str { fn get_scheme(rawurl: ~str) -> result::Result<(~str, ~str), @~str> { for str::each_chari(rawurl) |i,c| { match c { - 'A' to 'Z' | 'a' to 'z' => again, - '0' to '9' | '+' | '-' | '.' => { + 'A' .. 'Z' | 'a' .. 'z' => again, + '0' .. '9' | '+' | '-' | '.' => { if i == 0 { return result::Err(@~"url: Scheme must begin with a letter."); } @@ -415,13 +415,13 @@ fn get_authority(rawurl: ~str) -> // deal with input class first match c { - '0' to '9' => (), - 'A' to 'F' | 'a' to 'f' => { + '0' .. '9' => (), + 'A' .. 'F' | 'a' .. 'f' => { if in == Digit { in = Hex; } } - 'G' to 'Z' | 'g' to 'z' | '-' | '.' | '_' | '~' | '%' | + 'G' .. 'Z' | 'g' .. 'z' | '-' | '.' | '_' | '~' | '%' | '&' |'\'' | '(' | ')' | '+' | '!' | '*' | ',' | ';' | '=' => { in = Unreserved; } @@ -558,7 +558,7 @@ fn get_path(rawurl: ~str, authority : bool) -> let mut end = len; for str::each_chari(rawurl) |i,c| { match c { - 'A' to 'Z' | 'a' to 'z' | '0' to '9' | '&' |'\'' | '(' | ')' | '.' + 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.' | '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '=' | '_' | '-' => { again; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index b8342ce8f88..3867ae35843 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -215,7 +215,7 @@ fn strptime(s: &str, format: &str) -> Result<Tm, ~str> { pos = next; match ch { - '0' to '9' => { + '0' .. '9' => { value = value * 10_i32 + (ch as i32 - '0' as i32); } ' ' if ws => (), |
