diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-08-31 22:34:41 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-01 12:14:36 -0700 |
| commit | 792436826892d61ca16797fe3d26b1f202f6702a (patch) | |
| tree | d95244927d1c1bc25abe1d01070541302aefbccf /src/comp/syntax/parse | |
| parent | 4c25d810415b01b7c2ed250952b8fe3b039f29bf (diff) | |
| download | rust-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.rs | 16 |
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); |
