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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//! Predefined character predicates.
//!
//! This module contains a number of predefined character predicates that can be
//! used as predicate-functions in some of the parser combinators. In the library
//! predicates are not implemented as closures, but as functions. This allows
//! the predicates to be definded in one place. This ensures that the predicates
//! are not duplicated and that they are consistent throughout the library.
use ;
/// Returns `true` if the character is a valid Unicode letter.
/// Returns `true` if the character is a valid Unicode letter or number.
/// Returns `true` if the character is a valid ASCII letter. `[A-Za-z]`
/// Returns `true` if the character is a valid ASCII letter or number.
/// `[0-9A-Fa-f]`
/// Returns `true` if the character is a printable, non-whitespace ASCII
/// character. `[!-~]`
/// Returns `true` if the character is a space or tab. `[ \t]`
/// Returns `true` if the character is a ASCII whitespace character.
/// `[ \t\n\r\f]`
/// Returns `true` if the character is a binary digit. `[0-1]`
/// Returns `true` if the character is a printable, non-whitespace ASCII or
/// Unicode character excluding `'` and `\`. It is used to determine if a
/// character can be used in a quoted character literal.
/// Returns `true` if the character is a decimal digit. `[0-9]`
/// Returns `true` if the character is a hexadecimal digit. `[0-9A-Fa-f]`
/// Returns `true` if the character is a valid Unicode identifier continuation
/// character.
///
/// Implements the [Unicode Standard Annex #31](https://www.unicode.org/reports/tr31/).
/// The standard states that the following characters are valid identifier
/// continuation characters:
///
/// > Continue characters include [start characters](is_ident_start), plus
/// > characters having the Unicode General_Category of nonspacing marks,
/// > spacing combining marks, decimal number, connector punctuation, plus
/// > Other_ID_Continue, minus Pattern_Syntax and Pattern_White_Space code
/// > points.
///
/// This includes the ASCII characters `A-Z`, `a-z`, `0-9` and `_`.
/// Returns `true` if the character is a valid Unicode identifier start
/// character.
///
/// Implements the [Unicode Standard Annex #31](https://www.unicode.org/reports/tr31/).
/// The standard states that the following characters are valid identifier start
/// characters:
///
/// > Start characters are derived from the Unicode General_Category of
/// > uppercase letters, lowercase letters, titlecase letters, modifier letters,
/// > other letters, letter numbers, plus Other_ID_Start, minus Pattern_Syntax
/// > and Pattern_White_Space code points.
///
/// This includes the ASCII characters `A-Z` and `a-z`.
/// Returns `true` if the character is a valid Unicode lowercase letter.
/// Returns `true` if the character is a valid Unicode number.
/// Returns `true` if the character is an octal digit. `[0-7]`
/// Returns `true` if the character is a printable, non-whitespace ASCII or
/// Unicode character.
/// Returns `true` if the character is a printable, non-whitespace ASCII or
/// Unicode character excluding `"` and `\`. It is used to determine if a
/// character can be used in a quoted string literal.
/// Returns `true` if the character is a valid Unicode uppercase letter.
/// Returns `true` if the character is a valid Unicode whitespace character.