MCPcopy Create free account
hub / github.com/davidblewett/rure-python / peek_space

Method peek_space

regex/regex-syntax/src/ast/parse.rs:592–614  ·  view source on GitHub ↗

Like peek, but will ignore spaces when the parser is in whitespace insensitive mode.

(&self)

Source from the content-addressed store, hash-verified

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 {

Callers 1

parse_set_class_rangeMethod · 0.80

Calls 8

peekMethod · 0.80
offsetMethod · 0.80
len_utf8Method · 0.80
ignore_whitespaceMethod · 0.45
is_eofMethod · 0.45
charMethod · 0.45
patternMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected