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

Method drain_annotation

compiler/src/modules/parser/literals.rs:619–640  ·  view source on GitHub ↗

Drains annotation via `advance_raw` (keeps bracket_stack clean); breaks on Rarrow to avoid infinite drain. */

(&mut self)

Source from the content-addressed store, hash-verified

617
618 /* Drains annotation via `advance_raw` (keeps bracket_stack clean); breaks on Rarrow to avoid infinite drain. */
619 pub(super) fn drain_annotation(&mut self) {
620 if self.eat_if(TokenType::Colon) {
621 let mut depth = 0u32;
622 loop {
623 match self.peek() {
624 None => break,
625 Some(TokenType::Rarrow) => break,
626 Some(TokenType::Lsqb | TokenType::Lpar | TokenType::Lbrace) => {
627 depth += 1;
628 self.advance_raw();
629 }
630 Some(TokenType::Rsqb | TokenType::Rpar | TokenType::Rbrace) => {
631 if depth == 0 { break; }
632 depth -= 1;
633 self.advance_raw();
634 }
635 Some(TokenType::Equal | TokenType::Comma) if depth == 0 => break,
636 _ => { self.advance_raw(); }
637 }
638 }
639 }
640 }
641
642 pub(super) fn compile_body(&mut self, params: &[String]) -> SSAChunk {
643 let mut body = self.with_fresh_chunk(|s| {

Callers 1

parse_paramsMethod · 0.80

Calls 3

eat_ifMethod · 0.80
advance_rawMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected