mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #137
137: rename gen-kinds to gen-syntax r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
2a704035f4
10 changed files with 13 additions and 13 deletions
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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(())
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue