`s.replace(/\s+/g, ' ').trim()` with JavaScript's `\s` class, so a receiver qualifier is byte-identical to the one TreeSitterExtractor emits. Rust's `char::is_whitespace` is NOT the same set: it counts U+0085 (NEL), which JS `\s` does not, and omits U+FEFF (ZWNBSP), which JS `\s` includes.
(s: &str)
| 1112 | /// `char::is_whitespace` is NOT the same set: it counts U+0085 (NEL), which JS |
| 1113 | /// `\s` does not, and omits U+FEFF (ZWNBSP), which JS `\s` includes. |
| 1114 | fn collapse_js_whitespace(s: &str) -> String { |
| 1115 | fn is_js_space(c: char) -> bool { |
| 1116 | matches!( |
| 1117 | c, |
| 1118 | '\t' | '\n' | '\u{b}' | '\u{c}' | '\r' | ' ' | '\u{a0}' | '\u{feff}' |
| 1119 | | '\u{2028}' | '\u{2029}' |
| 1120 | | '\u{1680}' | '\u{2000}'..='\u{200a}' | '\u{202f}' | '\u{205f}' | '\u{3000}' |
| 1121 | ) |
| 1122 | } |
| 1123 | let mut out = String::with_capacity(s.len()); |
| 1124 | let mut in_space = false; |
| 1125 | for c in s.chars() { |
| 1126 | if is_js_space(c) { |
| 1127 | in_space = true; |
| 1128 | } else { |
| 1129 | if in_space && !out.is_empty() { |
| 1130 | out.push(' '); |
| 1131 | } |
| 1132 | in_space = false; |
| 1133 | out.push(c); |
| 1134 | } |
| 1135 | } |
| 1136 | out |
| 1137 | } |
| 1138 | |
| 1139 | /// LITERAL_RECEIVER_TYPES membership (shared table; python names among them). |
| 1140 | fn is_literal_receiver(kind: &str) -> bool { |
no test coverage detected