Fix literal support in token tree to ast item list

This commit is contained in:
Edwin Cheng 2019-04-05 18:23:01 +08:00
parent be9a44e9ba
commit 1ab78d6056
4 changed files with 45 additions and 4 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
ast, SyntaxKind::*, TextUnit, next_token
};
/// 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: SyntaxKind::INT_NUMBER, // FIXME
kind: next_token(&l.text).kind,
is_joint_to_next: false,
text: l.text.clone(),
},