Files
rust/src/ast.rs

20 lines
391 B
Rust
Raw Normal View History

2018-07-30 21:58:49 +03:00
use std::sync::Arc;
2018-07-30 23:45:10 +03:00
use {SyntaxNode, TreeRoot, SyntaxRoot};
2018-07-30 21:58:49 +03:00
#[derive(Debug)]
pub struct File<R: TreeRoot = Arc<SyntaxRoot>> {
syntax: SyntaxNode<R>
}
impl File<Arc<SyntaxRoot>> {
pub fn parse(text: &str) -> Self {
File { syntax: ::parse(text.to_owned()) }
}
}
impl<R: TreeRoot> File<R> {
pub fn syntax(&self) -> SyntaxNode<R> {
self.syntax.clone()
}
}