about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-31 22:34:41 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-01 12:14:36 -0700
commit792436826892d61ca16797fe3d26b1f202f6702a (patch)
treed95244927d1c1bc25abe1d01070541302aefbccf /src/comp/syntax/parse
parent4c25d810415b01b7c2ed250952b8fe3b039f29bf (diff)
downloadrust-792436826892d61ca16797fe3d26b1f202f6702a.tar.gz
rust-792436826892d61ca16797fe3d26b1f202f6702a.zip
Allow istrs as patterns. Issue #855
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 369e07080f4..9c61f569e21 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1497,6 +1497,22 @@ fn parse_pat(p: &parser) -> @ast::pat {
             pat = ast::pat_tup(fields);
         }
       }
+      token::TILDE. {
+        p.bump();
+        alt p.peek() {
+          token::LIT_STR(s) {
+            let sp = p.get_span();
+            p.bump();
+            let lit =
+                @{node: ast::lit_str(p.get_str(s),
+                                     ast::sk_unique),
+                  span: sp};
+            hi = lit.span.hi;
+            pat = ast::pat_lit(lit);
+          }
+          _ { p.fatal(~"expected string literal"); }
+        }
+      }
       tok {
         if !is_ident(tok) || is_word(p, ~"true") || is_word(p, ~"false") {
             let lit = parse_lit(p);