diff options
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r-- | cli/src/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs index f6c66743f..45e0a1e4f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs | |||
@@ -10,7 +10,7 @@ use std::{ | |||
10 | }; | 10 | }; |
11 | use clap::{App, Arg, SubCommand}; | 11 | use clap::{App, Arg, SubCommand}; |
12 | use tools::collect_tests; | 12 | use tools::collect_tests; |
13 | use libeditor::File; | 13 | use libeditor::{ast, syntax_tree, symbols}; |
14 | 14 | ||
15 | type Result<T> = ::std::result::Result<T, failure::Error>; | 15 | type Result<T> = ::std::result::Result<T, failure::Error>; |
16 | 16 | ||
@@ -44,14 +44,14 @@ fn main() -> Result<()> { | |||
44 | let file = file()?; | 44 | let file = file()?; |
45 | let elapsed = start.elapsed(); | 45 | let elapsed = start.elapsed(); |
46 | if !matches.is_present("no-dump") { | 46 | if !matches.is_present("no-dump") { |
47 | println!("{}", file.syntax_tree()); | 47 | println!("{}", syntax_tree(&file)); |
48 | } | 48 | } |
49 | eprintln!("parsing: {:?}", elapsed); | 49 | eprintln!("parsing: {:?}", elapsed); |
50 | ::std::mem::forget(file); | 50 | ::std::mem::forget(file); |
51 | } | 51 | } |
52 | ("symbols", _) => { | 52 | ("symbols", _) => { |
53 | let file = file()?; | 53 | let file = file()?; |
54 | for s in file.symbols() { | 54 | for s in symbols(&file) { |
55 | println!("{:?}", s); | 55 | println!("{:?}", s); |
56 | } | 56 | } |
57 | } | 57 | } |
@@ -68,9 +68,9 @@ fn main() -> Result<()> { | |||
68 | Ok(()) | 68 | Ok(()) |
69 | } | 69 | } |
70 | 70 | ||
71 | fn file() -> Result<File> { | 71 | fn file() -> Result<ast::File> { |
72 | let text = read_stdin()?; | 72 | let text = read_stdin()?; |
73 | Ok(File::new(&text)) | 73 | Ok(ast::File::parse(&text)) |
74 | } | 74 | } |
75 | 75 | ||
76 | fn read_stdin() -> Result<String> { | 76 | fn read_stdin() -> Result<String> { |
@@ -89,7 +89,7 @@ fn render_test(file: &Path, line: usize) -> Result<(String, String)> { | |||
89 | None => bail!("No test found at line {} at {}", line, file.display()), | 89 | None => bail!("No test found at line {} at {}", line, file.display()), |
90 | Some((_start_line, test)) => test, | 90 | Some((_start_line, test)) => test, |
91 | }; | 91 | }; |
92 | let file = File::new(&test.text); | 92 | let file = ast::File::parse(&test.text); |
93 | let tree = file.syntax_tree(); | 93 | let tree = syntax_tree(&file); |
94 | Ok((test.text, tree)) | 94 | Ok((test.text, tree)) |
95 | } | 95 | } |