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

Function lex_valid

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

Source from the content-addressed store, hash-verified

1674
1675 #[track_caller]
1676 fn lex_valid(source: &str, mode: Mode, start_offset: TextSize) -> LexerOutput {
1677 let output = lex(source, mode, start_offset);
1678
1679 if !output.errors.is_empty() {
1680 let mut message = "Unexpected lexical errors for a valid source:\n".to_string();
1681 for error in &output.errors {
1682 writeln!(&mut message, "{error:?}").unwrap();
1683 }
1684 writeln!(&mut message, "Source:\n{source}").unwrap();
1685 panic!("{message}");
1686 }
1687
1688 output
1689 }
1690
1691 #[track_caller]
1692 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