This commit is contained in:
Aleksey Kladov
2018-08-11 08:56:13 +03:00
parent f99551f46b
commit 35b59bb438
3 changed files with 13 additions and 8 deletions

View File

@@ -5,11 +5,12 @@ mod extend_selection;
mod line_index;
use libsyntax2::{
ast,
SyntaxNodeRef, AstNode,
algo::walk,
SyntaxKind::*,
};
pub use libsyntax2::{TextRange, TextUnit, ast};
pub use libsyntax2::{File, TextRange, TextUnit};
pub use self::line_index::{LineIndex, LineCol};
#[derive(Debug)]
@@ -43,6 +44,10 @@ pub enum RunnableKind {
Bin,
}
pub fn parse(text: &str) -> ast::File {
ast::File::parse(text)
}
pub fn highlight(file: &ast::File) -> Vec<HighlightedRange> {
let syntax = file.syntax();
let mut res = Vec::new();