Skip to content

Commit 998f39e

Browse files
authored
Merge pull request #88 from brauliobz/grammar_attributes
Added attributes grammar
2 parents 74d9a44 + 8483480 commit 998f39e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/attributes.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Attributes
22

3+
> **<sup>Syntax</sup>**
4+
> _Attribute_ :
5+
> &nbsp;&nbsp; _InnerAttribute_ | _OuterAttribute_
6+
>
7+
> _InnerAttribute_ :
8+
> &nbsp;&nbsp; `#![` MetaItem `]`
9+
>
10+
> _OuterAttribute_ :
11+
> &nbsp;&nbsp; `#[` MetaItem `]`
12+
>
13+
> _MetaItem_ :
14+
> &nbsp;&nbsp; &nbsp;&nbsp; IDENTIFIER
15+
> &nbsp;&nbsp; | IDENTIFIER `=` LITERAL
16+
> &nbsp;&nbsp; | IDENTIFIER `(` _MetaSeq_ `)`
17+
> &nbsp;&nbsp; | IDENTIFIER `(` _MetaSeq_ `,` `)`
18+
>
19+
> _MetaSeq_ :
20+
> &nbsp;&nbsp; &nbsp;&nbsp; EMPTY
21+
> &nbsp;&nbsp; | _MetaItem_
22+
> &nbsp;&nbsp; | _MetaSeq_ `,` _MetaItem_
23+
324
Any item declaration may have an _attribute_ applied to it. Attributes in Rust
425
are modeled on Attributes in ECMA-335, with the syntax coming from ECMA-334
526
(C#). An attribute is a general, free-form metadatum that is interpreted

0 commit comments

Comments
 (0)