Consumes the remainder of the line and returns the token that was encountered at the end (which may be EOF or end of line).
(&mut self)
| 636 | /// Consumes the remainder of the line and returns the token that was encountered at the end |
| 637 | /// (which may be EOF or end of line). |
| 638 | fn consume_rest_of_line(&mut self) -> io::Result<TokenSpan> { |
| 639 | loop { |
| 640 | match self.input.next() { |
| 641 | None => { |
| 642 | let last_pos = self.input.next_pos(); |
| 643 | return Ok(TokenSpan::new(Token::Eof, last_pos, 0)); |
| 644 | } |
| 645 | Some(Ok(ch_span)) if ch_span.ch == '\n' => { |
| 646 | return Ok(TokenSpan::new(Token::Eol, ch_span.pos, 1)); |
| 647 | } |
| 648 | Some(Err(e)) => return Err(e), |
| 649 | Some(Ok(_)) => (), |
| 650 | } |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | /// Skips whitespace until it finds the beginning of the next token, and returns its first |
| 655 | /// character. |
no test coverage detected