mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +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
@ -1,6 +1,6 @@
|
|||||||
[alias]
|
[alias]
|
||||||
# Automatically generates the ast and syntax kinds files
|
# 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"
|
gen-tests = "run --package tools -- gen-tests"
|
||||||
install-code = "run --package tools -- install-code"
|
install-code = "run --package tools -- install-code"
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ matrix:
|
|||||||
- language: rust
|
- language: rust
|
||||||
rust: beta
|
rust: beta
|
||||||
script:
|
script:
|
||||||
- cargo gen-kinds --verify
|
- cargo gen-syntax --verify
|
||||||
- cargo gen-tests --verify
|
- cargo gen-tests --verify
|
||||||
- cargo test
|
- cargo test
|
||||||
# - language: rust
|
# - language: rust
|
||||||
|
@ -10,7 +10,7 @@ in the right place!
|
|||||||
Some of the components of this repository are generated through automatic
|
Some of the components of this repository are generated through automatic
|
||||||
processes. These are outlined below:
|
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
|
is used. We use tera templates to generate the files listed below, based on
|
||||||
the grammar described in [grammar.ron]:
|
the grammar described in [grammar.ron]:
|
||||||
- [ast/generated.rs][ast generated] in `ra_syntax` based on
|
- [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`)
|
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.
|
- `ast` a type safe API on top of the raw `rowan` tree.
|
||||||
- `grammar.ron` RON description of the grammar, which is used to
|
- `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
|
- `algo`: generic tree algorithms, including `walk` for O(1) stack
|
||||||
space tree traversal (this is cool) and `visit` for type-driven
|
space tree traversal (this is cool) and `visit` for type-driven
|
||||||
visiting the nodes (this is double plus cool, if you understand how
|
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:
|
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 gen-tests` -- collect inline tests from grammar
|
||||||
- `cargo install-code` -- build and install VS Code extension and server
|
- `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
|
// Do not edit manually
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{# THIS File is not automatically generated:
|
{# THIS File is not automatically generated:
|
||||||
the below applies to the result of this template
|
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
|
// Do not edit manually
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Stores definitions which must be used in multiple places
|
// 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(
|
Grammar(
|
||||||
single_byte_tokens: [
|
single_byte_tokens: [
|
||||||
[";", "SEMI"],
|
[";", "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
|
// Do not edit manually
|
||||||
|
|
||||||
#![allow(bad_style, missing_docs, unreachable_pub)]
|
#![allow(bad_style, missing_docs, unreachable_pub)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{# THIS File is not automatically generated:
|
{# THIS File is not automatically generated:
|
||||||
the below applies to the result of this template
|
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
|
// Do not edit manually
|
||||||
|
|
||||||
#![allow(bad_style, missing_docs, unreachable_pub)]
|
#![allow(bad_style, missing_docs, unreachable_pub)]
|
||||||
|
@ -28,7 +28,7 @@ fn main() -> Result<()> {
|
|||||||
.help("Verify that generated code is up-to-date")
|
.help("Verify that generated code is up-to-date")
|
||||||
.global(true),
|
.global(true),
|
||||||
)
|
)
|
||||||
.subcommand(SubCommand::with_name("gen-kinds"))
|
.subcommand(SubCommand::with_name("gen-syntax"))
|
||||||
.subcommand(SubCommand::with_name("gen-tests"))
|
.subcommand(SubCommand::with_name("gen-tests"))
|
||||||
.subcommand(SubCommand::with_name("install-code"))
|
.subcommand(SubCommand::with_name("install-code"))
|
||||||
.get_matches();
|
.get_matches();
|
||||||
@ -40,7 +40,7 @@ fn main() -> Result<()> {
|
|||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
("install-code", _) => install_code_extension()?,
|
("install-code", _) => install_code_extension()?,
|
||||||
("gen-tests", _) => gen_tests(mode)?,
|
("gen-tests", _) => gen_tests(mode)?,
|
||||||
("gen-kinds", _) => generate(Overwrite)?,
|
("gen-syntax", _) => generate(Overwrite)?,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -7,6 +7,6 @@ use tools::{
|
|||||||
#[test]
|
#[test]
|
||||||
fn verify_template_generation() {
|
fn verify_template_generation() {
|
||||||
if let Err(error) = generate(Verify) {
|
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 New Issue
Block a user