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

Method bump_space

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

If the `x` flag is enabled (i.e., whitespace insensitivity with comments), then this will advance the parser through all whitespace and comments to the next non-whitespace non-comment byte. If the `x` flag is disabled, then this is a no-op. This should be used selectively throughout the parser where arbitrary whitespace is permitted when the `x` flag is enabled. For example, `{ 5 , 6}` is equ

(&self)

Source from the content-addressed store, hash-verified

548 /// arbitrary whitespace is permitted when the `x` flag is enabled. For
549 /// example, `{ 5 , 6}` is equivalent to `{5,6}`.
550 fn bump_space(&self) {
551 if !self.ignore_whitespace() {
552 return;
553 }
554 while !self.is_eof() {
555 if self.char().is_whitespace() {
556 self.bump();
557 } else if self.char() == '#' {
558 let start = self.pos();
559 let mut comment_text = String::new();
560 self.bump();
561 while !self.is_eof() {
562 let c = self.char();
563 self.bump();
564 if c == '\n' {
565 break;
566 }
567 comment_text.push(c);
568 }
569 let comment = ast::Comment {
570 span: Span::new(start, self.pos()),
571 comment: comment_text,
572 };
573 self.parser().comments.borrow_mut().push(comment);
574 } else {
575 break;
576 }
577 }
578 }
579
580 /// Peek at the next character in the input without advancing the parser.
581 ///

Callers 5

bump_and_bump_spaceMethod · 0.80
parse_with_commentsMethod · 0.80
parse_groupMethod · 0.80
parse_set_classMethod · 0.80
parse_set_class_rangeMethod · 0.80

Calls 7

bumpMethod · 0.80
parserMethod · 0.80
ignore_whitespaceMethod · 0.45
is_eofMethod · 0.45
charMethod · 0.45
posMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected