MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / named_group

Method named_group

std/re/src/main/parser.rs:190–197  ·  view source on GitHub ↗

Assign the index before the body so order matches paren order. */

(&mut self, name: String)

Source from the content-addressed store, hash-verified

188
189 /* Assign the index before the body so order matches paren order. */
190 fn named_group(&mut self, name: String) -> Result<Node, ParseError> {
191 self.group_count += 1;
192 let index = self.group_count;
193 self.names.push((name.clone(), index));
194 let node = self.alternation()?;
195 self.expect(')')?;
196 Ok(Node::Group { index, name: Some(name), node: Box::new(node) })
197 }
198
199 fn named_backref(&mut self, name: &str) -> Result<Node, ParseError> {
200 let idx = self.names.iter().find(|(n, _)| n == name).map(|(_, i)| *i);

Callers 1

groupMethod · 0.80

Calls 3

pushMethod · 0.80
alternationMethod · 0.80
expectMethod · 0.45

Tested by

no test coverage detected