aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2020-05-01 13:29:03 +0100
committerLaurenČ›iu Nicola <[email protected]>2020-05-01 13:29:03 +0100
commit1e20467c3a62f0b8a65605938a2ddb7babcfd8bb (patch)
tree2362e3b94cb4fe29bf17a9fc565152a33163fe5a /crates/ra_syntax
parenta5f2b16366f027ad60c58266a66eb7fbdcbda9f9 (diff)
Bump deps
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/Cargo.toml4
-rw-r--r--crates/ra_syntax/src/parsing/lexer.rs37
2 files changed, 24 insertions, 17 deletions
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index 7ffe46c69..c07ff488e 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
13[dependencies] 13[dependencies]
14itertools = "0.9.0" 14itertools = "0.9.0"
15rowan = "0.10.0" 15rowan = "0.10.0"
16rustc_lexer = { version = "652.0.0", package = "rustc-ap-rustc_lexer" } 16rustc_lexer = { version = "656.0.0", package = "rustc-ap-rustc_lexer" }
17rustc-hash = "1.1.0" 17rustc-hash = "1.1.0"
18arrayvec = "0.5.1" 18arrayvec = "0.5.1"
19once_cell = "1.3.1" 19once_cell = "1.3.1"
@@ -27,7 +27,7 @@ ra_parser = { path = "../ra_parser" }
27# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here 27# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here
28# to reduce number of compilations 28# to reduce number of compilations
29smol_str = { version = "0.1.15", features = ["serde"] } 29smol_str = { version = "0.1.15", features = ["serde"] }
30serde = { version = "1.0.104", features = ["derive"] } 30serde = { version = "1.0.106", features = ["derive"] }
31 31
32[dev-dependencies] 32[dev-dependencies]
33test_utils = { path = "../test_utils" } 33test_utils = { path = "../test_utils" }
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs
index f450ef4a2..1a5a6dc06 100644
--- a/crates/ra_syntax/src/parsing/lexer.rs
+++ b/crates/ra_syntax/src/parsing/lexer.rs
@@ -180,7 +180,7 @@ fn rustc_token_kind_to_syntax_kind(
180 return (syntax_kind, None); 180 return (syntax_kind, None);
181 181
182 fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) { 182 fn match_literal_kind(kind: &rustc_lexer::LiteralKind) -> (SyntaxKind, Option<&'static str>) {
183 use rustc_lexer::LiteralKind as LK; 183 use rustc_lexer::{LexRawStrError, LiteralKind as LK};
184 184
185 #[rustfmt::skip] 185 #[rustfmt::skip]
186 let syntax_kind = match *kind { 186 let syntax_kind = match *kind {
@@ -215,21 +215,28 @@ 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 { started: true, terminated: true, .. } => RAW_STRING, 218 LK::RawStr(str) => match str.validate() {
219 LK::RawStr { started: true, terminated: false, .. } => { 219 Ok(_) => RAW_STRING,
220 return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal")) 220 Err(LexRawStrError::InvalidStarter) => return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")),
221 } 221 Err(LexRawStrError::NoTerminator { expected, found, .. }) => if expected == found {
222 LK::RawStr { started: false, .. } => { 222 return (RAW_STRING, Some("Missing trailing `\"` to terminate the raw string literal"))
223 return (RAW_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw string literal")) 223 } else {
224 } 224 return (RAW_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw string literal"))
225
226 },
227 Err(LexRawStrError::TooManyDelimiters { .. }) => return (RAW_STRING, Some("Too many `#` symbols: raw strings may be delimited by up to 65535 `#` symbols")),
228 },
229 LK::RawByteStr(str) => match str.validate() {
230 Ok(_) => RAW_BYTE_STRING,
231 Err(LexRawStrError::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 {
233 return (RAW_BYTE_STRING, Some("Missing trailing `\"` to terminate the raw byte string literal"))
234 } else {
235 return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal"))
225 236
226 LK::RawByteStr { started: true, terminated: true, .. } => RAW_BYTE_STRING, 237 },
227 LK::RawByteStr { started: true, terminated: false, .. } => { 238 Err(LexRawStrError::TooManyDelimiters { .. }) => return (RAW_BYTE_STRING, Some("Too many `#` symbols: raw byte strings may be delimited by up to 65535 `#` symbols")),
228 return (RAW_BYTE_STRING, Some("Missing trailing `\"` with `#` symbols to terminate the raw byte string literal")) 239 },
229 }
230 LK::RawByteStr { started: false, .. } => {
231 return (RAW_BYTE_STRING, Some("Missing `\"` symbol after `#` symbols to begin the raw byte string literal"))
232 }
233 }; 240 };
234 241
235 (syntax_kind, None) 242 (syntax_kind, None)