(&mut self)
| 185 | } |
| 186 | |
| 187 | fn parse_string(&mut self) -> Result<String, JsonError> { |
| 188 | self.expect('"')?; |
| 189 | let mut value = String::new(); |
| 190 | while let Some(ch) = self.next() { |
| 191 | match ch { |
| 192 | '"' => return Ok(value), |
| 193 | '\\' => value.push(self.parse_escape()?), |
| 194 | plain => value.push(plain), |
| 195 | } |
| 196 | } |
| 197 | Err(JsonError::new("unterminated string")) |
| 198 | } |
| 199 | |
| 200 | fn parse_escape(&mut self) -> Result<char, JsonError> { |
| 201 | match self.next() { |
no test coverage detected