mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Pull in RustPython parser (#6099)
This commit is contained in:
parent
86539c1fc5
commit
40f54375cb
779 changed files with 108400 additions and 2078 deletions
|
@ -1,3 +1,5 @@
|
|||
use ruff_text_size::{TextRange, TextSize};
|
||||
|
||||
pub mod all;
|
||||
pub mod call_path;
|
||||
pub mod cast;
|
||||
|
@ -9,6 +11,7 @@ pub mod helpers;
|
|||
pub mod identifier;
|
||||
pub mod imports;
|
||||
pub mod node;
|
||||
mod nodes;
|
||||
pub mod relocate;
|
||||
pub mod statement_visitor;
|
||||
pub mod stmt_if;
|
||||
|
@ -17,3 +20,32 @@ pub mod traversal;
|
|||
pub mod types;
|
||||
pub mod visitor;
|
||||
pub mod whitespace;
|
||||
|
||||
pub use nodes::*;
|
||||
|
||||
pub trait Ranged {
|
||||
fn range(&self) -> TextRange;
|
||||
|
||||
fn start(&self) -> TextSize {
|
||||
self.range().start()
|
||||
}
|
||||
|
||||
fn end(&self) -> TextSize {
|
||||
self.range().end()
|
||||
}
|
||||
}
|
||||
|
||||
impl Ranged for TextRange {
|
||||
fn range(&self) -> TextRange {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Ranged for &T
|
||||
where
|
||||
T: Ranged,
|
||||
{
|
||||
fn range(&self) -> TextRange {
|
||||
T::range(self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue