mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-04 09:30:45 +00:00
Reimplemented lexer with vectors instead of iterators
This commit is contained in:
parent
ad24976da3
commit
ac37a11f04
10 changed files with 254 additions and 200 deletions
|
@ -4,7 +4,7 @@
|
|||
//! `SyntaxNode`, and a basic traversal API (parent, children, siblings).
|
||||
//!
|
||||
//! The *real* implementation is in the (language-agnostic) `rowan` crate, this
|
||||
//! modules just wraps its API.
|
||||
//! module just wraps its API.
|
||||
|
||||
use ra_parser::ParseError;
|
||||
use rowan::{GreenNodeBuilder, Language};
|
||||
|
@ -38,14 +38,15 @@ pub type SyntaxElementChildren = rowan::SyntaxElementChildren<RustLanguage>;
|
|||
|
||||
pub use rowan::{Direction, NodeOrToken};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct SyntaxTreeBuilder {
|
||||
errors: Vec<SyntaxError>,
|
||||
inner: GreenNodeBuilder<'static>,
|
||||
}
|
||||
|
||||
impl Default for SyntaxTreeBuilder {
|
||||
fn default() -> SyntaxTreeBuilder {
|
||||
SyntaxTreeBuilder { errors: Vec::new(), inner: GreenNodeBuilder::new() }
|
||||
impl SyntaxTreeBuilder {
|
||||
pub fn new(errors: Vec<SyntaxError>) -> Self {
|
||||
Self { errors, inner: GreenNodeBuilder::default() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue