From 93a19bda173cdd9ef80aeb1b647eb4e9fd4f7955 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 19 Feb 2020 09:49:26 +0200 Subject: ra_mbe: convert_literal now works with malformed tokens --- crates/ra_mbe/src/subtree_source.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_mbe/src') diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs index dacca8279..91e324db9 100644 --- a/crates/ra_mbe/src/subtree_source.rs +++ b/crates/ra_mbe/src/subtree_source.rs @@ -1,7 +1,7 @@ //! FIXME: write short doc here use ra_parser::{Token, TokenSource}; -use ra_syntax::{lex_single_valid_syntax_kind, SmolStr, SyntaxKind, SyntaxKind::*, T}; +use ra_syntax::{lex_single_syntax_kind, SmolStr, SyntaxKind, SyntaxKind::*, T}; use std::cell::{Cell, Ref, RefCell}; use tt::buffer::{Cursor, TokenBuffer}; @@ -129,7 +129,8 @@ fn convert_delim(d: Option, closing: bool) -> TtToken { } fn convert_literal(l: &tt::Literal) -> TtToken { - let kind = lex_single_valid_syntax_kind(&l.text) + let kind = lex_single_syntax_kind(&l.text) + .map(|(kind, _error)| kind) .filter(|kind| kind.is_literal()) .unwrap_or_else(|| match l.text.as_ref() { "true" => T![true], -- cgit v1.2.3