diff options
| author | Patrick Walton <[email protected]> | 2010-11-24 15:45:59 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-11-24 15:45:59 -0800 |
| commit | f075b10af2c2a1088d72fff0bff1918a8e74fbf0 (patch) | |
| tree | 6e65a8ce0c606bcd132aa9e6f7a7efd20dc94bd2 /src/comp/front/parser.rs | |
| parent | rustc: Parse simple patterns (diff) | |
| download | rust-f075b10af2c2a1088d72fff0bff1918a8e74fbf0.tar.xz rust-f075b10af2c2a1088d72fff0bff1918a8e74fbf0.zip | |
rustc: Add patterns to fold
Diffstat (limited to 'src/comp/front/parser.rs')
| -rw-r--r-- | src/comp/front/parser.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 16c6ed11..a3cc00a0 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -815,13 +815,19 @@ impure fn parse_initializer(parser p) -> option.t[@ast.expr] { impure fn parse_pat(parser p) -> @ast.pat { auto lo = p.get_span(); - auto pat = ast.pat_wild; // FIXME: typestate bug + auto pat = ast.pat_wild(ast.ann_none); // FIXME: typestate bug alt (p.peek()) { - case (token.UNDERSCORE) { p.bump(); pat = ast.pat_wild; } + case (token.UNDERSCORE) { + p.bump(); + pat = ast.pat_wild(ast.ann_none); + } case (token.QUES) { p.bump(); alt (p.peek()) { - case (token.IDENT(?id)) { p.bump(); pat = ast.pat_bind(id); } + case (token.IDENT(?id)) { + p.bump(); + pat = ast.pat_bind(id, ast.ann_none); + } case (?tok) { p.err("expected identifier after '?' in pattern but " + "found " + token.to_str(tok)); @@ -842,7 +848,7 @@ impure fn parse_pat(parser p) -> @ast.pat { case (_) { args = vec(); } } - pat = ast.pat_tag(id, args); + pat = ast.pat_tag(id, args, ast.ann_none); } case (?tok) { p.err("expected pattern but found " + token.to_str(tok)); |