Skip to content

Commit 0ce8f4b

Browse files
committed
Build parser without lalrpop binary
1 parent 3630cfa commit 0ce8f4b

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2021"
1111
[build-dependencies]
1212
tiny-keccak = { version = "2", features = ["sha3"] }
1313
phf_codegen = "0.10"
14-
lalrpop = { version = "0.19.8", optional = true }
14+
lalrpop = { version = "0.19.8" }
1515
anyhow = "1.0.45"
1616

1717
[dependencies]

parser/build.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,36 +70,12 @@ fn try_lalrpop(source: &str, target: &str) -> anyhow::Result<()> {
7070
return Ok(());
7171
}
7272

73-
#[cfg(feature = "lalrpop")]
74-
lalrpop_dependency();
75-
#[cfg(not(feature = "lalrpop"))]
76-
lalrpop_command(source)?;
73+
lalrpop();
7774

7875
Ok(())
7976
}
8077

81-
#[cfg(not(feature = "lalrpop"))]
82-
fn lalrpop_command(source: &str) -> anyhow::Result<()> {
83-
match std::process::Command::new("lalrpop").arg(source).status() {
84-
Ok(stat) if stat.success() => Ok(()),
85-
Ok(stat) => {
86-
eprintln!("failed to execute lalrpop; exited with {stat}");
87-
let exit_code = stat.code().map(|v| (v % 256) as u8).unwrap_or(1);
88-
Err(anyhow::anyhow!("lalrpop error status: {}", exit_code))
89-
}
90-
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
91-
eprintln!("please install lalrpop with `cargo install lalrpop` or\n`cargo build --manifest-path=parser/Cargo.toml --features=lalrpop`");
92-
Err(anyhow::anyhow!(
93-
"the lalrpop executable is not installed and parser/{} has been changed",
94-
source
95-
))
96-
}
97-
Err(e) => Err(anyhow::Error::new(e)),
98-
}
99-
}
100-
101-
#[cfg(feature = "lalrpop")]
102-
fn lalrpop_dependency() {
78+
fn lalrpop() {
10379
lalrpop::process_root().unwrap()
10480
}
10581

0 commit comments

Comments
 (0)