@@ -60,25 +60,25 @@ pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
60
60
pub fn is_XID_start ( c : char ) -> bool { derived_property:: XID_Start ( c) }
61
61
pub fn is_XID_continue ( c : char ) -> bool { derived_property:: XID_Continue ( c) }
62
62
63
- /**
64
- * Indicates whether a character is in lower case, defined
65
- * in terms of the Unicode General Category 'Ll'
66
- * /
63
+ ///
64
+ /// Indicates whether a character is in lower case, defined
65
+ /// in terms of the Unicode General Category 'Ll'
66
+ // /
67
67
#[ inline( always) ]
68
68
pub fn is_lowercase ( c : char ) -> bool { general_category:: Ll ( c) }
69
69
70
- /**
71
- * Indicates whether a character is in upper case, defined
72
- * in terms of the Unicode General Category 'Lu'.
73
- * /
70
+ ///
71
+ /// Indicates whether a character is in upper case, defined
72
+ /// in terms of the Unicode General Category 'Lu'.
73
+ // /
74
74
#[ inline( always) ]
75
75
pub fn is_uppercase ( c : char ) -> bool { general_category:: Lu ( c) }
76
76
77
- /**
78
- * Indicates whether a character is whitespace. Whitespace is defined in
79
- * terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
80
- * additional 'Cc'-category control codes in the range [0x09, 0x0d]
81
- * /
77
+ ///
78
+ /// Indicates whether a character is whitespace. Whitespace is defined in
79
+ /// terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
80
+ /// additional 'Cc'-category control codes in the range [0x09, 0x0d]
81
+ // /
82
82
#[ inline( always) ]
83
83
pub fn is_whitespace ( c : char ) -> bool {
84
84
( '\x09' <= c && c <= '\x0d' )
@@ -87,11 +87,11 @@ pub fn is_whitespace(c: char) -> bool {
87
87
|| general_category:: Zp ( c)
88
88
}
89
89
90
- /**
91
- * Indicates whether a character is alphanumeric. Alphanumericness is
92
- * defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No'
93
- * and the Derived Core Property 'Alphabetic'.
94
- * /
90
+ ///
91
+ /// Indicates whether a character is alphanumeric. Alphanumericness is
92
+ /// defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No'
93
+ /// and the Derived Core Property 'Alphabetic'.
94
+ // /
95
95
#[ inline( always) ]
96
96
pub fn is_alphanumeric ( c : char ) -> bool {
97
97
derived_property:: Alphabetic ( c)
@@ -108,18 +108,24 @@ pub fn is_digit(c: char) -> bool {
108
108
|| general_category:: No ( c)
109
109
}
110
110
111
- /**
112
- * Checks if a character parses as a numeric digit in the given radix.
113
- * Compared to `is_digit()`, this function only recognizes the
114
- * characters `0-9`, `a-z` and `A-Z`.
115
- *
116
- * Returns `true` if `c` is a valid digit under `radix`, and `false`
117
- * otherwise.
118
- *
119
- * Fails if given a `radix` > 36.
120
- *
121
- * Note: This just wraps `to_digit()`.
122
- */
111
+ ///
112
+ /// Checks if a character parses as a numeric digit in the given radix.
113
+ /// Compared to `is_digit()`, this function only recognizes the
114
+ /// characters `0-9`, `a-z` and `A-Z`.
115
+ ///
116
+ /// # Return value
117
+ ///
118
+ /// Returns `true` if `c` is a valid digit under `radix`, and `false`
119
+ /// otherwise.
120
+ ///
121
+ /// # Failure
122
+ ///
123
+ /// Fails if given a `radix` > 36.
124
+ ///
125
+ /// # Note
126
+ ///
127
+ /// This just wraps `to_digit()`.
128
+ ///
123
129
#[ inline( always) ]
124
130
pub fn is_digit_radix ( c : char , radix : uint ) -> bool {
125
131
match to_digit ( c, radix) {
@@ -128,19 +134,20 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
128
134
}
129
135
}
130
136
131
- /**
132
- * Convert a char to the corresponding digit.
133
- *
134
- * # Return value
135
- *
136
- * If `c` is between '0' and '9', the corresponding value
137
- * between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
138
- * 'b' or 'B', 11, etc. Returns none if the char does not
139
- * refer to a digit in the given radix.
140
- *
141
- * # Failure
142
- * Fails if given a `radix` outside the range `[0..36]`.
143
- */
137
+ ///
138
+ /// Convert a char to the corresponding digit.
139
+ ///
140
+ /// # Return value
141
+ ///
142
+ /// If `c` is between '0' and '9', the corresponding value
143
+ /// between 0 and 9. If `c` is 'a' or 'A', 10. If `c` is
144
+ /// 'b' or 'B', 11, etc. Returns none if the char does not
145
+ /// refer to a digit in the given radix.
146
+ ///
147
+ /// # Failure
148
+ ///
149
+ /// Fails if given a `radix` outside the range `[0..36]`.
150
+ ///
144
151
#[ inline]
145
152
pub fn to_digit ( c : char , radix : uint ) -> Option < uint > {
146
153
if radix > 36 {
@@ -156,14 +163,18 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
156
163
else { None }
157
164
}
158
165
159
- /**
160
- * Converts a number to the character representing it.
161
- *
162
- * Returns `Some(char)` if `num` represents one digit under `radix`,
163
- * using one character of `0-9` or `a-z`, or `None` if it doesn't.
164
- *
165
- * Fails if given an `radix` > 36.
166
- */
166
+ ///
167
+ /// Converts a number to the character representing it.
168
+ ///
169
+ /// # Return value
170
+ ///
171
+ /// Returns `Some(char)` if `num` represents one digit under `radix`,
172
+ /// using one character of `0-9` or `a-z`, or `None` if it doesn't.
173
+ ///
174
+ /// # Failure
175
+ ///
176
+ /// Fails if given an `radix` > 36.
177
+ ///
167
178
#[ inline]
168
179
pub fn from_digit ( num : uint , radix : uint ) -> Option < char > {
169
180
if radix > 36 {
@@ -195,15 +206,15 @@ pub fn escape_unicode(c: char) -> ~str {
195
206
out
196
207
}
197
208
198
- /**
199
- * Return the hexadecimal unicode escape of a char.
200
- *
201
- * The rules are as follows:
202
- *
203
- * - chars in [0,0xff] get 2-digit escapes: `\\xNN`
204
- * - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
205
- * - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
206
- * /
209
+ ///
210
+ /// Return the hexadecimal unicode escape of a char.
211
+ ///
212
+ /// The rules are as follows:
213
+ ///
214
+ /// - chars in [0,0xff] get 2-digit escapes: `\\xNN`
215
+ /// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
216
+ /// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
217
+ // /
207
218
#[ cfg( not( stage0) ) ]
208
219
pub fn escape_unicode ( c : char ) -> ~str {
209
220
let s = u32:: to_str_radix ( c as u32 , 16 u) ;
@@ -222,18 +233,18 @@ pub fn escape_unicode(c: char) -> ~str {
222
233
out
223
234
}
224
235
225
- /**
226
- * Return a 'default' ASCII and C++11-like char-literal escape of a char.
227
- *
228
- * The default is chosen with a bias toward producing literals that are
229
- * legal in a variety of languages, including C++11 and similar C-family
230
- * languages. The exact rules are:
231
- *
232
- * - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
233
- * - Single-quote, double-quote and backslash chars are backslash-escaped.
234
- * - Any other chars in the range [0x20,0x7e] are not escaped.
235
- * - Any other chars are given hex unicode escapes; see `escape_unicode`.
236
- * /
236
+ ///
237
+ /// Return a 'default' ASCII and C++11-like char-literal escape of a char.
238
+ ///
239
+ /// The default is chosen with a bias toward producing literals that are
240
+ /// legal in a variety of languages, including C++11 and similar C-family
241
+ /// languages. The exact rules are:
242
+ ///
243
+ /// - Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
244
+ /// - Single-quote, double-quote and backslash chars are backslash-escaped.
245
+ /// - Any other chars in the range [0x20,0x7e] are not escaped.
246
+ /// - Any other chars are given hex unicode escapes; see `escape_unicode`.
247
+ // /
237
248
pub fn escape_default ( c : char ) -> ~str {
238
249
match c {
239
250
'\t' => ~"\\ t",
0 commit comments