diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-03-13 11:34:51 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-03-13 11:36:30 +0200 |
| commit | 9889aae13e14c306fce8cefd669841fa40f26ee9 (patch) | |
| tree | bbcd59c8ec0c1038956b9b8982f404c52311c4a8 /src/libsyntax/ext/tt/macro_parser.rs | |
| parent | 79dd393a4f144fa5e6f81c720c782de3175810d7 (diff) | |
| download | rust-9889aae13e14c306fce8cefd669841fa40f26ee9.tar.gz rust-9889aae13e14c306fce8cefd669841fa40f26ee9.zip | |
syntax: use lookahead to distinguish inner and outer attributes, instead of passing the latter around.
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index eb15d708232..b7d40a46f3e 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -521,12 +521,15 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal { // check at the beginning and the parser checks after each bump p.check_unknown_macro_variable(); match name { - "item" => match p.parse_item(Vec::new()) { + "item" => match p.parse_item() { Some(i) => token::NtItem(i), None => p.fatal("expected an item keyword") }, "block" => token::NtBlock(p.parse_block()), - "stmt" => token::NtStmt(p.parse_stmt(Vec::new())), + "stmt" => match p.parse_stmt() { + Some(s) => token::NtStmt(s), + None => p.fatal("expected a statement") + }, "pat" => token::NtPat(p.parse_pat()), "expr" => token::NtExpr(p.parse_expr()), "ty" => token::NtTy(p.parse_ty()), |
