Start ast/generated/tokens

This commit is contained in:
Aleksey Kladov 2020-04-09 16:25:06 +02:00
parent d61932ef7e
commit 59b6b2278b
4 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,4 @@
//! This file is actually hand-written, but the submodules are indeed generated.
pub(super) mod nodes;
pub(super) mod tokens;

View file

@ -0,0 +1 @@
//! Generated file, do not edit by hand, see `xtask/src/codegen`

View file

@ -24,6 +24,7 @@ const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err
const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs";
const AST_NODES: &str = "crates/ra_syntax/src/ast/generated/nodes.rs";
const AST_TOKENS: &str = "crates/ra_syntax/src/ast/generated/tokens.rs";
const ASSISTS_DIR: &str = "crates/ra_assists/src/handlers";
const ASSISTS_TESTS: &str = "crates/ra_assists/src/doc_tests/generated.rs";

View file

@ -22,9 +22,13 @@ pub fn generate_syntax(mode: Mode) -> Result<()> {
let syntax_kinds = generate_syntax_kinds(KINDS_SRC)?;
update(syntax_kinds_file.as_path(), &syntax_kinds, mode)?;
let ast_file = project_root().join(codegen::AST_NODES);
let ast = generate_ast(KINDS_SRC, AST_SRC)?;
update(ast_file.as_path(), &ast, mode)?;
let ast_nodes_file = project_root().join(codegen::AST_NODES);
let contents = generate_ast(KINDS_SRC, AST_SRC)?;
update(ast_nodes_file.as_path(), &contents, mode)?;
let ast_tokens_file = project_root().join(codegen::AST_TOKENS);
let contents = "//! Generated file, do not edit by hand, see `xtask/src/codegen`";
update(ast_tokens_file.as_path(), &contents, mode)?;
Ok(())
}