MCPcopy Index your code
hub / github.com/RustPython/RustPython / parse_unicode_literal

Method parse_unicode_literal

crates/codegen/src/string_parser.rs:71–83  ·  view source on GitHub ↗
(&mut self, literal_number: usize)

Source from the content-addressed store, hash-verified

69 }
70
71 fn parse_unicode_literal(&mut self, literal_number: usize) -> Result<CodePoint, LexicalError> {
72 let mut p: u32 = 0u32;
73 for i in 1..=literal_number {
74 match self.next_char() {
75 Some(c) => match c.to_digit(16) {
76 Some(d) => p += d << ((literal_number - i) * 4),
77 None => unreachable!(),
78 },
79 None => unreachable!(),
80 }
81 }
82 Ok(CodePoint::from_u32(p).unwrap())
83 }
84
85 fn parse_octet(&mut self, o: u8) -> char {
86 let mut radix_bytes = [o, 0, 0];

Callers 1

parse_escaped_charMethod · 0.80

Calls 2

next_charMethod · 0.80
unwrapMethod · 0.45

Tested by

no test coverage detected