MCPcopy Index your code
hub / github.com/RustPython/RustPython / parse_text_inside_parentheses

Function parse_text_inside_parentheses

crates/common/src/cformat.rs:687–714  ·  view source on GitHub ↗
(iter: &mut ParseIter<I>)

Source from the content-addressed store, hash-verified

685}
686
687fn parse_text_inside_parentheses<T, I>(iter: &mut ParseIter<I>) -> Option<T>
688where
689 T: FormatBuf,
690 I: Iterator<Item = T::Char>,
691{
692 let mut counter: i32 = 1;
693 let mut contained_text = T::default();
694 loop {
695 let (_, c) = iter.next()?;
696 match c.to_char_lossy() {
697 '(' => {
698 counter += 1;
699 }
700 ')' => {
701 counter -= 1;
702 }
703 _ => (),
704 }
705
706 if counter > 0 {
707 contained_text.extend([c]);
708 } else {
709 break;
710 }
711 }
712
713 Some(contained_text)
714}
715
716#[derive(Debug, PartialEq)]
717pub enum CFormatPart<T> {

Callers 1

parse_spec_mapping_keyFunction · 0.85

Calls 4

SomeClass · 0.50
nextMethod · 0.45
to_char_lossyMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected