Closed
Description
num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
| '0' [ [ dec_digit | '_' ] + num_suffix ?
| 'b' [ '1' | '0' | '_' ] + int_suffix ?
| 'x' [ hex_digit | '_' ] + int_suffix ? ] ;
num_suffix : int_suffix | float_suffix ;
int_suffix : 'u' int_suffix_size ?
| 'i' int_suffix_size ;
int_suffix_size : [ '8' | '1' '6' | '3' '2' | '6' '4' ] ;
float_suffix : [ exponent | '.' dec_lit exponent ? ] float_suffix_ty ? ;
float_suffix_ty : 'f' [ '3' '2' | '6' '4' ] ;
exponent : ['E' | 'e'] ['-' | '+' ] ? dec_lit ;
dec_lit : [ dec_digit | '_' ] + ;
This description of the grammar has at least two errors:
- It does not allow for '3f;' which is shown to be expected to be valid on https://github.com/mozilla/rust/blame/cd2eb4701fc16e7acd6934759be043b1f7e5586d/doc/rust.md#L379 -- either the
exponent
or'.' dec_lit
must be present according to the diagram. - The signed
int_suffix
path does not permitint_suffix_size
to be omitted, although the parser does allow this.
I've gone over the lexer in libsyntax and I have not yet come across anything else that does not match the docs, but it would be good to get these in order for the benefit of those of us writing syntax highlighters for our editors, and the like. I'll have a patch up soon.
Metadata
Metadata
Assignees
Labels
No labels