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

Function lex

crates/ruff_python_parser/src/lexer.rs:1605–1607  ·  view source on GitHub ↗

Create a new [`Lexer`] for the given source code and [`Mode`].

(source: &str, mode: Mode)

Source from the content-addressed store, hash-verified

1603
1604/// Create a new [`Lexer`] for the given source code and [`Mode`].
1605pub fn lex(source: &str, mode: Mode) -> Lexer<'_> {
1606 Lexer::new(source, mode, TextSize::default())
1607}
1608
1609#[cfg(test)]
1610mod tests {

Callers 6

benchmark_lexerFunction · 0.85
lex_validFunction · 0.85
lex_invalidFunction · 0.85
lex_fstring_errorFunction · 0.85
lex_tstring_errorFunction · 0.85

Calls 7

defaultFunction · 0.50
next_tokenMethod · 0.45
is_eofMethod · 0.45
pushMethod · 0.45
current_rangeMethod · 0.45
current_flagsMethod · 0.45
finishMethod · 0.45