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

@ -1,7 +1,7 @@
use std::fmt::{Debug, Formatter, Write};
use itertools::Itertools;
use rustpython_ast::Ranged;
use ruff_python_ast::Ranged;
use ruff_formatter::SourceCode;
@ -178,8 +178,8 @@ impl Debug for DebugNodeCommentSlice<'_> {
#[cfg(test)]
mod tests {
use insta::assert_debug_snapshot;
use ruff_python_ast::{StmtBreak, StmtContinue};
use ruff_text_size::{TextRange, TextSize};
use rustpython_ast::{StmtBreak, StmtContinue};
use ruff_formatter::SourceCode;
use ruff_python_ast::node::AnyNode;

View file

@ -1,5 +1,5 @@
use ruff_python_ast::Ranged;
use ruff_text_size::{TextLen, TextRange, TextSize};
use rustpython_ast::Ranged;
use ruff_formatter::{format_args, write, FormatError, SourceCode};
use ruff_python_ast::node::{AnyNodeRef, AstNode};

View file

@ -92,7 +92,7 @@ use std::cell::Cell;
use std::fmt::Debug;
use std::rc::Rc;
use rustpython_ast::{Mod, Ranged};
use ruff_python_ast::{Mod, Ranged};
pub(crate) use format::{
dangling_comments, dangling_node_comments, leading_alternate_branch_comments, leading_comments,
@ -414,9 +414,9 @@ struct CommentsData<'a> {
#[cfg(test)]
mod tests {
use insta::assert_debug_snapshot;
use rustpython_ast::Mod;
use rustpython_parser::lexer::lex;
use rustpython_parser::{parse_tokens, Mode};
use ruff_python_ast::Mod;
use ruff_python_parser::lexer::lex;
use ruff_python_parser::{parse_tokens, Mode};
use ruff_formatter::SourceCode;
use ruff_python_index::{CommentRanges, CommentRangesBuilder};

View file

@ -53,8 +53,8 @@ impl<'a> From<AnyNodeRef<'a>> for NodeRefEqualityKey<'a> {
mod tests {
use crate::comments::node_key::NodeRefEqualityKey;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::StmtContinue;
use ruff_text_size::TextRange;
use rustpython_ast::StmtContinue;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};

View file

@ -1,11 +1,10 @@
use std::cmp::Ordering;
use ruff_text_size::TextRange;
use rustpython_parser::ast;
use rustpython_parser::ast::{
Arguments, Comprehension, Expr, ExprAttribute, ExprBinOp, ExprIfExp, ExprSlice, ExprStarred,
MatchCase, Ranged,
use ruff_python_ast::{
self as ast, Arguments, Comprehension, Expr, ExprAttribute, ExprBinOp, ExprIfExp, ExprSlice,
ExprStarred, MatchCase, Ranged,
};
use ruff_text_size::TextRange;
use ruff_python_ast::node::{AnyNodeRef, AstNode};
use ruff_python_ast::whitespace::indentation;

View file

@ -1,10 +1,10 @@
use std::iter::Peekable;
use ruff_text_size::{TextRange, TextSize};
use rustpython_ast::{
use ruff_python_ast::{
Alias, Arg, ArgWithDefault, Arguments, Comprehension, Decorator, ElifElseClause, ExceptHandler,
Expr, Keyword, MatchCase, Mod, Pattern, Ranged, Stmt, TypeParam, WithItem,
};
use ruff_text_size::{TextRange, TextSize};
use ruff_formatter::{SourceCode, SourceCodeSlice};
use ruff_python_ast::node::AnyNodeRef;