Upgrade RustPython to match new flattened exports (#3141)

This commit is contained in:
Charlie Marsh 2023-02-22 14:36:13 -05:00 committed by GitHub
parent ba61bb6a6c
commit 2f9de335db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 196 additions and 236 deletions

View file

@ -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 {

View file

@ -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
///