Skip to content

Commit 8610e4a

Browse files
committed
auto merge of #13168 : jankobler/rust/verify-grammar-02, r=brson
This fixes some problems with make verify-grammar llnextgen still reports a lot of errors FYI: My build directory /my-test/build is different from the source directory /my-test/rust. cd /my-test/build /my-test/rust/configure --prefix=/my-test/bin make make install make verify-grammar
2 parents 74128b1 + fdfb9eb commit 8610e4a

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

mk/docs.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ ifeq ($(CFG_LLNEXTGEN),)
232232
else
233233
.PHONY: verify-grammar
234234

235-
doc/rust.g: rust.md $(S)src/etc/extract_grammar.py
235+
doc/rust.g: $(D)/rust.md $(S)src/etc/extract_grammar.py
236236
@$(call E, extract_grammar: $@)
237237
$(Q)$(CFG_PYTHON) $(S)src/etc/extract_grammar.py $< >$@
238238

src/doc/rust.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Some productions are defined by exclusion of particular Unicode characters:
153153
~~~~ {.notrust .ebnf .gram}
154154
comment : block_comment | line_comment ;
155155
block_comment : "/*" block_comment_body * '*' + '/' ;
156-
block_comment_body : (block_comment | character) * ;
156+
block_comment_body : [block_comment | character] * ;
157157
line_comment : "//" non_eol * ;
158158
~~~~
159159

@@ -205,6 +205,7 @@ The keywords are the following strings:
205205
~~~~ {.notrust .keyword}
206206
as
207207
break
208+
crate
208209
do
209210
else enum extern
210211
false fn for
@@ -496,16 +497,16 @@ All of the above extensions are expressions with values.
496497
## Macros
497498

498499
~~~~ {.notrust .ebnf .gram}
499-
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')'
500-
macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';'
500+
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ;
501+
macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ;
501502
matcher : '(' matcher * ')' | '[' matcher * ']'
502503
| '{' matcher * '}' | '$' ident ':' ident
503504
| '$' '(' matcher * ')' sep_token? [ '*' | '+' ]
504-
| non_special_token
505+
| non_special_token ;
505506
transcriber : '(' transcriber * ')' | '[' transcriber * ']'
506507
| '{' transcriber * '}' | '$' ident
507508
| '$' '(' transcriber * ')' sep_token? [ '*' | '+' ]
508-
| non_special_token
509+
| non_special_token ;
509510
~~~~
510511

511512
User-defined syntax extensions are called "macros",
@@ -802,7 +803,7 @@ use_decl : "pub" ? "use" ident [ '=' path
802803
803804
path_glob : ident [ "::" path_glob ] ?
804805
| '*'
805-
| '{' ident [ ',' ident ] * '}'
806+
| '{' ident [ ',' ident ] * '}' ;
806807
~~~~
807808

808809
A _use declaration_ creates one or more local name bindings synonymous
@@ -1457,7 +1458,7 @@ impl Seq<bool> for u32 {
14571458
### External blocks
14581459

14591460
~~~~ {.notrust .ebnf .gram}
1460-
extern_block_item : "extern" '{' extern_block '} ;
1461+
extern_block_item : "extern" '{' extern_block '}' ;
14611462
extern_block : [ foreign_fn ] * ;
14621463
~~~~
14631464

@@ -1683,7 +1684,7 @@ import public items from their destination, not private items.
16831684

16841685
~~~~ {.notrust .ebnf .gram}
16851686
attribute : '#' '[' attr_list ']' ;
1686-
attr_list : attr [ ',' attr_list ]*
1687+
attr_list : attr [ ',' attr_list ]* ;
16871688
attr : ident [ '=' literal
16881689
| '(' attr_list ')' ] ? ;
16891690
~~~~
@@ -2331,7 +2332,7 @@ struct_expr : expr_path '{' ident ':' expr
23312332
[ ".." expr ] '}' |
23322333
expr_path '(' expr
23332334
[ ',' expr ] * ')' |
2334-
expr_path
2335+
expr_path ;
23352336
~~~~
23362337

23372338
There are several forms of structure expressions.
@@ -2382,7 +2383,7 @@ Point3d {y: 0, z: 10, .. base};
23822383
~~~~ {.notrust .ebnf .gram}
23832384
block_expr : '{' [ view_item ] *
23842385
[ stmt ';' | item ] *
2385-
[ expr ] '}'
2386+
[ expr ] '}' ;
23862387
~~~~
23872388

23882389
A _block expression_ is similar to a module in terms of the declarations that
@@ -2409,7 +2410,7 @@ or dynamically dispatching if the left-hand-side expression is an indirect [obje
24092410
### Field expressions
24102411

24112412
~~~~ {.notrust .ebnf .gram}
2412-
field_expr : expr '.' ident
2413+
field_expr : expr '.' ident ;
24132414
~~~~
24142415

24152416
A _field expression_ consists of an expression followed by a single dot and an identifier,
@@ -2431,9 +2432,9 @@ it is automatically dereferenced to make the field access possible.
24312432
### Vector expressions
24322433

24332434
~~~~ {.notrust .ebnf .gram}
2434-
vec_expr : '[' "mut" ? vec_elems? ']'
2435+
vec_expr : '[' "mut" ? vec_elems? ']' ;
24352436
2436-
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
2437+
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
24372438
~~~~
24382439

24392440
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
@@ -2453,7 +2454,7 @@ as a [literal](#literals) or a [static item](#static-items).
24532454
### Index expressions
24542455

24552456
~~~~ {.notrust .ebnf .gram}
2456-
idx_expr : expr '[' expr ']'
2457+
idx_expr : expr '[' expr ']' ;
24572458
~~~~
24582459

24592460
[Vector](#vector-types)-typed expressions can be indexed by writing a
@@ -2875,7 +2876,7 @@ then any `else` block is executed.
28752876
~~~~ {.notrust .ebnf .gram}
28762877
match_expr : "match" expr '{' match_arm [ '|' match_arm ] * '}' ;
28772878
2878-
match_arm : match_pat '=>' [ expr "," | '{' block '}' ] ;
2879+
match_arm : match_pat "=>" [ expr "," | '{' block '}' ] ;
28792880
28802881
match_pat : pat [ ".." pat ] ? [ "if" expr ] ;
28812882
~~~~

0 commit comments

Comments
 (0)