aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tools/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_tools/src/lib.rs')
-rw-r--r--crates/ra_tools/src/lib.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/crates/ra_tools/src/lib.rs b/crates/ra_tools/src/lib.rs
index 2cbb07ebf..de8c472d1 100644
--- a/crates/ra_tools/src/lib.rs
+++ b/crates/ra_tools/src/lib.rs
@@ -13,7 +13,7 @@ use itertools::Itertools;
13 13
14pub use teraron::{Mode, Overwrite, Verify}; 14pub use teraron::{Mode, Overwrite, Verify};
15 15
16pub use self::codegen::generate_ast; 16pub use self::codegen::generate;
17 17
18pub type Result<T> = std::result::Result<T, Box<dyn Error>>; 18pub type Result<T> = std::result::Result<T, Box<dyn Error>>;
19 19
@@ -23,7 +23,7 @@ const OK_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/ok";
23const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err"; 23const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err";
24 24
25pub const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs.tera"; 25pub const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs.tera";
26pub const AST: &str = "crates/ra_syntax/src/ast/generated.rs.tera"; 26pub const AST: &str = "crates/ra_syntax/src/ast/generated.rs";
27const TOOLCHAIN: &str = "stable"; 27const TOOLCHAIN: &str = "stable";
28 28
29#[derive(Debug)] 29#[derive(Debug)]
@@ -70,15 +70,6 @@ pub fn collect_tests(s: &str) -> Vec<(usize, Test)> {
70 res 70 res
71} 71}
72 72
73pub fn generate(mode: Mode) -> Result<()> {
74 let grammar = project_root().join(GRAMMAR);
75 let syntax_kinds = project_root().join(SYNTAX_KINDS);
76 let ast = project_root().join(AST);
77 teraron::generate(&syntax_kinds, &grammar, mode)?;
78 teraron::generate(&ast, &grammar, mode)?;
79 Ok(())
80}
81
82pub fn project_root() -> PathBuf { 73pub fn project_root() -> PathBuf {
83 Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf() 74 Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf()
84} 75}