1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Unicode identifier properties and syntax (UAX #31).
use binary_props as gen;
/// `XID_Start`: characters that can begin a default Unicode identifier.
pub const
/// `XID_Continue`: characters that can continue a default Unicode identifier
/// (a superset of [`is_xid_start`]).
pub const
/// `true` if `s` is a default Unicode identifier (UAX #31 R1): a non-empty
/// string whose first character has `XID_Start` and whose remaining characters
/// all have `XID_Continue`.
///
/// ```
/// use intl::unicode::is_identifier;
/// assert!(is_identifier("naïve"));
/// assert!(is_identifier("Δx"));
/// assert!(!is_identifier("1st")); // starts with a digit
/// assert!(!is_identifier("a-b")); // hyphen is not XID_Continue
/// assert!(!is_identifier(""));
/// ```