mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-22 03:15:44 +00:00
Move token and error structs into related modules (#11957)
## Summary This PR does some housekeeping into moving certain structs into related modules. Specifically, 1. Move `LexicalError` from `lexer.rs` to `error.rs` which also contains the `ParseError` 2. Move `Token`, `TokenFlags` and `TokenValue` from `lexer.rs` to `token.rs`
This commit is contained in:
parent
4667d8697c
commit
96da136e6a
10 changed files with 352 additions and 342 deletions
|
@ -11,12 +11,12 @@ use ruff_python_ast::{
|
|||
};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::lexer::TokenValue;
|
||||
use crate::parser::progress::ParserProgress;
|
||||
use crate::parser::{helpers, FunctionKind, Parser};
|
||||
use crate::string::{parse_fstring_literal_element, parse_string_literal, StringType};
|
||||
use crate::token::{TokenKind, TokenValue};
|
||||
use crate::token_set::TokenSet;
|
||||
use crate::{FStringErrorType, Mode, ParseErrorType, TokenKind};
|
||||
use crate::{FStringErrorType, Mode, ParseErrorType};
|
||||
|
||||
use super::{FStringElementsKind, Parenthesized, RecoveryContextKind};
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ use bitflags::bitflags;
|
|||
use ruff_python_ast::{Mod, ModExpression, ModModule};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::lexer::TokenValue;
|
||||
use crate::parser::expression::ExpressionContext;
|
||||
use crate::parser::progress::{ParserProgress, TokenId};
|
||||
use crate::token::TokenValue;
|
||||
use crate::token_set::TokenSet;
|
||||
use crate::token_source::{TokenSource, TokenSourceCheckpoint};
|
||||
use crate::{Mode, ParseError, ParseErrorType, TokenKind};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use ruff_python_ast::{self as ast, Expr, ExprContext, Number, Operator, Pattern, Singleton};
|
||||
use ruff_text_size::{Ranged, TextSize};
|
||||
|
||||
use crate::lexer::TokenValue;
|
||||
use crate::parser::progress::ParserProgress;
|
||||
use crate::parser::{recovery, Parser, RecoveryContextKind, SequenceMatchPatternParentheses};
|
||||
use crate::token::{TokenKind, TokenValue};
|
||||
use crate::token_set::TokenSet;
|
||||
use crate::{ParseErrorType, TokenKind};
|
||||
use crate::ParseErrorType;
|
||||
|
||||
use super::expression::ExpressionContext;
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@ use ruff_python_ast::{
|
|||
};
|
||||
use ruff_text_size::{Ranged, TextSize};
|
||||
|
||||
use crate::lexer::TokenValue;
|
||||
use crate::parser::expression::{ParsedExpr, EXPR_SET};
|
||||
use crate::parser::progress::ParserProgress;
|
||||
use crate::parser::{
|
||||
helpers, FunctionKind, Parser, RecoveryContext, RecoveryContextKind, WithItemKind,
|
||||
};
|
||||
use crate::token::{TokenKind, TokenValue};
|
||||
use crate::token_set::TokenSet;
|
||||
use crate::{Mode, ParseErrorType, TokenKind};
|
||||
use crate::{Mode, ParseErrorType};
|
||||
|
||||
use super::expression::ExpressionContext;
|
||||
use super::Parenthesized;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue