From c4173bb468500f6490921e8f8627d87b2aeb7af5 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sat, 17 Apr 2021 14:31:52 +0800 Subject: Handle extended key value attr in mbe --- crates/parser/src/grammar.rs | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'crates/parser/src/grammar.rs') diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index cebb8f400..9bdf0b5fa 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -76,42 +76,7 @@ pub(crate) mod fragments { // Parse a meta item , which excluded [], e.g : #[ MetaItem ] pub(crate) fn meta_item(p: &mut Parser) { - fn is_delimiter(p: &mut Parser) -> bool { - matches!(p.current(), T!['{'] | T!['('] | T!['[']) - } - - if is_delimiter(p) { - items::token_tree(p); - return; - } - - let m = p.start(); - while !p.at(EOF) { - if is_delimiter(p) { - items::token_tree(p); - break; - } else { - // https://doc.rust-lang.org/reference/attributes.html - // https://doc.rust-lang.org/reference/paths.html#simple-paths - // The start of an meta must be a simple path - match p.current() { - IDENT | T![super] | T![self] | T![crate] => p.bump_any(), - T![=] => { - p.bump_any(); - match p.current() { - c if c.is_literal() => p.bump_any(), - T![true] | T![false] => p.bump_any(), - _ => {} - } - break; - } - _ if p.at(T![::]) => p.bump(T![::]), - _ => break, - } - } - } - - m.complete(p, TOKEN_TREE); + attributes::meta(p); } pub(crate) fn item(p: &mut Parser) { -- cgit v1.2.3