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

Function next_non_dedent_info

crates/stdlib/src/_tokenize.rs:436–455  ·  view source on GitHub ↗

Find the next non-DEDENT token's position and source line. Returns ((line, col), line_str).

(
        tokens: &[Token],
        index: usize,
        source: &'a str,
        line_index: &LineIndex,
        default_pos: (usize, usize),
    )

Source from the content-addressed store, hash-verified

434 /// Find the next non-DEDENT token's position and source line.
435 /// Returns ((line, col), line_str).
436 fn next_non_dedent_info<'a>(
437 tokens: &[Token],
438 index: usize,
439 source: &'a str,
440 line_index: &LineIndex,
441 default_pos: (usize, usize),
442 ) -> ((usize, usize), &'a str) {
443 for future in &tokens[index..] {
444 match future.kind() {
445 TokenKind::Dedent => continue,
446 TokenKind::EndOfFile => return (default_pos, ""),
447 _ => {
448 let flc = line_index.line_column(future.range().start(), source);
449 let pos = (flc.line.get(), flc.column.to_zero_indexed());
450 return (pos, source.full_line_str(future.range().start()));
451 }
452 }
453 }
454 (default_pos, "")
455 }
456
457 /// Raise a SyntaxError with the given message and position.
458 fn raise_syntax_error(

Callers 1

emit_next_tokenFunction · 0.85

Calls 3

kindMethod · 0.45
startMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected