Borrowed AST
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use std::fmt::Write;
|
||||
use {
|
||||
algo::walk::{walk, WalkEvent},
|
||||
SyntaxNode, TreeRoot,
|
||||
SyntaxNodeRef, TreeRoot,
|
||||
};
|
||||
|
||||
/// Parse a file and create a string representation of the resulting parse tree.
|
||||
pub fn dump_tree(syntax: &SyntaxNode) -> String {
|
||||
let syntax = syntax.as_ref();
|
||||
pub fn dump_tree(syntax: SyntaxNodeRef) -> String {
|
||||
let mut errors: Vec<_> = syntax.root.syntax_root().errors.iter().cloned().collect();
|
||||
errors.sort_by_key(|e| e.offset);
|
||||
let mut err_pos = 0;
|
||||
|
||||
Reference in New Issue
Block a user