mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: make things compile
This commit is contained in:
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -684,6 +684,9 @@ checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a"
|
||||
name = "generate-schema"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"itertools 0.10.5",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"ungrammar",
|
||||
]
|
||||
|
||||
@@ -856,6 +859,15 @@ version = "1.70.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.12.1"
|
||||
|
||||
17
rust/generate-schema/src/codegen.rs
Normal file
17
rust/generate-schema/src/codegen.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
pub mod grammar;
|
||||
|
||||
pub fn reformat(x: String) -> String {
|
||||
x
|
||||
}
|
||||
|
||||
pub fn add_preamble(_x: crate::flags::CodegenType, y: String) -> String {
|
||||
y
|
||||
}
|
||||
pub fn ensure_file_contents(
|
||||
_x: crate::flags::CodegenType,
|
||||
path: &std::path::Path,
|
||||
contents: &String,
|
||||
_check: bool,
|
||||
) {
|
||||
std::fs::write(path, contents).expect("Unable to write file");
|
||||
}
|
||||
11
rust/generate-schema/src/flags.rs
Normal file
11
rust/generate-schema/src/flags.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
pub enum CodegenType {
|
||||
Grammar,
|
||||
}
|
||||
|
||||
impl Display for CodegenType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Grammar")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
mod codegen;
|
||||
mod flags;
|
||||
use std::env;
|
||||
|
||||
fn project_root() -> PathBuf {
|
||||
let dir =
|
||||
env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| env!("CARGO_MANIFEST_DIR").to_owned());
|
||||
PathBuf::from(dir).parent().unwrap().to_owned()
|
||||
}
|
||||
fn main() {}
|
||||
|
||||
Reference in New Issue
Block a user