about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libsyntax/parse/lexer.rs3
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/test/run-pass/alt-range.rs14
4 files changed, 11 insertions, 10 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 {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 15b0c66d6c8..64345dc9736 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1512,7 +1512,7 @@ fn print_pat(s: ps, &&pat: @ast::pat) {
       ast::pat_range(begin, end) => {
         print_expr(s, begin);
         space(s.s);
-        word_space(s, ~"to");
+        word(s.s, ~"..");
         print_expr(s, end);
       }
     }
diff --git a/src/test/run-pass/alt-range.rs b/src/test/run-pass/alt-range.rs
index f3713fabb13..dff4f91be21 100644
--- a/src/test/run-pass/alt-range.rs
+++ b/src/test/run-pass/alt-range.rs
@@ -1,30 +1,30 @@
 fn main() {
     match 5u {
-      1u to 5u => {}
+      1u..5u => {}
       _ => fail ~"should match range",
     }
     match 5u {
-      6u to 7u => fail ~"shouldn't match range",
+      6u..7u => fail ~"shouldn't match range",
       _ => {}
     }
     match check 5u {
       1u => fail ~"should match non-first range",
-      2u to 6u => {}
+      2u..6u => {}
     }
     match 'c' {
-      'a' to 'z' => {}
+      'a'..'z' => {}
       _ => fail ~"should suppport char ranges"
     }
     match -3 {
-      -7 to 5 => {}
+      -7..5 => {}
       _ => fail ~"should match signed range"
     }
     match 3.0 {
-      1.0 to 5.0 => {}
+      1.0..5.0 => {}
       _ => fail ~"should match float range"
     }
     match -1.5 {
-      -3.6 to 3.6 => {}
+      -3.6..3.6 => {}
       _ => fail ~"should match negative float range"
     }
 }