Skip to content

Commit e968d83

Browse files
Copilotyouknowone
andauthored
Tidy shared unicode review feedback
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/e4115dbc-b1a5-4a77-90a7-38cf9ac1cdf2 Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
1 parent 67485b5 commit e968d83

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

crates/sre_engine/src/string.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,8 @@ pub(crate) fn is_digit(ch: u32) -> bool {
345345
rustpython_unicode::regex::is_digit(ch)
346346
}
347347
#[inline]
348-
pub(crate) fn is_loc_alnum(ch: u32) -> bool {
349-
// FIXME: Ignore the locales
350-
rustpython_unicode::regex::is_locale_alnum(ch)
351-
}
352-
#[inline]
353348
pub(crate) fn is_loc_word(ch: u32) -> bool {
354-
ch == '_' as u32 || is_loc_alnum(ch)
349+
rustpython_unicode::regex::is_locale_word(ch)
355350
}
356351
#[inline]
357352
pub(crate) const fn is_linebreak(ch: u32) -> bool {
@@ -384,12 +379,8 @@ pub(crate) const fn is_uni_linebreak(ch: u32) -> bool {
384379
rustpython_unicode::regex::is_unicode_linebreak(ch)
385380
}
386381
#[inline]
387-
pub(crate) fn is_uni_alnum(ch: u32) -> bool {
388-
rustpython_unicode::regex::is_unicode_alnum(ch)
389-
}
390-
#[inline]
391382
pub(crate) fn is_uni_word(ch: u32) -> bool {
392-
ch == '_' as u32 || is_uni_alnum(ch)
383+
rustpython_unicode::regex::is_unicode_word(ch)
393384
}
394385
#[inline]
395386
pub fn lower_unicode(ch: u32) -> u32 {

crates/unicode/src/classify.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ pub fn is_space(cp: u32) -> bool {
4646
})
4747
}
4848

49+
/// Python's `str.isprintable()` semantics, which treat ASCII space as printable.
4950
pub fn is_printable(cp: u32) -> bool {
5051
cp == '\u{0020}' as u32 || is_repr_printable(cp)
5152
}
5253

54+
/// Repr/escape printable semantics, which exclude all Unicode space separators.
5355
pub fn is_repr_printable(cp: u32) -> bool {
5456
!matches!(
5557
general_category(cp),

0 commit comments

Comments
 (0)