aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-01-28 05:09:13 +0000
committerVeetaha <[email protected]>2020-02-03 22:00:55 +0000
commit9e7eaa959f9dc368a55f1a80b35651b78b3d0883 (patch)
tree4b1f4af14d9898301949fa937219006d671a72ef /crates/ra_mbe
parentbf60661aa3e2a77fedb3e1627675842d05538860 (diff)
ra_syntax: refactored the lexer design as per @matklad and @kiljacken PR review
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r--crates/ra_mbe/src/subtree_source.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs
index 72ac8df03..c9f42b3dd 100644
--- a/crates/ra_mbe/src/subtree_source.rs
+++ b/crates/ra_mbe/src/subtree_source.rs
@@ -1,7 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use ra_parser::{Token, TokenSource}; 3use ra_parser::{Token, TokenSource};
4use ra_syntax::{single_token, SmolStr, SyntaxKind, SyntaxKind::*, T}; 4use ra_syntax::{lex_single_valid_syntax_kind, SmolStr, SyntaxKind, SyntaxKind::*, T};
5use std::cell::{Cell, Ref, RefCell}; 5use std::cell::{Cell, Ref, RefCell};
6use tt::buffer::{Cursor, TokenBuffer}; 6use tt::buffer::{Cursor, TokenBuffer};
7 7
@@ -129,8 +129,7 @@ fn convert_delim(d: Option<tt::DelimiterKind>, closing: bool) -> TtToken {
129} 129}
130 130
131fn convert_literal(l: &tt::Literal) -> TtToken { 131fn convert_literal(l: &tt::Literal) -> TtToken {
132 let kind = single_token(&l.text) 132 let kind = lex_single_valid_syntax_kind(&l.text)
133 .map(|parsed| parsed.token.kind)
134 .filter(|kind| kind.is_literal()) 133 .filter(|kind| kind.is_literal())
135 .unwrap_or_else(|| match l.text.as_ref() { 134 .unwrap_or_else(|| match l.text.as_ref() {
136 "true" => T![true], 135 "true" => T![true],