MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / parse_escape

Method parse_escape

claw-code/rust/crates/runtime/src/json.rs:200–214  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

198 }
199
200 fn parse_escape(&mut self) -> Result<char, JsonError> {
201 match self.next() {
202 Some('"') => Ok('"'),
203 Some('\\') => Ok('\\'),
204 Some('/') => Ok('/'),
205 Some('b') => Ok('\u{08}'),
206 Some('f') => Ok('\u{0C}'),
207 Some('n') => Ok('\n'),
208 Some('r') => Ok('\r'),
209 Some('t') => Ok('\t'),
210 Some('u') => self.parse_unicode_escape(),
211 Some(other) => Err(JsonError::new(format!("invalid escape sequence: {other}"))),
212 None => Err(JsonError::new("unexpected end of input in escape sequence")),
213 }
214 }
215
216 fn parse_unicode_escape(&mut self) -> Result<char, JsonError> {
217 let mut value = 0_u32;

Callers 1

parse_stringMethod · 0.80

Calls 2

nextMethod · 0.80
parse_unicode_escapeMethod · 0.80

Tested by

no test coverage detected