switch to new codegen

This commit is contained in:
Aleksey Kladov
2019-08-18 21:44:24 +03:00
parent 839d9cce89
commit 229d7943d8
4 changed files with 32 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ use itertools::Itertools;
pub use teraron::{Mode, Overwrite, Verify};
pub use self::codegen::generate_ast;
pub use self::codegen::generate;
pub type Result<T> = std::result::Result<T, Box<dyn Error>>;
@@ -23,7 +23,7 @@ const OK_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/ok";
const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err";
pub const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs.tera";
pub const AST: &str = "crates/ra_syntax/src/ast/generated.rs.tera";
pub const AST: &str = "crates/ra_syntax/src/ast/generated.rs";
const TOOLCHAIN: &str = "stable";
#[derive(Debug)]
@@ -70,15 +70,6 @@ pub fn collect_tests(s: &str) -> Vec<(usize, Test)> {
res
}
pub fn generate(mode: Mode) -> Result<()> {
let grammar = project_root().join(GRAMMAR);
let syntax_kinds = project_root().join(SYNTAX_KINDS);
let ast = project_root().join(AST);
teraron::generate(&syntax_kinds, &grammar, mode)?;
teraron::generate(&ast, &grammar, mode)?;
Ok(())
}
pub fn project_root() -> PathBuf {
Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf()
}