From 8c478a794c667357b0c9a82ffc5c3eb5ca1b1b0d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 31 Dec 2017 23:34:29 +0300 Subject: Parser: initial --- src/lib.rs | 2 ++ src/parser/mod.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 0685e3f2c..13872a3d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,10 @@ extern crate unicode_xid; mod text; mod tree; mod lexer; +mod parser; pub mod syntax_kinds; pub use text::{TextUnit, TextRange}; pub use tree::{SyntaxKind, Token, FileBuilder, File, Node}; pub use lexer::{next_token, tokenize}; +pub use parser::parse; diff --git a/src/parser/mod.rs b/src/parser/mod.rs index da902e2b7..7336c5136 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -1,5 +1,11 @@ -use {Token, File}; +use {Token, File, FileBuilder}; -pub fn parse(tokens: &[Token]) -> File { - unimplemented!() +use syntax_kinds::*; + + +pub fn parse(text: String, tokens: &[Token]) -> File { + let mut builder = FileBuilder::new(text); + builder.start_internal(FILE); + builder.finish_internal(); + builder.finish() } \ No newline at end of file -- cgit v1.2.3