diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-27 12:00:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-27 12:00:51 +0100 |
commit | 6a067ce947980d887a254d71d7183c3d306d8978 (patch) | |
tree | cab25fc23f271c74142b9fd1bc96f3395ed0da7e /crates/ra_syntax/src | |
parent | 67b1dfba50a7fbd872c1668bbc719b2a5cc6ffcd (diff) | |
parent | 52a488982f954978ff183fef976ec7612eca6883 (diff) |
Merge #5090
5090: Bump deps r=matklad a=lnicola
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index 1a5a6dc06..fa3be1016 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -1,6 +1,8 @@ | |||
1 | //! Lexer analyzes raw input string and produces lexemes (tokens). | 1 | //! Lexer analyzes raw input string and produces lexemes (tokens). |
2 | //! It is just a bridge to `rustc_lexer`. | 2 | //! It is just a bridge to `rustc_lexer`. |
3 | 3 | ||
4 | use rustc_lexer::{LiteralKind as LK, RawStrError}; | ||
5 | |||
4 | use std::convert::TryInto; | 6 | use std::convert::TryInto; |
5 | 7 | ||
6 | use crate::{ | 8 | use crate::{ |
@@ -180,8 +182,6 @@ fn rustc_token_kind_to_syntax_kind( | |||
180 | return (syntax_kind, None); | 182 | return (syntax_kind, None); |
181 | 183 | ||
182 | fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) { | 184 | fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) { |
183 | use rustc_lexer::{LexRawStrError, LiteralKind as LK}; | ||
184 | |||
185 | #[rustfmt::skip] | 185 | #[rustfmt::skip] |
186 | let syntax_kind = match *kind { | 186 | let syntax_kind = match *kind { |
187 | LK::Int { empty_int: false, .. } => INT_NUMBER, | 187 | LK::Int { empty_int: false, .. } => INT_NUMBER, |
@@ -215,27 +215,27 @@ fn rustc_token_kind_to_syntax_kind( | |||
215 | return (BYTE_STRING, Some("Missing trailing `\"` symbol to terminate the byte string literal")) | 215 | return (BYTE_STRING, Some("Missing trailing `\"` symbol to terminate the byte string literal")) |
216 | } | 216 | } |
217 | 217 | ||
218 | LK::RawStr(str) => match str.validate() { | 218 | LK::RawStr { err, .. } => match err { |
219 | Ok(_) => RAW_STRING, | 219 | None => RAW_STRING, |
220 | Err(LexRawStrError::InvalidStarter) => return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")), | 220 | Some(RawStrError::InvalidStarter { .. }) => return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")), |
221 | Err(LexRawStrError::NoTerminator { expected, found, .. }) => if expected == found { | 221 | Some(RawStrError::NoTerminator { expected, found, .. }) => if expected == found { |
222 | return (RAW_STRING, Some("Missing trailing `\"` to terminate the raw string literal")) | 222 | return (RAW_STRING, Some("Missing trailing `\"` to terminate the raw string literal")) |
223 | } else { | 223 | } else { |
224 | return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal")) | 224 | return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal")) |
225 | 225 | ||
226 | }, | 226 | }, |
227 | Err(LexRawStrError::TooManyDelimiters { .. }) => return (RAW_STRING, Some("Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols")), | 227 | Some(RawStrError::TooManyDelimiters { .. }) => return (RAW_STRING, Some("Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols")), |
228 | }, | 228 | }, |
229 | LK::RawByteStr(str) => match str.validate() { | 229 | LK::RawByteStr { err, .. } => match err { |
230 | Ok(_) => RAW_BYTE_STRING, | 230 | None => RAW_BYTE_STRING, |
231 | Err(LexRawStrError::InvalidStarter) => return (RAW_BYTE_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw byte string literal")), | 231 | Some(RawStrError::InvalidStarter { .. }) => return (RAW_BYTE_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw byte string literal")), |
232 | Err(LexRawStrError::NoTerminator { expected, found, .. }) => if expected == found { | 232 | Some(RawStrError::NoTerminator { expected, found, .. }) => if expected == found { |
233 | return (RAW_BYTE_STRING, Some("Missing trailing `\"` to terminate the raw byte string literal")) | 233 | return (RAW_BYTE_STRING, Some("Missing trailing `\"` to terminate the raw byte string literal")) |
234 | } else { | 234 | } else { |
235 | return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal")) | 235 | return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal")) |
236 | 236 | ||
237 | }, | 237 | }, |
238 | Err(LexRawStrError::TooManyDelimiters { .. }) => return (RAW_BYTE_STRING, Some("Too many `#` symbols: raw byte strings may be delimited by up to 65535 `#` symbols")), | 238 | Some(RawStrError::TooManyDelimiters { .. }) => return (RAW_BYTE_STRING, Some("Too many `#` symbols: raw byte strings may be delimited by up to 65535 `#` symbols")), |
239 | }, | 239 | }, |
240 | }; | 240 | }; |
241 | 241 | ||