mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 14:00:51 -05:00
Improved error recovery for unclosed strings (including f- and t-strings) (#20848)
This commit is contained in:
@@ -3,6 +3,7 @@ use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
use crate::Mode;
|
||||
use crate::error::LexicalError;
|
||||
use crate::lexer::{Lexer, LexerCheckpoint};
|
||||
use crate::string::InterpolatedStringKind;
|
||||
use crate::token::{Token, TokenFlags, TokenKind, TokenValue};
|
||||
|
||||
/// Token source for the parser that skips over any trivia tokens.
|
||||
@@ -88,6 +89,18 @@ impl<'src> TokenSource<'src> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn re_lex_string_token_in_interpolation_element(
|
||||
&mut self,
|
||||
kind: InterpolatedStringKind,
|
||||
) {
|
||||
self.lexer
|
||||
.re_lex_string_token_in_interpolation_element(kind);
|
||||
}
|
||||
|
||||
pub(crate) fn re_lex_raw_string_in_format_spec(&mut self) {
|
||||
self.lexer.re_lex_raw_string_in_format_spec();
|
||||
}
|
||||
|
||||
/// Returns the next non-trivia token without consuming it.
|
||||
///
|
||||
/// Use [`peek2`] to get the next two tokens.
|
||||
|
||||
Reference in New Issue
Block a user