mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Apply NFKC normalization to unicode identifiers in the lexer (#10412)
This commit is contained in:
parent
bb540718c2
commit
92e6026446
9 changed files with 68 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
use ruff_formatter::{write, FormatContext};
|
||||
use ruff_formatter::write;
|
||||
use ruff_python_ast::AnyNodeRef;
|
||||
use ruff_python_ast::ExprName;
|
||||
|
||||
|
@ -11,16 +11,11 @@ pub struct FormatExprName;
|
|||
|
||||
impl FormatNodeRule<ExprName> for FormatExprName {
|
||||
fn fmt_fields(&self, item: &ExprName, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
let ExprName { id, range, ctx: _ } = item;
|
||||
|
||||
debug_assert_eq!(
|
||||
id.as_str(),
|
||||
f.context()
|
||||
.source_code()
|
||||
.slice(*range)
|
||||
.text(f.context().source_code())
|
||||
);
|
||||
|
||||
let ExprName {
|
||||
id: _,
|
||||
range,
|
||||
ctx: _,
|
||||
} = item;
|
||||
write!(f, [source_text_slice(*range)])
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue