Skip to content

Commit f39c29d

Browse files
committed
unicode: Rename is_XID_start to is_xid_start, is_XID_continue to is_xid_continue
1 parent 76ddd2b commit f39c29d

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
@@ -383,7 +383,7 @@ impl<'a> Parser<'a> {
383383
/// characters.
384384
fn word(&mut self) -> &'a str {
385385
let start = match self.cur.clone().next() {
386-
Some((pos, c)) if c.is_XID_start() => {
386+
Some((pos, c)) if c.is_xid_start() => {
387387
self.cur.next();
388388
pos
389389
}
@@ -392,7 +392,7 @@ impl<'a> Parser<'a> {
392392
let mut end;
393393
loop {
394394
match self.cur.clone().next() {
395-
Some((_, c)) if c.is_XID_continue() => {
395+
Some((_, c)) if c.is_xid_continue() => {
396396
self.cur.next();
397397
}
398398
Some((pos, _)) => { end = pos; break }

src/librustc_trans/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
@@ -299,8 +299,8 @@ impl Collector {
299299
// we use these headings as test names, so it's good if
300300
// they're valid identifiers.
301301
let name = name.chars().enumerate().map(|(i, c)| {
302-
if (i == 0 && c.is_XID_start()) ||
303-
(i != 0 && c.is_XID_continue()) {
302+
if (i == 0 && c.is_xid_start()) ||
303+
(i != 0 && c.is_xid_continue()) {
304304
c
305305
} else {
306306
'_'

src/libsyntax/parse/lexer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ impl<'a> StringReader<'a> {
692692
// integer literal followed by field/method access or a range pattern
693693
// (`0..2` and `12.foo()`)
694694
if self.curr_is('.') && !self.nextch_is('.') && !self.nextch().unwrap_or('\0')
695-
.is_XID_start() {
695+
.is_xid_start() {
696696
// might have stuff after the ., and if it does, it needs to start
697697
// with a number
698698
self.bump();
@@ -1385,7 +1385,7 @@ fn ident_start(c: Option<char>) -> bool {
13851385
(c >= 'a' && c <= 'z')
13861386
|| (c >= 'A' && c <= 'Z')
13871387
|| c == '_'
1388-
|| (c > '\x7f' && c.is_XID_start())
1388+
|| (c > '\x7f' && c.is_xid_start())
13891389
}
13901390

13911391
fn ident_continue(c: Option<char>) -> bool {
@@ -1395,7 +1395,7 @@ fn ident_continue(c: Option<char>) -> bool {
13951395
|| (c >= 'A' && c <= 'Z')
13961396
|| (c >= '0' && c <= '9')
13971397
|| c == '_'
1398-
|| (c > '\x7f' && c.is_XID_continue())
1398+
|| (c > '\x7f' && c.is_xid_continue())
13991399
}
14001400

14011401
#[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)