diff options
| author | Josh Matthews <josh@joshmatthews.net> | 2011-09-21 03:00:32 -0400 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-09-21 09:36:12 +0200 |
| commit | ce0f054f9d56df4e60291fc2e1b89ce979cf374f (patch) | |
| tree | c468615e0a4e1ef007a5330fd0b37fb6669de8b9 /src/comp/syntax/parse | |
| parent | e6a84f252ab7a016dd923adbf31e8c86deab1d72 (diff) | |
| download | rust-ce0f054f9d56df4e60291fc2e1b89ce979cf374f.tar.gz rust-ce0f054f9d56df4e60291fc2e1b89ce979cf374f.zip | |
Implement pattern ranges for all numeric types.
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 10 |
1 files changed, 8 insertions, 2 deletions
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. { |
