From ce0f054f9d56df4e60291fc2e1b89ce979cf374f Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 21 Sep 2011 03:00:32 -0400 Subject: Implement pattern ranges for all numeric types. --- src/comp/syntax/parse/parser.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 6869dc6501d..efed1380a23 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -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. { -- cgit 1.4.1-3-g733a5