aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/utils.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-02 15:14:56 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-02 15:14:56 +0100
commit7ffc114dab6d1e25ead195a5937cd4f9ca51ef2c (patch)
treee8bab3ea497a8e7207a24e481361bdd56ed81eaa /crates/ra_syntax/src/utils.rs
parentcd9c5f4ab205e092b87be6affe6d7e78d877dbf0 (diff)
parenta261a1836ba02a1c091c5165795dc165ca399a87 (diff)
Merge #85
85: start moving syntax tree to a separate crate r=matklad a=matklad WIP Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/utils.rs')
-rw-r--r--crates/ra_syntax/src/utils.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/utils.rs b/crates/ra_syntax/src/utils.rs
index 671dd7afa..8bc5f0e24 100644
--- a/crates/ra_syntax/src/utils.rs
+++ b/crates/ra_syntax/src/utils.rs
@@ -1,12 +1,12 @@
1use std::fmt::Write; 1use std::fmt::Write;
2use { 2use {
3 algo::walk::{preorder, walk, WalkEvent}, 3 algo::walk::{preorder, walk, WalkEvent},
4 SyntaxKind, File, SyntaxNodeRef, TreeRoot, 4 SyntaxKind, File, SyntaxNodeRef
5}; 5};
6 6
7/// Parse a file and create a string representation of the resulting parse tree. 7/// Parse a file and create a string representation of the resulting parse tree.
8pub fn dump_tree(syntax: SyntaxNodeRef) -> String { 8pub fn dump_tree(syntax: SyntaxNodeRef) -> String {
9 let mut errors: Vec<_> = syntax.root.syntax_root().errors.iter().cloned().collect(); 9 let mut errors: Vec<_> = syntax.root_data().iter().cloned().collect();
10 errors.sort_by_key(|e| e.offset); 10 errors.sort_by_key(|e| e.offset);
11 let mut err_pos = 0; 11 let mut err_pos = 0;
12 let mut level = 0; 12 let mut level = 0;