Skip to content

Commit c9c8ff1

Browse files
committed
Add visibility section of the grammar
Namely an optional "pub" before any item. The "pub" in the Use declaration section should use this too.
1 parent 9ecc989 commit c9c8ff1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/doc/grammar.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'
304304
## Items
305305

306306
```antlr
307-
item : mod_item | fn_item | type_item | struct_item | enum_item
307+
item : vis ? mod_item | fn_item | type_item | struct_item | enum_item
308308
| const_item | static_item | trait_item | impl_item | extern_block ;
309309
```
310310

@@ -335,8 +335,8 @@ crate_name: ident | ( ident "as" ident )
335335
##### Use declarations
336336

337337
```antlr
338-
use_decl : "pub" ? "use" [ path "as" ident
339-
| path_glob ] ;
338+
use_decl : vis ? "use" [ path "as" ident
339+
| path_glob ] ;
340340
341341
path_glob : ident [ "::" [ path_glob
342342
| '*' ] ] ?
@@ -414,8 +414,9 @@ extern_block : [ foreign_fn ] * ;
414414

415415
## Visibility and Privacy
416416

417-
**FIXME:** grammar?
418-
417+
```antlr
418+
vis : "pub" ;
419+
```
419420
### Re-exporting and Visibility
420421

421422
**FIXME:** grammar?

0 commit comments

Comments
 (0)