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

Method new

crates/ruff_python_parser/src/token_source.rs:23–28  ·  view source on GitHub ↗

Create a new token source for the given lexer.

(lexer: Lexer<'src>, source: &str, start_offset: TextSize)

Source from the content-addressed store, hash-verified

21impl<'src> TokenSource<'src> {
22 /// Create a new token source for the given lexer.
23 fn new(lexer: Lexer<'src>, source: &str, start_offset: TextSize) -> Self {
24 TokenSource {
25 lexer,
26 tokens: allocate_tokens_vec(&source[start_offset.to_usize()..]),
27 }
28 }
29
30 /// Create a new token source from the given source code which starts at the given offset.
31 pub(crate) fn from_source(source: &'src str, mode: Mode, start_offset: TextSize) -> Self {

Callers

nothing calls this directly

Calls 2

allocate_tokens_vecFunction · 0.85
to_usizeMethod · 0.80

Tested by

no test coverage detected