from : Identifiers - The Rust Reference
it is saying
RAW_IDENTIFIER → r# IDENTIFIER_OR_KEYWORD
and
NON_KEYWORD_IDENTIFIER → IDENTIFIER_OR_KEYWORDexcept a strict or reserved keyword
i am not sure why it is repeating the same thing here
IDENTIFIER → NON_KEYWORD_IDENTIFIER | RAW_IDENTIFIER
and what does it mean by
except _, RAW_IDENTIFIER, or $crate
here : Macros by example - The Rust Reference
Oh… there’s a really confusing phrasing here. It looks to me like the line of
is supposed to be read
but it’s easy to instead see
thanks for the comment but what about the graph ? i don't understand a piece of
it
NON_KEYWORD_IDENTIFIER is the regular identifier, things like a but not for. RAW_IDENTIFIER is r# followed by any word, like r#a or r#for. Another way to put it is:
KEYWORD_IDENTIFIER -> r# a strict or reserved keyword
NON_KEYWORD_IDENTIFIER -> [r#] IDENTIFIER_OR_KEYWORD except a strict or reserved keyword
IDENTIFIER -> KEYWORD_IDENTIFIER | NON_KEYWORD_IDENTIFIER
That is, r# + a keyword, or a non-keyword with or without r#.
Just checking, since everyone needs to learn “common knowledge” at some point — have you heard of Backus-Naur form? That’s more-or-less what the graph is.