Skip to content

Commit

Permalink
docs: fix fallout of merging ast::ViewItem into ast::Item.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Dec 31, 2014
1 parent f300582 commit 4e67407
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,9 @@ Crates contain [items](#items), each of which may have some number of
## Items

```{.ebnf .gram}
item : mod_item | fn_item | type_item | struct_item | enum_item
| static_item | trait_item | impl_item | extern_block ;
item : extern_crate_decl | use_decl | mod_item | fn_item | type_item
| struct_item | enum_item | static_item | trait_item | impl_item
| extern_block ;
```

An _item_ is a component of a crate; some module items can be defined in crate
Expand All @@ -817,6 +818,8 @@ execution, and may reside in read-only memory.

There are several kinds of item:

* [`extern crate` declarations](#extern-crate-declarations)
* [`use` declarations](#use-declarations)
* [modules](#modules)
* [functions](#functions)
* [type definitions](#type-definitions)
Expand Down Expand Up @@ -853,13 +856,10 @@ no notion of type abstraction: there are no first-class "forall" types.

```{.ebnf .gram}
mod_item : "mod" ident ( ';' | '{' mod '}' );
mod : [ view_item | item ] * ;
mod : item * ;
```

A module is a container for zero or more [view items](#view-items) and zero or
more [items](#items). The view items manage the visibility of the items defined
within the module, as well as the visibility of names from outside the module
when referenced from inside the module.
A module is a container for zero or more [items](#items).

A _module item_ is a module, surrounded in braces, named, and prefixed with the
keyword `mod`. A module item introduces a new, named module into the tree of
Expand Down Expand Up @@ -917,19 +917,6 @@ mod thread {
}
```

#### View items

```{.ebnf .gram}
view_item : extern_crate_decl | use_decl ;
```

A view item manages the namespace of a module. View items do not define new
items, but rather, simply change other items' visibility. There are two
kinds of view items:

* [`extern crate` declarations](#extern-crate-declarations)
* [`use` declarations](#use-declarations)

##### Extern crate declarations

```{.ebnf .gram}
Expand Down Expand Up @@ -2854,13 +2841,12 @@ Point3d {y: 0, z: 10, .. base};
### Block expressions

```{.ebnf .gram}
block_expr : '{' [ view_item ] *
[ stmt ';' | item ] *
block_expr : '{' [ stmt ';' | item ] *
[ expr ] '}' ;
```

A _block expression_ is similar to a module in terms of the declarations that
are possible. Each block conceptually introduces a new namespace scope. View
are possible. Each block conceptually introduces a new namespace scope. Use
items can bring new names into scopes and declared items are in scope for only
the block itself.

Expand Down

0 comments on commit 4e67407

Please sign in to comment.