Add classify_literal and undo expose next_token

This commit is contained in:
Edwin Cheng
2019-04-05 18:45:19 +08:00
parent 1ab78d6056
commit 1ea0238e53
5 changed files with 15 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
use ra_parser::{TokenSource, TreeSink, ParseError};
use ra_syntax::{
AstNode, SyntaxNode, TextRange, SyntaxKind, SmolStr, SyntaxTreeBuilder, TreeArc, SyntaxElement,
ast, SyntaxKind::*, TextUnit, next_token
ast, SyntaxKind::*, TextUnit, classify_literal
};
/// Maps `tt::TokenId` to the relative range of the original token.
@@ -189,7 +189,7 @@ impl TtTokenSource {
{
let tok = match token {
tt::Leaf::Literal(l) => TtToken {
kind: next_token(&l.text).kind,
kind: classify_literal(&l.text).unwrap().kind,
is_joint_to_next: false,
text: l.text.clone(),
},