| 261 | } |
| 262 | |
| 263 | fn lex_string(buf: &mut LexBuf) -> Result<String, LexerError> { |
| 264 | let mut s = String::new(); |
| 265 | loop { |
| 266 | let pos = buf.pos() - 1; |
| 267 | loop { |
| 268 | match buf.next() { |
| 269 | Some('\'') if buf.consume('\'') => s.push('\''), |
| 270 | Some('\'') => break, |
| 271 | Some(c) => s.push(c), |
| 272 | None => bail!(pos, "unterminated quoted string"), |
| 273 | } |
| 274 | } |
| 275 | if !lex_to_adjacent_string(buf) { |
| 276 | return Ok(s); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | fn lex_extended_string(buf: &mut LexBuf) -> Result<Token, LexerError> { |
| 282 | fn lex_unicode_escape(buf: &mut LexBuf, n: usize) -> Result<char, LexerError> { |