Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[documentation] rust.md#number-literals grammar does not match behaviour in scan_number() #6824

Closed
caitp opened this issue May 30, 2013 · 1 comment

Comments

@caitp
Copy link

caitp commented May 30, 2013

From: https://github.com/mozilla/rust/blob/cd2eb4701fc16e7acd6934759be043b1f7e5586d/doc/rust.md#number-literals

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:

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.

caitp pushed a commit to caitp/rust that referenced this issue May 30, 2013
Show `int_suffix_size` to appear 0 or 1 times
Show `exponent | . dec_lit` to appear 0 or 1 times, to show why `3f;` is a valid number
@caitp
Copy link
Author

caitp commented May 30, 2013

Closed by #6825

@caitp caitp closed this as completed May 30, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 11, 2021
Refactor: organize loops file into loops module (Delegated)

`@flip1995` `@nahuakang`

closes rust-lang#6693
r? `@flip1995`

 As we talked about in the PM of Zulip,  this PR is a delegated PR from `@nahuakang.`

Changes from the last commit of rust-lang#6693:
1. Unify the name of the main entries of all modules to check, that was pointed out [here](rust-lang/rust-clippy#6693 (comment))
2. Simplify ` check_for_loop_arg`, that was pointed out [here](rust-lang/rust-clippy#6693 (comment)) and [here](rust-lang/rust-clippy#6693 (comment))
3. Resolve conflicts

changelog: Refactor `loops.rs` file into `loops` module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant