`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)
| 1153 | /// `char::is_whitespace` is NOT the same set: it counts U+0085 (NEL), which JS |
| 1154 | /// `\s` does not, and omits U+FEFF (ZWNBSP), which JS `\s` includes. |
| 1155 | fn collapse_js_whitespace(s: &str) -> String { |
| 1156 | fn is_js_space(c: char) -> bool { |
| 1157 | matches!( |
| 1158 | c, |
| 1159 | '\t' | '\n' | '\u{b}' | '\u{c}' | '\r' | ' ' | '\u{a0}' | '\u{feff}' |
| 1160 | | '\u{2028}' | '\u{2029}' |
| 1161 | | '\u{1680}' | '\u{2000}'..='\u{200a}' | '\u{202f}' | '\u{205f}' | '\u{3000}' |
| 1162 | ) |
| 1163 | } |
| 1164 | let mut out = String::with_capacity(s.len()); |
| 1165 | let mut in_space = false; |
| 1166 | for c in s.chars() { |
| 1167 | if is_js_space(c) { |
| 1168 | in_space = true; |
| 1169 | } else { |
| 1170 | if in_space && !out.is_empty() { |
| 1171 | out.push(' '); |
| 1172 | } |
| 1173 | in_space = false; |
| 1174 | out.push(c); |
| 1175 | } |
| 1176 | } |
| 1177 | out |
| 1178 | } |
| 1179 | |
| 1180 | /// LITERAL_RECEIVER_TYPES membership (shared table; python names among them). |
| 1181 | fn is_literal_receiver(kind: &str) -> bool { |
no test coverage detected