MCPcopy Create free account
hub / github.com/astral-sh/ruff / lex_valid

Function lex_valid

crates/ruff_python_parser/src/lexer.rs:1661–1674  ·  view source on GitHub ↗
(source: &str, mode: Mode, start_offset: TextSize)

Source from the content-addressed store, hash-verified

1659
1660 #[track_caller]
1661 fn lex_valid(source: &str, mode: Mode, start_offset: TextSize) -> LexerOutput {
1662 let output = lex(source, mode, start_offset);
1663
1664 if !output.errors.is_empty() {
1665 let mut message = "Unexpected lexical errors for a valid source:\n".to_string();
1666 for error in &output.errors {
1667 writeln!(&mut message, "{error:?}").unwrap();
1668 }
1669 writeln!(&mut message, "Source:\n{source}").unwrap();
1670 panic!("{message}");
1671 }
1672
1673 output
1674 }
1675
1676 #[track_caller]
1677 fn lex_invalid(source: &str, mode: Mode) -> LexerOutput {

Callers 3

lex_sourceFunction · 0.85
lex_source_with_offsetFunction · 0.85
lex_jupyter_sourceFunction · 0.85

Calls 3

lexFunction · 0.85
is_emptyMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected