From 35b59bb43877c496fbaf98520b3b52ff9a6518b1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Aug 2018 08:56:13 +0300 Subject: simplify --- crates/libeditor/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/libeditor/src') diff --git a/crates/libeditor/src/lib.rs b/crates/libeditor/src/lib.rs index f77647338..c762a8b0b 100644 --- a/crates/libeditor/src/lib.rs +++ b/crates/libeditor/src/lib.rs @@ -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 { let syntax = file.syntax(); let mut res = Vec::new(); -- cgit v1.2.3