mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
remove generated lalrpop result from repository
This commit is contained in:
1 parent
78c0f7b7a9
commit
c3cab9e8cc
6 files changed
+22
-46869
No files matched your search
@@ -1,6 +1,5 @@
|
||||
Lib/** linguist-vendored
|
||||
Cargo.lock linguist-generated -merge
|
||||
parser/src/python.rs linguist-generated -diff -merge
|
||||
ast/src/ast_gen.rs linguist-generated -merge
|
||||
vm/src/stdlib/ast/gen.rs linguist-generated -merge
|
||||
parser/python.lalrpop text eol=LF
|
||||
|
||||
@@ -19,3 +19,5 @@ flamescope.json
|
||||
|
||||
extra_tests/snippets/resources
|
||||
extra_tests/not_impl.py
|
||||
|
||||
parser/python.rs
|
||||
+17
-5
@@ -6,18 +6,27 @@ use std::process::{Command, ExitCode};
|
||||
use tiny_keccak::{Hasher, Sha3};
|
||||
|
||||
fn main() -> ExitCode {
|
||||
if let Err(exit_code) = check_lalrpop("src/python.lalrpop", "src/python.rs") {
|
||||
const SOURCE: &str = "python.lalrpop";
|
||||
const TARGET: &str = "python.rs";
|
||||
|
||||
println!("cargo:rerun-if-changed={SOURCE}");
|
||||
|
||||
if let Err(exit_code) = try_lalrpop(SOURCE, TARGET) {
|
||||
return exit_code;
|
||||
}
|
||||
gen_phf();
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
||||
fn check_lalrpop(source: &str, generated: &str) -> Result<(), ExitCode> {
|
||||
println!("cargo:rerun-if-changed={source}");
|
||||
fn requires_lalrpop(source: &str, target: &str) -> bool {
|
||||
let target = if let Ok(target) = File::open(target) {
|
||||
target
|
||||
} else {
|
||||
return true;
|
||||
};
|
||||
|
||||
let sha_prefix = "// sha3: ";
|
||||
let sha3_line = BufReader::with_capacity(128, File::open(generated).unwrap())
|
||||
let sha3_line = BufReader::with_capacity(128, target)
|
||||
.lines()
|
||||
.find_map(|line| {
|
||||
let line = line.unwrap();
|
||||
@@ -45,8 +54,11 @@ fn check_lalrpop(source: &str, generated: &str) -> Result<(), ExitCode> {
|
||||
hasher.finalize(&mut hash);
|
||||
hash
|
||||
};
|
||||
!sha_equal(expected_sha3_str, &actual_sha3)
|
||||
}
|
||||
|
||||
if sha_equal(expected_sha3_str, &actual_sha3) {
|
||||
fn try_lalrpop(source: &str, target: &str) -> Result<(), ExitCode> {
|
||||
if !requires_lalrpop(source, target) {
|
||||
return Ok(());
|
||||
}
|
||||
match Command::new("lalrpop").arg(source).status() {
|
||||
|
||||
File renamed without changes.
@@ -28,8 +28,6 @@ mod function;
|
||||
pub mod lexer;
|
||||
pub mod mode;
|
||||
pub mod parser;
|
||||
#[allow(clippy::all)]
|
||||
#[allow(unused)]
|
||||
#[rustfmt::skip]
|
||||
mod python;
|
||||
pub mod token;
|
||||
+3
-46861
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user