Like peek, but will ignore spaces when the parser is in whitespace insensitive mode.
(&self)
| 590 | /// Like peek, but will ignore spaces when the parser is in whitespace |
| 591 | /// insensitive mode. |
| 592 | fn peek_space(&self) -> Option<char> { |
| 593 | if !self.ignore_whitespace() { |
| 594 | return self.peek(); |
| 595 | } |
| 596 | if self.is_eof() { |
| 597 | return None; |
| 598 | } |
| 599 | let mut start = self.offset() + self.char().len_utf8(); |
| 600 | let mut in_comment = false; |
| 601 | for (i, c) in self.pattern()[start..].char_indices() { |
| 602 | if c.is_whitespace() { |
| 603 | continue; |
| 604 | } else if !in_comment && c == '#' { |
| 605 | in_comment = true; |
| 606 | } else if in_comment && c == '\n' { |
| 607 | in_comment = false; |
| 608 | } else { |
| 609 | start += i; |
| 610 | break; |
| 611 | } |
| 612 | } |
| 613 | self.pattern()[start..].chars().next() |
| 614 | } |
| 615 | |
| 616 | /// Returns true if the next call to `bump` would return false. |
| 617 | fn is_eof(&self) -> bool { |
no test coverage detected