Skip to content

Commit 0ade720

Browse files
committed
unicode: Rename is_XID_start to is_xid_start, is_XID_continue to is_xid_continue
1 parent a800e1e commit 0ade720

File tree

5 files changed

+33
-8
lines changed

5 files changed

+33
-8
lines changed

src/libfmt_macros/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl<'a> Parser<'a> {
378378
/// characters.
379379
fn word(&mut self) -> &'a str {
380380
let start = match self.cur.clone().next() {
381-
Some((pos, c)) if c.is_XID_start() => {
381+
Some((pos, c)) if c.is_xid_start() => {
382382
self.cur.next();
383383
pos
384384
}
@@ -387,7 +387,7 @@ impl<'a> Parser<'a> {
387387
let mut end;
388388
loop {
389389
match self.cur.clone().next() {
390-
Some((_, c)) if c.is_XID_continue() => {
390+
Some((_, c)) if c.is_xid_continue() => {
391391
self.cur.next();
392392
}
393393
Some((pos, _)) => { end = pos; break }

src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub fn sanitize(s: &str) -> String {
271271
// Underscore-qualify anything that didn't start as an ident.
272272
if result.len() > 0u &&
273273
result.as_bytes()[0] != '_' as u8 &&
274-
! (result.as_bytes()[0] as char).is_XID_start() {
274+
! (result.as_bytes()[0] as char).is_xid_start() {
275275
return format!("_{}", result.as_slice());
276276
}
277277

src/librustdoc/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ impl Collector {
301301
// we use these headings as test names, so it's good if
302302
// they're valid identifiers.
303303
let name = name.chars().enumerate().map(|(i, c)| {
304-
if (i == 0 && c.is_XID_start()) ||
305-
(i != 0 && c.is_XID_continue()) {
304+
if (i == 0 && c.is_xid_start()) ||
305+
(i != 0 && c.is_xid_continue()) {
306306
c
307307
} else {
308308
'_'

src/libsyntax/parse/lexer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl<'a> StringReader<'a> {
685685
// integer literal followed by field/method access or a range pattern
686686
// (`0..2` and `12.foo()`)
687687
if self.curr_is('.') && !self.nextch_is('.') && !self.nextch().unwrap_or('\0')
688-
.is_XID_start() {
688+
.is_xid_start() {
689689
// might have stuff after the ., and if it does, it needs to start
690690
// with a number
691691
self.bump();
@@ -1421,7 +1421,7 @@ fn ident_start(c: Option<char>) -> bool {
14211421
(c >= 'a' && c <= 'z')
14221422
|| (c >= 'A' && c <= 'Z')
14231423
|| c == '_'
1424-
|| (c > '\x7f' && c.is_XID_start())
1424+
|| (c > '\x7f' && c.is_xid_start())
14251425
}
14261426

14271427
fn ident_continue(c: Option<char>) -> bool {
@@ -1431,7 +1431,7 @@ fn ident_continue(c: Option<char>) -> bool {
14311431
|| (c >= 'A' && c <= 'Z')
14321432
|| (c >= '0' && c <= '9')
14331433
|| c == '_'
1434-
|| (c > '\x7f' && c.is_XID_continue())
1434+
|| (c > '\x7f' && c.is_xid_continue())
14351435
}
14361436

14371437
#[cfg(test)]

src/libunicode/u_char.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,36 @@ pub trait UnicodeChar {
167167
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
168168
/// mostly similar to ID_Start but modified for closure under NFKx.
169169
#[allow(non_snake_case)]
170+
#[deprecated = "use is_xid_start"]
170171
fn is_XID_start(self) -> bool;
171172

173+
/// Returns whether the specified character satisfies the 'XID_Start'
174+
/// Unicode property.
175+
///
176+
/// 'XID_Start' is a Unicode Derived Property specified in
177+
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
178+
/// mostly similar to ID_Start but modified for closure under NFKx.
179+
#[allow(non_snake_case)]
180+
fn is_xid_start(self) -> bool;
181+
172182
/// Returns whether the specified `char` satisfies the 'XID_Continue'
173183
/// Unicode property.
174184
///
175185
/// 'XID_Continue' is a Unicode Derived Property specified in
176186
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
177187
/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
178188
#[allow(non_snake_case)]
189+
#[deprecated = "use is_xid_continue"]
179190
fn is_XID_continue(self) -> bool;
180191

192+
/// Returns whether the specified `char` satisfies the 'XID_Continue'
193+
/// Unicode property.
194+
///
195+
/// 'XID_Continue' is a Unicode Derived Property specified in
196+
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
197+
/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
198+
#[allow(non_snake_case)]
199+
fn is_xid_continue(self) -> bool;
181200

182201
/// Indicates whether a character is in lowercase.
183202
///
@@ -267,10 +286,16 @@ impl UnicodeChar for char {
267286
}
268287
}
269288

289+
#[deprecated = "use is_xid_start"]
270290
fn is_XID_start(self) -> bool { derived_property::XID_Start(self) }
271291

292+
#[deprecated = "use is_xid_continue"]
272293
fn is_XID_continue(self) -> bool { derived_property::XID_Continue(self) }
273294

295+
fn is_xid_start(self) -> bool { derived_property::XID_Start(self) }
296+
297+
fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) }
298+
274299
fn is_lowercase(self) -> bool {
275300
match self {
276301
'a' ... 'z' => true,

0 commit comments

Comments
 (0)