]> git.lizzy.rs Git - rust.git/commitdiff
unicode: Rename is_XID_start to is_xid_start, is_XID_continue to is_xid_continue
authorBrian Anderson <banderson@mozilla.com>
Mon, 3 Nov 2014 23:18:45 +0000 (15:18 -0800)
committerBrian Anderson <banderson@mozilla.com>
Fri, 21 Nov 2014 21:18:08 +0000 (13:18 -0800)
src/libfmt_macros/lib.rs
src/librustc_trans/back/link.rs
src/librustdoc/test.rs
src/libsyntax/parse/lexer/mod.rs
src/libunicode/u_char.rs

index ed86ad52bb5d4d8089df5fc6fa432db276bd5d41..d3bee557220bf77d60c2f6d60dd76be5a39295b9 100644 (file)
@@ -383,7 +383,7 @@ fn count(&mut self) -> Count<'a> {
     /// characters.
     fn word(&mut self) -> &'a str {
         let start = match self.cur.clone().next() {
-            Some((pos, c)) if c.is_XID_start() => {
+            Some((pos, c)) if c.is_xid_start() => {
                 self.cur.next();
                 pos
             }
@@ -392,7 +392,7 @@ fn word(&mut self) -> &'a str {
         let mut end;
         loop {
             match self.cur.clone().next() {
-                Some((_, c)) if c.is_XID_continue() => {
+                Some((_, c)) if c.is_xid_continue() => {
                     self.cur.next();
                 }
                 Some((pos, _)) => { end = pos; break }
index db9ebac163c737a85a86cf9a940942e6bfc72c0d..3715256e3ec2be857107118321f4be110a725a99 100644 (file)
@@ -271,7 +271,7 @@ pub fn sanitize(s: &str) -> String {
     // Underscore-qualify anything that didn't start as an ident.
     if result.len() > 0u &&
         result.as_bytes()[0] != '_' as u8 &&
-        ! (result.as_bytes()[0] as char).is_XID_start() {
+        ! (result.as_bytes()[0] as char).is_xid_start() {
         return format!("_{}", result.as_slice());
     }
 
index 63007cf15c651da3e9363edfac647f536ab53820..2a5972bb3d90b11d0fc6711ccda4d409f9805b85 100644 (file)
@@ -299,8 +299,8 @@ pub fn register_header(&mut self, name: &str, level: u32) {
             // we use these headings as test names, so it's good if
             // they're valid identifiers.
             let name = name.chars().enumerate().map(|(i, c)| {
-                    if (i == 0 && c.is_XID_start()) ||
-                        (i != 0 && c.is_XID_continue()) {
+                    if (i == 0 && c.is_xid_start()) ||
+                        (i != 0 && c.is_xid_continue()) {
                         c
                     } else {
                         '_'
index 9b3e25c5851c9a10f94dfc59025312d2782dd65d..a88029e087b155959b9e24bc405719595c09b671 100644 (file)
@@ -692,7 +692,7 @@ fn scan_number(&mut self, c: char) -> token::Lit {
         // integer literal followed by field/method access or a range pattern
         // (`0..2` and `12.foo()`)
         if self.curr_is('.') && !self.nextch_is('.') && !self.nextch().unwrap_or('\0')
-                                                             .is_XID_start() {
+                                                             .is_xid_start() {
             // might have stuff after the ., and if it does, it needs to start
             // with a number
             self.bump();
@@ -1385,7 +1385,7 @@ fn ident_start(c: Option<char>) -> bool {
     (c >= 'a' && c <= 'z')
         || (c >= 'A' && c <= 'Z')
         || c == '_'
-        || (c > '\x7f' && c.is_XID_start())
+        || (c > '\x7f' && c.is_xid_start())
 }
 
 fn ident_continue(c: Option<char>) -> bool {
@@ -1395,7 +1395,7 @@ fn ident_continue(c: Option<char>) -> bool {
         || (c >= 'A' && c <= 'Z')
         || (c >= '0' && c <= '9')
         || c == '_'
-        || (c > '\x7f' && c.is_XID_continue())
+        || (c > '\x7f' && c.is_xid_continue())
 }
 
 #[cfg(test)]
index f347ab6a21e22098ffe30e017965e9de7d02d144..1c4c4d4c4be4d527bd836444825fe00810766da6 100644 (file)
@@ -167,8 +167,18 @@ pub trait UnicodeChar {
     /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
     /// mostly similar to ID_Start but modified for closure under NFKx.
     #[allow(non_snake_case)]
+    #[deprecated = "use is_xid_start"]
     fn is_XID_start(self) -> bool;
 
+    /// Returns whether the specified character satisfies the 'XID_Start'
+    /// Unicode property.
+    ///
+    /// 'XID_Start' is a Unicode Derived Property specified in
+    /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+    /// mostly similar to ID_Start but modified for closure under NFKx.
+    #[allow(non_snake_case)]
+    fn is_xid_start(self) -> bool;
+
     /// Returns whether the specified `char` satisfies the 'XID_Continue'
     /// Unicode property.
     ///
@@ -176,8 +186,17 @@ pub trait UnicodeChar {
     /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
     /// mostly similar to 'ID_Continue' but modified for closure under NFKx.
     #[allow(non_snake_case)]
+    #[deprecated = "use is_xid_continue"]
     fn is_XID_continue(self) -> bool;
 
+    /// Returns whether the specified `char` satisfies the 'XID_Continue'
+    /// Unicode property.
+    ///
+    /// 'XID_Continue' is a Unicode Derived Property specified in
+    /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+    /// mostly similar to 'ID_Continue' but modified for closure under NFKx.
+    #[allow(non_snake_case)]
+    fn is_xid_continue(self) -> bool;
 
     /// Indicates whether a character is in lowercase.
     ///
@@ -267,10 +286,16 @@ fn is_alphabetic(self) -> bool {
         }
     }
 
+    #[deprecated = "use is_xid_start"]
     fn is_XID_start(self) -> bool { derived_property::XID_Start(self) }
 
+    #[deprecated = "use is_xid_continue"]
     fn is_XID_continue(self) -> bool { derived_property::XID_Continue(self) }
 
+    fn is_xid_start(self) -> bool { derived_property::XID_Start(self) }
+
+    fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) }
+
     fn is_lowercase(self) -> bool {
         match self {
             'a' ... 'z' => true,