Simplify creation of T[,]

This commit is contained in:
Aleksey Kladov 2020-03-06 15:38:48 +01:00
parent 5947c1f8b5
commit 85e2346b74
2 changed files with 4 additions and 13 deletions

View file

@ -240,22 +240,13 @@ fn unroot(n: SyntaxNode) -> SyntaxNode {
}
pub mod tokens {
use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken, T};
use once_cell::sync::Lazy;
use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken};
pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> =
Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;"));
pub fn comma() -> SyntaxToken {
SOURCE_FILE
.tree()
.syntax()
.descendants_with_tokens()
.filter_map(|it| it.into_token())
.find(|it| it.kind() == T![,])
.unwrap()
}
pub fn single_space() -> SyntaxToken {
SOURCE_FILE
.tree()