mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Update to rustc_lexer version 660.
Change `unescape_*()` to `unescape_literal()`.
This commit is contained in:
parent
f4f5fca101
commit
cd4ffc1945
4 changed files with 14 additions and 13 deletions
|
@ -2,15 +2,15 @@
|
|||
|
||||
mod block;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use rustc_lexer::unescape;
|
||||
|
||||
use crate::{
|
||||
ast, match_ast, AstNode, SyntaxError,
|
||||
SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN_DEF, INT_NUMBER, STRING, TYPE_ALIAS_DEF},
|
||||
SyntaxNode, SyntaxToken, TextSize, T,
|
||||
};
|
||||
use rustc_lexer::unescape::{
|
||||
self, unescape_byte, unescape_byte_literal, unescape_char, unescape_literal, Mode,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> &'static str {
|
||||
use unescape::EscapeError as EE;
|
||||
|
@ -121,18 +121,18 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
|
|||
|
||||
match token.kind() {
|
||||
BYTE => {
|
||||
if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape::unescape_byte) {
|
||||
if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape_byte) {
|
||||
push_err(2, e);
|
||||
}
|
||||
}
|
||||
CHAR => {
|
||||
if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape::unescape_char) {
|
||||
if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape_char) {
|
||||
push_err(1, e);
|
||||
}
|
||||
}
|
||||
BYTE_STRING => {
|
||||
if let Some(without_quotes) = unquote(text, 2, '"') {
|
||||
unescape::unescape_byte_str(without_quotes, &mut |range, char| {
|
||||
unescape_byte_literal(without_quotes, Mode::ByteStr, &mut |range, char| {
|
||||
if let Err(err) = char {
|
||||
push_err(2, (range.start, err));
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
|
|||
}
|
||||
STRING => {
|
||||
if let Some(without_quotes) = unquote(text, 1, '"') {
|
||||
unescape::unescape_str(without_quotes, &mut |range, char| {
|
||||
unescape_literal(without_quotes, Mode::Str, &mut |range, char| {
|
||||
if let Err(err) = char {
|
||||
push_err(1, (range.start, err));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue