(&mut self, c: u8, msg: &'static str)
| 112 | } |
| 113 | |
| 114 | fn expect(&mut self, c: u8, msg: &'static str) -> Result<(), String> { |
| 115 | if self.peek() == Some(c) { self.pos += 1; Ok(()) } else { Err(s!(str msg)) } |
| 116 | } |
| 117 | |
| 118 | fn read_string(&mut self) -> Result<String, String> { |
| 119 | self.expect(b'"', "expected '\"' starting a string")?; |