Skip to content

Commit a5ee4e2

Browse files
authored
Merge pull request #145 from brauliobz/use_declaration
Use declaration grammar
2 parents e17efcb + 4ecd2c7 commit a5ee4e2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/items/use-declarations.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Use declarations
22

3+
> **<sup>Syntax:<sup>**
4+
> _UseDeclaration_ :
5+
> &nbsp;&nbsp; &nbsp;&nbsp; `use` [_SimplePath_]&nbsp;(`as` [IDENTIFIER])<sup>?</sup> `;`
6+
> &nbsp;&nbsp; | `use` ([_SimplePath_]<sup>?</sup> `::`)<sup>?</sup> `{` _UseDeclarationItems_ `}` `;`
7+
> &nbsp;&nbsp; | `use` ([_SimplePath_]<sup>?</sup> `::`)<sup>?</sup> `*` `;`
8+
>
9+
> _UseDeclarationItems_ :
10+
> &nbsp;&nbsp; _UseDeclarationItem_ ( `,` _UseDeclarationItem_ )<sup>*</sup> `,`<sup>?<sup>
11+
>
12+
> _UseDeclarationItem_ :
13+
> &nbsp;&nbsp; ( `self` | [IDENTIFIER] ) ( `as` [IDENTIFIER] )<sup>?</sup>
14+
315
A _use declaration_ creates one or more local name bindings synonymous with
416
some other [path]. Usually a `use` declaration is used to shorten the path
517
required to refer to a module item. These declarations may appear in [modules]
@@ -111,3 +123,6 @@ mod foo {
111123

112124
fn main() {}
113125
```
126+
127+
[IDENTIFIER]: identifiers.html
128+
[_SimplePath_]: paths.html

0 commit comments

Comments
 (0)