Files
codeql/rust/ast-generator
Paolo Tranquilli 290a1043b1 Rust: fetch ungram and rust-analyzer code instead of checking it in
* The ungram file is now taken from the rust-analyzer dependencies
  pulled in by bazel
* the grammar parsing code is not published, so it must be taken
  directly from rust-analyzer code. That part should be less prone to be
  updated than the ungram file, so it does not necessarily need to be
  in sync with the rust-analyzer version is used elsewhere.
* both need some patches. The former is patched during build, the latter
  during loading in `MODULE.bazel`.
2024-12-18 16:37:24 +01:00
..

This crate takes care of generating ast.py in the schema and translate/generate.rs in the extractor.

It uses:

  • rust.ungram from ra_ap_syntax
  • a couple of slightly modified sources from rust-analyzer that are not published.

Both are fetched by bazel while building. In order to have proper IDE support and being able to run cargo tooling in this crate, you can run

bazel run //rust/ast-generator:inject_sources

which will create the missing sources. Be aware that bazel will still use the source taken directly from rust-analyzer, not the one in your working copy. Those should not need to be update often though.