mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
Upgrade RustPython to match new flattened exports (#3141)
This commit is contained in:
parent
ba61bb6a6c
commit
2f9de335db
49 changed files with 196 additions and 236 deletions
|
@ -1,13 +1,12 @@
|
|||
use rustpython_parser as parser;
|
||||
use rustpython_parser::ast::{Mod, Suite};
|
||||
use rustpython_parser::error::ParseError;
|
||||
use rustpython_parser::lexer::LexResult;
|
||||
use rustpython_parser::mode::Mode;
|
||||
use rustpython_parser::{lexer, parser};
|
||||
use rustpython_parser::{lexer, Mode, ParseError};
|
||||
|
||||
/// Collect tokens up to and including the first error.
|
||||
pub fn tokenize(contents: &str) -> Vec<LexResult> {
|
||||
let mut tokens: Vec<LexResult> = vec![];
|
||||
for tok in lexer::make_tokenizer(contents, Mode::Module) {
|
||||
for tok in lexer::lex(contents, Mode::Module) {
|
||||
let is_err = tok.is_err();
|
||||
tokens.push(tok);
|
||||
if is_err {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use rustc_hash::FxHashMap;
|
||||
use rustpython_parser::ast::Location;
|
||||
use rustpython_parser::lexer::{LexResult, Tok};
|
||||
use rustpython_parser::lexer::LexResult;
|
||||
use rustpython_parser::Tok;
|
||||
|
||||
use crate::core::types::Range;
|
||||
use crate::cst::{Alias, Excepthandler, ExcepthandlerKind, Expr, ExprKind, Stmt, StmtKind};
|
||||
|
@ -45,7 +46,8 @@ pub struct TriviaToken {
|
|||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum TriviaKind {
|
||||
/// A Comment that is separated by at least one line break from the preceding token.
|
||||
/// A Comment that is separated by at least one line break from the
|
||||
/// preceding token.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue