Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/attributes.rs')
| -rw-r--r-- | crates/parser/src/grammar/attributes.rs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/crates/parser/src/grammar/attributes.rs b/crates/parser/src/grammar/attributes.rs index a44c5e4841..80d7b09b3e 100644 --- a/crates/parser/src/grammar/attributes.rs +++ b/crates/parser/src/grammar/attributes.rs @@ -12,31 +12,13 @@ pub(super) fn outer_attrs(p: &mut Parser) { } } -pub(super) fn meta(p: &mut Parser) { - let meta = p.start(); - paths::use_path(p); - - match p.current() { - T![=] => { - p.bump(T![=]); - if expressions::expr(p).0.is_none() { - p.error("expected expression"); - } - } - T!['('] | T!['['] | T!['{'] => items::token_tree(p), - _ => {} - } - - meta.complete(p, META); -} - fn attr(p: &mut Parser, inner: bool) { - let attr = p.start(); assert!(p.at(T![#])); + + let attr = p.start(); p.bump(T![#]); if inner { - assert!(p.at(T![!])); p.bump(T![!]); } @@ -51,3 +33,21 @@ fn attr(p: &mut Parser, inner: bool) { } attr.complete(p, ATTR); } + +pub(super) fn meta(p: &mut Parser) { + let meta = p.start(); + paths::use_path(p); + + match p.current() { + T![=] => { + p.bump(T![=]); + if expressions::expr(p).0.is_none() { + p.error("expected expression"); + } + } + T!['('] | T!['['] | T!['{'] => items::token_tree(p), + _ => {} + } + + meta.complete(p, META); +} |