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

Method close_brace

compiler/src/modules/lexer/scan.rs:324–342  ·  view source on GitHub ↗

Routes `}` to f-string body resume or plain Rbrace based on nesting depth. */

(&mut self, start: usize)

Source from the content-addressed store, hash-verified

322
323 /* Routes `}` to f-string body resume or plain Rbrace based on nesting depth. */
324 fn close_brace(&mut self, start: usize) {
325 let end = start + 1;
326 if let Some(&(_, _, _, saved_nesting)) = self.fstring_stack.last() {
327 if self.nesting > saved_nesting {
328 self.nesting -= 1;
329 } else {
330 let (quote, triple, _, _) = self.fstring_stack.pop().unwrap();
331 self.pos = end;
332 self.scan_fstring_body(quote, triple, end);
333 self.pending.push((TokenType::Rbrace, self.line, start, end));
334 // `pos` already advanced by scan_fstring_body.
335 return;
336 }
337 } else {
338 self.nesting = self.nesting.saturating_sub(1);
339 }
340 self.pending.push((TokenType::Rbrace, self.line, start, end));
341 self.pos = end;
342 }
343
344 /* Main dispatch: drains pending queue, then routes each byte via BYTE_CLASS / SINGLE_TOK lookups. */
345 pub fn next_token(&mut self) -> Option<(TokenType, usize, usize, usize)> {

Callers 1

next_tokenMethod · 0.80

Calls 3

scan_fstring_bodyMethod · 0.80
pushMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected