diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:38:10 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:38:10 -0800 |
| commit | 0631b466c23ffdb1edb2997a8da2702cfe6fcd4a (patch) | |
| tree | 3c9f6076565b544f450e98102825a85df1b55f3b /src/libsyntax/ext/tt/macro_parser.rs | |
| parent | 771fe9026a38cb673d0928fea1f6ebd4ba796e43 (diff) | |
| parent | d85c017f92156d0d6854292c976c13c3312bba8e (diff) | |
| download | rust-0631b466c23ffdb1edb2997a8da2702cfe6fcd4a.tar.gz rust-0631b466c23ffdb1edb2997a8da2702cfe6fcd4a.zip | |
rollup merge of #19430: pczarn/interp_tt-cleanup
Conflicts: src/libsyntax/parse/parser.rs
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 0f9d613cf13..d33d03bbfa9 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -507,6 +507,17 @@ pub fn parse(sess: &ParseSess, pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal { match name { + "tt" => { + p.quote_depth += 1u; //but in theory, non-quoted tts might be useful + let res = token::NtTT(P(p.parse_token_tree())); + p.quote_depth -= 1u; + return res; + } + _ => {} + } + // 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()) { Some(i) => token::NtItem(i), None => p.fatal("expected an item keyword") @@ -529,12 +540,6 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal { token::NtPath(box p.parse_path(LifetimeAndTypesWithoutColons)) } "meta" => token::NtMeta(p.parse_meta_item()), - "tt" => { - p.quote_depth += 1u; //but in theory, non-quoted tts might be useful - let res = token::NtTT(P(p.parse_token_tree())); - p.quote_depth -= 1u; - res - } _ => { p.fatal(format!("unsupported builtin nonterminal parser: {}", name).index(&FullRange)) } |
