aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-09 15:25:06 +0100
committerAleksey Kladov <[email protected]>2020-04-09 15:25:06 +0100
commit59b6b2278b7f7d2089b5caf6fcfd57528d9aafd0 (patch)
tree860185a74b977f8583f0d5a9183975d87676b022
parentd61932ef7e74f3d9f7863c33c6647c2c52538ed5 (diff)
Start ast/generated/tokens
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1
-rw-r--r--crates/ra_syntax/src/ast/generated/tokens.rs1
-rw-r--r--xtask/src/codegen.rs1
-rw-r--r--xtask/src/codegen/gen_syntax.rs10
4 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 6216641d8..1e0ba3f71 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1,3 +1,4 @@
1//! This file is actually hand-written, but the submodules are indeed generated. 1//! This file is actually hand-written, but the submodules are indeed generated.
2 2
3pub(super) mod nodes; 3pub(super) mod nodes;
4pub(super) mod tokens;
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs
new file mode 100644
index 000000000..4494af1be
--- /dev/null
+++ b/crates/ra_syntax/src/ast/generated/tokens.rs
@@ -0,0 +1 @@
//! Generated file, do not edit by hand, see `xtask/src/codegen` \ No newline at end of file
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index e6ba2009c..678b40133 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -24,6 +24,7 @@ const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err
24 24
25const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs"; 25const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs";
26const AST_NODES: &str = "crates/ra_syntax/src/ast/generated/nodes.rs"; 26const AST_NODES: &str = "crates/ra_syntax/src/ast/generated/nodes.rs";
27const AST_TOKENS: &str = "crates/ra_syntax/src/ast/generated/tokens.rs";
27 28
28const ASSISTS_DIR: &str = "crates/ra_assists/src/handlers"; 29const ASSISTS_DIR: &str = "crates/ra_assists/src/handlers";
29const ASSISTS_TESTS: &str = "crates/ra_assists/src/doc_tests/generated.rs"; 30const ASSISTS_TESTS: &str = "crates/ra_assists/src/doc_tests/generated.rs";
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index c2734d638..75bcd1973 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -22,9 +22,13 @@ pub fn generate_syntax(mode: Mode) -> Result<()> {
22 let syntax_kinds = generate_syntax_kinds(KINDS_SRC)?; 22 let syntax_kinds = generate_syntax_kinds(KINDS_SRC)?;
23 update(syntax_kinds_file.as_path(), &syntax_kinds, mode)?; 23 update(syntax_kinds_file.as_path(), &syntax_kinds, mode)?;
24 24
25 let ast_file = project_root().join(codegen::AST_NODES); 25 let ast_nodes_file = project_root().join(codegen::AST_NODES);
26 let ast = generate_ast(KINDS_SRC, AST_SRC)?; 26 let contents = generate_ast(KINDS_SRC, AST_SRC)?;
27 update(ast_file.as_path(), &ast, mode)?; 27 update(ast_nodes_file.as_path(), &contents, mode)?;
28
29 let ast_tokens_file = project_root().join(codegen::AST_TOKENS);
30 let contents = "//! Generated file, do not edit by hand, see `xtask/src/codegen`";
31 update(ast_tokens_file.as_path(), &contents, mode)?;
28 32
29 Ok(()) 33 Ok(())
30} 34}