mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-02 01:43:04 +00:00
Use the existing ruff_python_trivia::is_python_whitespace
function (#11844)
## Summary This PR re-uses the `ruff_python_trivia::is_python_whitespace` in the lexer instead of defining its own. This was mainly to avoid circular dependency which was resolved in #11261.
This commit is contained in:
parent
5c0df7a150
commit
db8f2c2d9f
1 changed files with 1 additions and 14 deletions
|
@ -18,6 +18,7 @@ use ruff_python_ast::str_prefix::{
|
|||
AnyStringPrefix, ByteStringPrefix, FStringPrefix, StringLiteralPrefix,
|
||||
};
|
||||
use ruff_python_ast::{AnyStringFlags, Int, IpyEscapeKind, StringFlags};
|
||||
use ruff_python_trivia::is_python_whitespace;
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::error::FStringErrorType;
|
||||
|
@ -1807,20 +1808,6 @@ fn is_identifier_continuation(c: char, identifier_is_ascii_only: &mut bool) -> b
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns `true` for [whitespace](https://docs.python.org/3/reference/lexical_analysis.html#whitespace-between-tokens)
|
||||
/// characters.
|
||||
///
|
||||
/// This is the same as `ruff_python_trivia::is_python_whitespace` and is copied
|
||||
/// here to avoid a circular dependency as `ruff_python_trivia` has a dev-dependency
|
||||
/// on `ruff_python_lexer`.
|
||||
const fn is_python_whitespace(c: char) -> bool {
|
||||
matches!(
|
||||
c,
|
||||
// Space, tab, or form-feed
|
||||
' ' | '\t' | '\x0C'
|
||||
)
|
||||
}
|
||||
|
||||
enum LexedText<'a> {
|
||||
Source { source: &'a str, range: TextRange },
|
||||
Owned(String),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue