about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-08-13 17:37:08 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-08-13 17:37:08 -0700
commit55ee06b8ce70cf86e9df7e501f700cc3e520376d (patch)
treef1adfcb85145ce8f3bdd855cc47894d87834734f /src/libsyntax/parse
parent36d8682269fb29a10da93634cff4a9320c45a2f4 (diff)
downloadrust-55ee06b8ce70cf86e9df7e501f700cc3e520376d.tar.gz
rust-55ee06b8ce70cf86e9df7e501f700cc3e520376d.zip
libsyntax: Accept "1..3" as the preferred form of "1 to 3" in patterns
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer.rs3
-rw-r--r--src/libsyntax/parse/parser.rs2
2 files changed, 3 insertions, 2 deletions
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 {