Skip to content

Commit

Permalink
Use Grapheme_Extend instead of Mn
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed May 21, 2018
1 parent d3c257b commit d7aa35e
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 174 deletions.
16 changes: 8 additions & 8 deletions src/libcore/char/methods.rs
Expand Up @@ -229,6 +229,9 @@ impl char {
'\r' => EscapeDefaultState::Backslash('r'),
'\n' => EscapeDefaultState::Backslash('n'),
'\\' | '\'' | '"' => EscapeDefaultState::Backslash(self),
_ if self.is_grapheme_extended() => {
EscapeDefaultState::Unicode(self.escape_unicode())
}
_ if is_printable(self) => EscapeDefaultState::Char(self),
_ => EscapeDefaultState::Unicode(self.escape_unicode()),
};
Expand Down Expand Up @@ -692,16 +695,13 @@ impl char {
general_category::Cc(self)
}

/// Returns true if this `char` is a nonspacing mark code point, and false otherwise.
/// Returns true if this `char` is an extended grapheme character, and false otherwise.
///
/// 'Nonspacing mark code point' is defined in terms of the Unicode General
/// Category `Mn`.
#[unstable(feature = "rustc_private",
reason = "mainly needed for compiler internals",
issue = "27812")]
/// 'Extended grapheme character' is defined in terms of the Unicode Shaping and Rendering
/// Category `Grapheme_Extend`.
#[inline]
pub fn is_nonspacing_mark(self) -> bool {
general_category::Mn(self)
pub(crate) fn is_grapheme_extended(self) -> bool {
derived_property::Grapheme_Extend(self)
}

/// Returns true if this `char` is numeric, and false otherwise.
Expand Down

0 comments on commit d7aa35e

Please sign in to comment.