Parse a string until the next '"' character.
(&mut self)
| 160 | |
| 161 | // Parse a string until the next '"' character. |
| 162 | pub fn parse_string(&mut self) -> Result<&'de str> { |
| 163 | if self.next_char()? != '"' { |
| 164 | return Err(eyre::eyre!("expect a string: {}.", self.input)); |
| 165 | } |
| 166 | match self.input.find('"') { |
| 167 | Some(len) => { |
| 168 | let s = &self.input[..len]; |
| 169 | self.input = &self.input[len + 1..]; |
| 170 | Ok(s) |
| 171 | } |
| 172 | None => Err(eyre::eyre!("parsing until end of input: {}", self.input)), |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | pub fn parse_number<T: FromStr>(&mut self) -> eyre::Result<T> { |
| 177 | let mut len = 0; |