ra_syntax: remove code duplication and token reevaluation from ast::Literal::kind()

This commit is contained in:
Veetaha 2020-01-22 02:11:38 +02:00
parent b982d60a4d
commit 3ec781d4f2
2 changed files with 23 additions and 33 deletions

View file

@ -27,7 +27,7 @@ pub use syntax_kind::SyntaxKind;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ParseError(pub String);
/// `TokenSource` abstracts the source of the tokens parser operates one.
/// `TokenSource` abstracts the source of the tokens parser operates on.
///
/// Hopefully this will allow us to treat text and token trees in the same way!
pub trait TokenSource {
@ -43,7 +43,7 @@ pub trait TokenSource {
fn is_keyword(&self, kw: &str) -> bool;
}
/// `TokenCursor` abstracts the cursor of `TokenSource` operates one.
/// `Token` abstracts the cursor of `TokenSource` operates on.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Token {
/// What is the current token?