diff --git a/.cargo/config b/.cargo/config index ac7470c7e3..fd32471ea4 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,6 +1,6 @@ [alias] # Automatically generates the ast and syntax kinds files -gen-kinds = "run --package tools -- gen-kinds" +gen-syntax = "run --package tools -- gen-syntax" gen-tests = "run --package tools -- gen-tests" install-code = "run --package tools -- install-code" diff --git a/.travis.yml b/.travis.yml index 8d420f618c..6ffc1c89a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ matrix: - language: rust rust: beta script: - - cargo gen-kinds --verify + - cargo gen-syntax --verify - cargo gen-tests --verify - cargo test # - language: rust diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index b497cc5d7c..1efd1e054c 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -10,7 +10,7 @@ in the right place! Some of the components of this repository are generated through automatic processes. These are outlined below: -- `gen-kinds`: The kinds of tokens are reused in several places, so a generator +- `gen-syntax`: The kinds of tokens are reused in several places, so a generator is used. We use tera templates to generate the files listed below, based on the grammar described in [grammar.ron]: - [ast/generated.rs][ast generated] in `ra_syntax` based on @@ -43,7 +43,7 @@ notes. This is the thing that turns a flat list of events into a tree (see `EventProcessor`) - `ast` a type safe API on top of the raw `rowan` tree. - `grammar.ron` RON description of the grammar, which is used to - generate `syntax_kinds` and `ast` modules, using `cargo gen-kinds` command. + generate `syntax_kinds` and `ast` modules, using `cargo gen-syntax` command. - `algo`: generic tree algorithms, including `walk` for O(1) stack space tree traversal (this is cool) and `visit` for type-driven visiting the nodes (this is double plus cool, if you understand how @@ -106,7 +106,7 @@ A CLI interface to rust-analyzer. Custom Cargo tasks used to develop rust-analyzer: -- `cargo gen-kinds` -- generate `ast` and `syntax_kinds` +- `cargo gen-syntax` -- generate `ast` and `syntax_kinds` - `cargo gen-tests` -- collect inline tests from grammar - `cargo install-code` -- build and install VS Code extension and server diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index a15e001769..98c7de3614 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -1,4 +1,4 @@ -// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run +// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run // Do not edit manually #![cfg_attr(rustfmt, rustfmt_skip)] diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera index d2a281137e..e1404deac2 100644 --- a/crates/ra_syntax/src/ast/generated.rs.tera +++ b/crates/ra_syntax/src/ast/generated.rs.tera @@ -1,6 +1,6 @@ {# THIS File is not automatically generated: the below applies to the result of this template -#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run +#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run // Do not edit manually #![cfg_attr(rustfmt, rustfmt_skip)] diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index ea8063d3bb..0830e02f21 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -1,5 +1,5 @@ // Stores definitions which must be used in multiple places -// See `cargo gen-kinds` (defined in crates/tools/src/main.rs) +// See `cargo gen-syntax` (defined in crates/tools/src/main.rs) Grammar( single_byte_tokens: [ [";", "SEMI"], diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs index 11e9150bb3..58e2e9e9c0 100644 --- a/crates/ra_syntax/src/syntax_kinds/generated.rs +++ b/crates/ra_syntax/src/syntax_kinds/generated.rs @@ -1,4 +1,4 @@ -// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run +// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run // Do not edit manually #![allow(bad_style, missing_docs, unreachable_pub)] diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs.tera b/crates/ra_syntax/src/syntax_kinds/generated.rs.tera index 018564b8a7..c37e577022 100644 --- a/crates/ra_syntax/src/syntax_kinds/generated.rs.tera +++ b/crates/ra_syntax/src/syntax_kinds/generated.rs.tera @@ -1,6 +1,6 @@ {# THIS File is not automatically generated: the below applies to the result of this template -#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run +#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run // Do not edit manually #![allow(bad_style, missing_docs, unreachable_pub)] diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 965bc77296..152298014e 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs @@ -28,7 +28,7 @@ fn main() -> Result<()> { .help("Verify that generated code is up-to-date") .global(true), ) - .subcommand(SubCommand::with_name("gen-kinds")) + .subcommand(SubCommand::with_name("gen-syntax")) .subcommand(SubCommand::with_name("gen-tests")) .subcommand(SubCommand::with_name("install-code")) .get_matches(); @@ -40,7 +40,7 @@ fn main() -> Result<()> { match matches.subcommand() { ("install-code", _) => install_code_extension()?, ("gen-tests", _) => gen_tests(mode)?, - ("gen-kinds", _) => generate(Overwrite)?, + ("gen-syntax", _) => generate(Overwrite)?, _ => unreachable!(), } Ok(()) diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs index 0bb5d15d8e..5de52fc2b8 100644 --- a/crates/tools/tests/cli.rs +++ b/crates/tools/tests/cli.rs @@ -7,6 +7,6 @@ use tools::{ #[test] fn verify_template_generation() { if let Err(error) = generate(Verify) { - panic!("{}. Please update it by running `cargo gen-kinds`", error); + panic!("{}. Please update it by running `cargo gen-syntax`", error); } }