aboutsummaryrefslogtreecommitdiff
path: root/cli/src/main.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-10 15:49:45 +0100
committerAleksey Kladov <[email protected]>2018-08-10 15:49:45 +0100
commit2e165ae82eed1dc62f1f4c68e45440c143c7c8ef (patch)
tree4148d68878bbd05a0c7b7f4ace803083f23293fd /cli/src/main.rs
parentd7c5a6f3081c2e7266620779d3c32067f947b959 (diff)
logging
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r--cli/src/main.rs14
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};
11use clap::{App, Arg, SubCommand}; 11use clap::{App, Arg, SubCommand};
12use tools::collect_tests; 12use tools::collect_tests;
13use libeditor::File; 13use libeditor::{ast, syntax_tree, symbols};
14 14
15type Result<T> = ::std::result::Result<T, failure::Error>; 15type 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
71fn file() -> Result<File> { 71fn 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
76fn read_stdin() -> Result<String> { 76fn 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}