Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cortex/blob/main/tests/json/gen/ugen_main.rs # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / tests / json / gen / ugen_main.rs` 32 lines · 1601 bytes Raw Blame History 1 // Black-box Unicode table generator: queries rustc's std (str::to_lowercase, char::is_whitespace). 2 // Output lines: L [ ...] (lower(c) != c, single-char context) 3 // K class C (cased, not case-ignorable) / I (case-ignorable) 4 // W char::is_whitespace 5 // D writes \u{hex} for this char 6 fn lw(s: &str) -> String { s.to_lowercase() } 7 fn main() { 8 let sig = 'Σ'; 9 for u in 0u32..=0x10FFFF { 10 let c = match char::from_u32(u) { Some(c) => c, None => continue }; 11 let mut one = String::new(); one.push(c); 12 let lo = lw(&one); 13 if lo != one { 14 let mut line = format!("L {}", u); 15 for d in lo.chars() { line.push_str(&format!(" {}", d as u32)); } 16 println!("{}", line); 17 } 18 if c.is_whitespace() { println!("W {}", u); } 19 let dbg = format!("{:?}", one); 20 let plain = format!("\"{}\"", c); 21 if !matches!(c, '\0' | '\t' | '\r' | '\n' | '\\' | '"') && dbg != plain { 22 assert_eq!(dbg, format!("\"\\u{{{:x}}}\"", u), "cp {}", u); 23 println!("D {}", u); 24 } 25 if c == sig { println!("K {} C", u); continue; } 26 let x1 = lw(&format!("{}{}", c, sig)).ends_with('ς'); 27 let x2 = lw(&format!("A{}{}", c, sig)).ends_with('ς'); 28 let y = lw(&format!("A{}{}", sig, c)).starts_with("aς"); 29 assert_eq!(y, !x1, "cp {}", u); 30 if x1 { println!("K {} C", u); } else if x2 { println!("K {} I", u); } 31 } 32 }