Skip to content

Commit

Permalink
Mention that Cursor is based on rustc's implementation. (#12109)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Jun 30, 2024
1 parent d107968 commit f765d19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/ruff_python_parser/src/lexer/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions crates/ruff_python_trivia/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down

0 comments on commit f765d19

Please sign in to comment.