Skip to content

Commit ab913c8

Browse files
committed
Fill in grammar for Statements
Some of this text is duplicated in the reference (and belongs there) so remove it. It says item grammar is the same, so point to that grammar section.
1 parent a5c651c commit ab913c8

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/doc/grammar.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -434,26 +434,19 @@ meta_seq : meta_item [ ',' meta_seq ] ? ;
434434

435435
## Statements
436436

437-
**FIXME:** grammar?
437+
```antlr
438+
stmt : decl_stmt | expr_stmt ;
439+
```
438440

439441
### Declaration statements
440442

441-
**FIXME:** grammar?
442-
443-
A _declaration statement_ is one that introduces one or more *names* into the
444-
enclosing statement block. The declared names may denote new variables or new
445-
items.
443+
```antlr
444+
decl_stmt : item | let_decl ;
445+
```
446446

447447
#### Item declarations
448448

449-
**FIXME:** grammar?
450-
451-
An _item declaration statement_ has a syntactic form identical to an
452-
[item](#items) declaration within a module. Declaring an item — a
453-
function, enumeration, structure, type, static, trait, implementation or module
454-
— locally within a statement block is simply a way of restricting its
455-
scope to a narrow region containing all of its uses; it is otherwise identical
456-
in meaning to declaring the item outside the statement block.
449+
See [Items](#items).
457450

458451
#### Variable declarations
459452

@@ -464,7 +457,9 @@ init : [ '=' ] expr ;
464457

465458
### Expression statements
466459

467-
**FIXME:** grammar?
460+
```antlr
461+
expr_stmt : expr ';' ;
462+
```
468463

469464
## Expressions
470465

0 commit comments

Comments
 (0)