Skip to content

Commit 9fa32c0

Browse files
committed
Fix the num_lit grammar in the reference manual.
- Cause `0` to be considered a valid integer literal (it is). - Add octal literals (missed from rust-lang#10243). I have *not* modified doc/po/rust.md.pot or doc/po/ja/rust.md.po at all; they already seem to be out of date so it's easier to ignore them for myself. I can update them if desired, of course.
1 parent 90754ae commit 9fa32c0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/rust.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ common_escape : '\x5c'
254254
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
255255
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
256256
| dec_digit ;
257+
oct_digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' ;
257258
dec_digit : '0' | nonzero_dec ;
258259
nonzero_dec: '1' | '2' | '3' | '4'
259260
| '5' | '6' | '7' | '8' | '9' ;
@@ -318,8 +319,9 @@ r##"foo #"# bar"##; // foo #"# bar
318319
~~~~ {.ebnf .gram}
319320
320321
num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
321-
| '0' [ [ dec_digit | '_' ] + num_suffix ?
322+
| '0' [ [ dec_digit | '_' ] * num_suffix ?
322323
| 'b' [ '1' | '0' | '_' ] + int_suffix ?
324+
| 'o' [ oct_digit | '_' ] + int_suffix ?
323325
| 'x' [ hex_digit | '_' ] + int_suffix ? ] ;
324326
325327
num_suffix : int_suffix | float_suffix ;

0 commit comments

Comments
 (0)