Implement pattern ranges for all numeric types.
This commit is contained in:
parent
e6a84f252a
commit
ce0f054f9d
14 changed files with 451 additions and 25 deletions
|
|
@ -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. {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue