Pull in RustPython parser (#6099)

This commit is contained in:
Micha Reiser 2023-07-27 11:29:11 +02:00 committed by GitHub
parent 86539c1fc5
commit 40f54375cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
779 changed files with 108400 additions and 2078 deletions

View file

@ -14,11 +14,13 @@ license = { workspace = true }
[dependencies]
ruff_python_trivia = { path = "../ruff_python_trivia" }
rustpython-parser = { workspace = true }
ruff_text_size = { workspace = true }
ruff_python_ast = { path = "../ruff_python_ast" }
ruff_python_parser = { path = "../ruff_python_parser" }
ruff_source_file = { path = "../ruff_source_file" }
ruff_text_size = { path = "../ruff_text_size" }
itertools = { workspace = true }
rustpython-ast = { workspace = true }
[dev-dependencies]

View file

@ -2,8 +2,8 @@ use itertools::Itertools;
use std::fmt::{Debug, Formatter};
use std::ops::Deref;
use ruff_python_parser::Tok;
use ruff_text_size::TextRange;
use rustpython_parser::Tok;
/// Stores the ranges of comments sorted by [`TextRange::start`] in increasing order. No two ranges are overlapping.
#[derive(Clone)]

View file

@ -1,11 +1,11 @@
//! Struct used to index source code, to enable efficient lookup of tokens that
//! are omitted from the AST (e.g., commented lines).
use ruff_python_ast::{Ranged, Stmt};
use ruff_python_parser::lexer::LexResult;
use ruff_python_parser::{StringKind, Tok};
use ruff_python_trivia::{has_leading_content, has_trailing_content, is_python_whitespace};
use ruff_text_size::{TextRange, TextSize};
use rustpython_ast::{Ranged, Stmt};
use rustpython_parser::lexer::LexResult;
use rustpython_parser::{StringKind, Tok};
use super::comment_ranges::{CommentRanges, CommentRangesBuilder};
use ruff_source_file::Locator;
@ -264,9 +264,9 @@ impl Indexer {
#[cfg(test)]
mod tests {
use ruff_python_parser::lexer::LexResult;
use ruff_python_parser::{lexer, Mode};
use ruff_text_size::{TextRange, TextSize};
use rustpython_parser::lexer::LexResult;
use rustpython_parser::{lexer, Mode};
use crate::Indexer;
use ruff_source_file::Locator;