From f765d194028ef0ebd01ef0a21e30732d4d5ff184 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sun, 30 Jun 2024 17:53:25 +0200 Subject: [PATCH] Mention that `Cursor` is based on rustc's implementation. (#12109) --- crates/ruff_python_parser/src/lexer/cursor.rs | 2 ++ crates/ruff_python_trivia/src/cursor.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/crates/ruff_python_parser/src/lexer/cursor.rs b/crates/ruff_python_parser/src/lexer/cursor.rs index e7cd633920aa58..d1107f18ef2b13 100644 --- a/crates/ruff_python_parser/src/lexer/cursor.rs +++ b/crates/ruff_python_parser/src/lexer/cursor.rs @@ -5,6 +5,8 @@ use ruff_text_size::{TextLen, TextSize}; pub(crate) const EOF_CHAR: char = '\0'; /// A cursor represents a pointer in the source code. +/// +/// Based on [`rustc`'s `Cursor`](https://github.com/rust-lang/rust/blob/d1b7355d3d7b4ead564dbecb1d240fcc74fff21b/compiler/rustc_lexer/src/cursor.rs) #[derive(Clone, Debug)] pub(super) struct Cursor<'src> { /// An iterator over the [`char`]'s of the source code. diff --git a/crates/ruff_python_trivia/src/cursor.rs b/crates/ruff_python_trivia/src/cursor.rs index e046fa92ba4b8f..5c2e218ff56095 100644 --- a/crates/ruff_python_trivia/src/cursor.rs +++ b/crates/ruff_python_trivia/src/cursor.rs @@ -5,6 +5,8 @@ use ruff_text_size::{TextLen, TextSize}; pub const EOF_CHAR: char = '\0'; /// A [`Cursor`] over a string. +/// +/// Based on [`rustc`'s `Cursor`](https://github.com/rust-lang/rust/blob/d1b7355d3d7b4ead564dbecb1d240fcc74fff21b/compiler/rustc_lexer/src/cursor.rs) #[derive(Debug, Clone)] pub struct Cursor<'a> { chars: Chars<'a>,