aboutsummaryrefslogtreecommitdiff
path: root/crates/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tools/src')
-rw-r--r--crates/tools/src/lib.rs4
-rw-r--r--crates/tools/src/main.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs
index 7b5a60847..ba7d10caa 100644
--- a/crates/tools/src/lib.rs
+++ b/crates/tools/src/lib.rs
@@ -71,9 +71,9 @@ pub fn update(path: &Path, contents: &str, verify: bool) -> Result<()> {
71 Ok(()) 71 Ok(())
72} 72}
73 73
74pub fn render_template(template: &str, grammarfile: &str) -> Result<String> { 74pub fn render_template(template: &str) -> Result<String> {
75 let grammar: ron::value::Value = { 75 let grammar: ron::value::Value = {
76 let text = fs::read_to_string(grammarfile)?; 76 let text = fs::read_to_string(format!("{}{}", Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap()).parent().unwrap().to_str().unwrap(), "/ra_syntax/src/grammar.ron"))?;
77 ron::de::from_str(&text)? 77 ron::de::from_str(&text)?
78 }; 78 };
79 let template = fs::read_to_string(template)?; 79 let template = fs::read_to_string(template)?;
diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs
index 179c1163f..aa6d964e6 100644
--- a/crates/tools/src/main.rs
+++ b/crates/tools/src/main.rs
@@ -45,8 +45,8 @@ fn main() -> Result<()> {
45fn run_gen_command(name: &str, verify: bool) -> Result<()> { 45fn run_gen_command(name: &str, verify: bool) -> Result<()> {
46 match name { 46 match name {
47 "gen-kinds" => { 47 "gen-kinds" => {
48 update(Path::new(SYNTAX_KINDS), &render_template(SYNTAX_KINDS_TEMPLATE, GRAMMAR)?, verify)?; 48 update(Path::new(SYNTAX_KINDS), &render_template(SYNTAX_KINDS_TEMPLATE)?, verify)?;
49 update(Path::new(AST), &render_template(AST_TEMPLATE, GRAMMAR)?, verify)?; 49 update(Path::new(AST), &render_template(AST_TEMPLATE)?, verify)?;
50 }, 50 },
51 "gen-tests" => { 51 "gen-tests" => {
52 gen_tests(verify)? 52 gen_tests(verify)?