Bump rustc_lexer

This commit is contained in:
Laurențiu Nicola 2020-06-27 10:26:28 +03:00
parent d036006c95
commit 52a488982f
3 changed files with 15 additions and 15 deletions

4
Cargo.lock generated
View file

@ -1420,9 +1420,9 @@ dependencies = [
[[package]] [[package]]
name = "rustc-ap-rustc_lexer" name = "rustc-ap-rustc_lexer"
version = "661.0.0" version = "666.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6d88abd7c634b52557e46fc7ba47644f0cbe45c358c33f51c532d60d1da239e" checksum = "4e00c526f9f8430ea4cd2178d25b02bfc7debe6677350c57292f92f50e65d2fe"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]

View file

@ -13,7 +13,7 @@ doctest = false
[dependencies] [dependencies]
itertools = "0.9.0" itertools = "0.9.0"
rowan = "0.10.0" rowan = "0.10.0"
rustc_lexer = { version = "661.0.0", package = "rustc-ap-rustc_lexer" } rustc_lexer = { version = "666.0.0", package = "rustc-ap-rustc_lexer" }
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
arrayvec = "0.5.1" arrayvec = "0.5.1"
once_cell = "1.3.1" once_cell = "1.3.1"

View file

@ -1,6 +1,8 @@
//! Lexer analyzes raw input string and produces lexemes (tokens). //! Lexer analyzes raw input string and produces lexemes (tokens).
//! It is just a bridge to `rustc_lexer`. //! It is just a bridge to `rustc_lexer`.
use rustc_lexer::{LiteralKind as LK, RawStrError};
use std::convert::TryInto; use std::convert::TryInto;
use crate::{ use crate::{
@ -180,8 +182,6 @@ fn rustc_token_kind_to_syntax_kind(
return (syntax_kind, None); return (syntax_kind, None);
fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) { fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) {
use rustc_lexer::{LexRawStrError, LiteralKind as LK};
#[rustfmt::skip] #[rustfmt::skip]
let syntax_kind = match *kind { let syntax_kind = match *kind {
LK::Int { empty_int: false, .. } => INT_NUMBER, LK::Int { empty_int: false, .. } => INT_NUMBER,
@ -215,27 +215,27 @@ fn rustc_token_kind_to_syntax_kind(
return (BYTE_STRING, Some("Missing trailing `\"` symbol to terminate the byte string literal")) return (BYTE_STRING, Some("Missing trailing `\"` symbol to terminate the byte string literal"))
} }
LK::RawStr(str) => match str.validate() { LK::RawStr { err, .. } => match err {
Ok(_) => RAW_STRING, None => RAW_STRING,
Err(LexRawStrError::InvalidStarter) => return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")), Some(RawStrError::InvalidStarter { .. }) => return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")),
Err(LexRawStrError::NoTerminator { expected, found, .. }) => if expected == found { Some(RawStrError::NoTerminator { expected, found, .. }) => if expected == found {
return (RAW_STRING, Some("Missing trailing `\"` to terminate the raw string literal")) return (RAW_STRING, Some("Missing trailing `\"` to terminate the raw string literal"))
} else { } else {
return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal")) return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal"))
}, },
Err(LexRawStrError::TooManyDelimiters { .. }) => return (RAW_STRING, Some("Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols")), Some(RawStrError::TooManyDelimiters { .. }) => return (RAW_STRING, Some("Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols")),
}, },
LK::RawByteStr(str) => match str.validate() { LK::RawByteStr { err, .. } => match err {
Ok(_) => RAW_BYTE_STRING, None => RAW_BYTE_STRING,
Err(LexRawStrError::InvalidStarter) => return (RAW_BYTE_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw byte string literal")), Some(RawStrError::InvalidStarter { .. }) => return (RAW_BYTE_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw byte string literal")),
Err(LexRawStrError::NoTerminator { expected, found, .. }) => if expected == found { Some(RawStrError::NoTerminator { expected, found, .. }) => if expected == found {
return (RAW_BYTE_STRING, Some("Missing trailing `\"` to terminate the raw byte string literal")) return (RAW_BYTE_STRING, Some("Missing trailing `\"` to terminate the raw byte string literal"))
} else { } else {
return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal")) return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal"))
}, },
Err(LexRawStrError::TooManyDelimiters { .. }) => return (RAW_BYTE_STRING, Some("Too many `#` symbols: raw byte strings may be delimited by up to 65535 `#` symbols")), Some(RawStrError::TooManyDelimiters { .. }) => return (RAW_BYTE_STRING, Some("Too many `#` symbols: raw byte strings may be delimited by up to 65535 `#` symbols")),
}, },
}; };