Implement pattern ranges for all numeric types.

This commit is contained in:
Josh Matthews 2011-09-21 03:00:32 -04:00 committed by Marijn Haverbeke
parent e6a84f252a
commit ce0f054f9d
14 changed files with 451 additions and 25 deletions

View file

@ -1494,8 +1494,14 @@ fn parse_pat(p: parser) -> @ast::pat {
tok {
if !is_ident(tok) || is_word(p, "true") || is_word(p, "false") {
let lit = parse_lit(p);
hi = lit.span.hi;
pat = ast::pat_lit(@lit);
if eat_word(p, "to") {
let end = parse_lit(p);
hi = end.span.hi;
pat = ast::pat_range(@lit, @end);
} else {
hi = lit.span.hi;
pat = ast::pat_lit(@lit);
}
} else if is_plain_ident(p) &&
alt p.look_ahead(1u) {
token::DOT. | token::LPAREN. | token::LBRACKET. {