aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation.rs
diff options
context:
space:
mode:
authorJulian Wollersberger <[email protected]>2020-05-24 12:12:16 +0100
committerJulian Wollersberger <[email protected]>2020-05-24 12:12:16 +0100
commitcd4ffc1945a3a1ca89776e9abdcd60b1896f356c (patch)
tree3cc68201608e9981ee6d116918478e59e202f86e /crates/ra_syntax/src/validation.rs
parentf4f5fca10175b8d5fdfa36563c103f81b2b0acd3 (diff)
Update to rustc_lexer version 660.
Change `unescape_*()` to `unescape_literal()`.
Diffstat (limited to 'crates/ra_syntax/src/validation.rs')
-rw-r--r--crates/ra_syntax/src/validation.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index d68cf0a82..436ab033d 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -2,15 +2,15 @@
2 2
3mod block; 3mod block;
4 4
5use std::convert::TryFrom;
6
7use rustc_lexer::unescape;
8
9use crate::{ 5use crate::{
10 ast, match_ast, AstNode, SyntaxError, 6 ast, match_ast, AstNode, SyntaxError,
11 SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN_DEF, INT_NUMBER, STRING, TYPE_ALIAS_DEF}, 7 SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN_DEF, INT_NUMBER, STRING, TYPE_ALIAS_DEF},
12 SyntaxNode, SyntaxToken, TextSize, T, 8 SyntaxNode, SyntaxToken, TextSize, T,
13}; 9};
10use rustc_lexer::unescape::{
11 self, unescape_byte, unescape_byte_literal, unescape_char, unescape_literal, Mode,
12};
13use std::convert::TryFrom;
14 14
15fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> &'static str { 15fn rustc_unescape_error_to_string(err: unescape::EscapeError) -> &'static str {
16 use unescape::EscapeError as EE; 16 use unescape::EscapeError as EE;
@@ -121,18 +121,18 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
121 121
122 match token.kind() { 122 match token.kind() {
123 BYTE => { 123 BYTE => {
124 if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape::unescape_byte) { 124 if let Some(Err(e)) = unquote(text, 2, '\'').map(unescape_byte) {
125 push_err(2, e); 125 push_err(2, e);
126 } 126 }
127 } 127 }
128 CHAR => { 128 CHAR => {
129 if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape::unescape_char) { 129 if let Some(Err(e)) = unquote(text, 1, '\'').map(unescape_char) {
130 push_err(1, e); 130 push_err(1, e);
131 } 131 }
132 } 132 }
133 BYTE_STRING => { 133 BYTE_STRING => {
134 if let Some(without_quotes) = unquote(text, 2, '"') { 134 if let Some(without_quotes) = unquote(text, 2, '"') {
135 unescape::unescape_byte_str(without_quotes, &mut |range, char| { 135 unescape_byte_literal(without_quotes, Mode::ByteStr, &mut |range, char| {
136 if let Err(err) = char { 136 if let Err(err) = char {
137 push_err(2, (range.start, err)); 137 push_err(2, (range.start, err));
138 } 138 }
@@ -141,7 +141,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
141 } 141 }
142 STRING => { 142 STRING => {
143 if let Some(without_quotes) = unquote(text, 1, '"') { 143 if let Some(without_quotes) = unquote(text, 1, '"') {
144 unescape::unescape_str(without_quotes, &mut |range, char| { 144 unescape_literal(without_quotes, Mode::Str, &mut |range, char| {
145 if let Err(err) = char { 145 if let Err(err) = char {
146 push_err(1, (range.start, err)); 146 push_err(1, (range.start, err));
147 } 147 }