Skip to main content

Crate rustpython_ruff_python_trivia

Crate rustpython_ruff_python_trivia 

Source

Modules§

textwrap
Functions related to adding and removing indentation from lines of text.

Structs§

BackwardsTokenizer
Simple zero allocation backwards tokenizer for finding preceding tokens.
CommentRanges
Stores the ranges of comments sorted by TextRange::start in increasing order. No two ranges are overlapping.
Cursor
A Cursor over a string.
SimpleToken
SimpleTokenizer
Simple zero allocation tokenizer handling most tokens.

Enums§

CommentLinePosition
The position of a comment in the source text.
SimpleTokenKind
SuppressionKind

Constants§

EOF_CHAR

Traits§

PythonWhitespace

Functions§

find_only_token_in_range
Returns the only non-trivia, non-closing parenthesis token in range.
find_trailing_pragma_offset
Returns the byte offset within comment where a trailing pragma comment starts, or None if no pragma is found.
first_non_trivia_token
Searches for the first non-trivia character after offset.
has_leading_content
Return true if the node starting the given TextSize has leading content.
has_trailing_content
Return true if the node ending at the given TextSize has trailing content.
indentation_at_offset
Extract the leading indentation from a line.
is_pragma_comment
Returns true if a comment appears to be a pragma comment.
is_python_whitespace
Returns true for whitespace characters.
leading_indentation
Extract the leading indentation from a line.
lines_after
Counts the empty lines between offset and the first non-whitespace character.
lines_after_ignoring_end_of_line_trivia
Counts the empty lines after offset, ignoring any trailing trivia on the same line as offset.
lines_after_ignoring_trivia
Counts the empty lines after offset, ignoring any trailing trivia: end-of-line comments, own-line comments, and any intermediary newlines.
lines_before
Returns the number of newlines between offset and the first non whitespace character in the source code.