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

Method next_capture_index

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

Return the next capturing index. Each subsequent call increments the internal index. The span given should correspond to the location of the opening parenthesis. If the capture limit is exceeded, then an error is returned.

(&self, span: Span)

Source from the content-addressed store, hash-verified

425 ///
426 /// If the capture limit is exceeded, then an error is returned.
427 fn next_capture_index(&self, span: Span) -> Result<u32> {
428 let current = self.parser().capture_index.get();
429 let i = current.checked_add(1).ok_or_else(|| {
430 self.error(span, ast::ErrorKind::CaptureLimitExceeded)
431 })?;
432 self.parser().capture_index.set(i);
433 Ok(i)
434 }
435
436 /// Adds the given capture name to this parser. If this capture name has
437 /// already been used, then an error is returned.

Callers 1

parse_groupMethod · 0.80

Calls 3

parserMethod · 0.80
getMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected