From 55ee06b8ce70cf86e9df7e501f700cc3e520376d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 13 Aug 2012 17:37:08 -0700 Subject: libsyntax: Accept "1..3" as the preferred form of "1 to 3" in patterns --- src/libsyntax/parse/lexer.rs | 3 ++- src/libsyntax/parse/parser.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 69dde491bdf..23f5eac07df 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -377,7 +377,8 @@ fn scan_number(c: char, rdr: string_reader) -> token::token { } } let mut is_float = false; - if rdr.curr == '.' && !(is_alpha(nextch(rdr)) || nextch(rdr) == '_') { + if rdr.curr == '.' && !(is_alpha(nextch(rdr)) || nextch(rdr) == '_' || + nextch(rdr) == '.') { is_float = true; bump(rdr); let dec_part = scan_digits(rdr, 10u); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b50d4be4ae0..685a6a34405 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1797,7 +1797,7 @@ class parser { || self.is_keyword(~"false") { let val = self.parse_expr_res(RESTRICT_NO_BAR_OP); - if self.eat_keyword(~"to") { + if self.eat_keyword(~"to") || self.eat(token::DOTDOT) { let end = self.parse_expr_res(RESTRICT_NO_BAR_OP); pat = pat_range(val, end); } else { -- cgit 1.4.1-3-g733a5