First, identifiers
Identifier is an identifier, abbreviated in the rust syntax ident
.
Ident is made up of any non-empty Unicode characters.
Example:
In the attribute syntax, there are
meta_item : ident [ ‘=‘ literal | ‘(‘ meta_seq ‘)‘ ] ? ;
The actual use is as follows:
#![crate_type = "lib"]#![allow(dead_code)]#![feature(intrinsics, lang_items)]#[test]
The above Crate_type, allow, feature, and test are all ident.
See Rust 1.7.0 Grammar Basics attribute
Second, delimiter constraints
The rust syntax specifies which characters cannot be used as delimiters, rather than what characters can be used as delimiters.
The constraint rules are as follows:
non_null
Represents any single Unicode character, but excludes u+0000 (that is, excludes null)
non_eol
Indicates a restricted non_null
, excluding carriage return u+000a (' \ n ')
non_single_quote
Represents a restricted non_null
exclusion single quote u+0027 (')
non_double_quote
Represents non_null
a restricted exclusion of double quotes u+0022 (")
Rust 1.7.0 Syntax base identifier (ident) and delimiter constraints