Skip to content

Commit da91ea4

Browse files
mattsseseanyoung
authored andcommitted
unify parser code
Signed-off-by: Matthias Seitz <matthias.seitz@outlook.de>
1 parent c79f10b commit da91ea4

13 files changed

+8
-3339
lines changed

Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ keywords = [ "solidity", "compiler", "solana", "substrate", "ewasm" ]
1111
edition = "2021"
1212

1313
[build-dependencies]
14-
lalrpop = "0.19"
1514
cc = "1.0"
1615

1716
[dependencies]
18-
lalrpop-util = "0.19"
1917
regex = "1"
2018
num-bigint = "0.4"
2119
num-traits = "0.2"
@@ -30,8 +28,6 @@ serde = "1.0"
3028
serde_derive = { version = "1.0" }
3129
inkwell = { version = "^0.1.0-beta.3", features = ["target-webassembly", "target-bpf", "no-libffi-linking", "llvm13-0"], optional = true }
3230
blake2-rfc = "0.2.18"
33-
phf = { version = "0.10", features = ["macros"] }
34-
unicode-xid = "0.2.0"
3531
handlebars = "4.1"
3632
contract-metadata = "0.3.0"
3733
semver = { version = "^1.0.3", features = ["serde"] }
@@ -47,6 +43,7 @@ funty = "=1.1.0"
4743
itertools = "0.10"
4844
num-rational = "0.4"
4945
indexmap = "1.7"
46+
solang-parser = { path = "solang-parser", version = "0.1" }
5047

5148
[dev-dependencies]
5249
parity-scale-codec-derive = "2.0.0"

build.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
use std::process::Command;
22

33
fn main() {
4-
lalrpop::Configuration::new()
5-
.use_cargo_dir_conventions()
6-
.emit_rerun_directives(true)
7-
.process()
8-
.unwrap();
9-
104
#[cfg(feature = "llvm")]
115
{
126
// compile our linker

solang-parser/build.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
21
fn main() {
32
lalrpop::Configuration::new()
43
.use_cargo_dir_conventions()
54
.emit_rerun_directives(true)
65
.process()
76
.unwrap();
8-
}
7+
}

solang-parser/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,4 @@ impl Diagnostic {
161161
notes,
162162
}
163163
}
164-
}
164+
}

solang-parser/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Solidity file parser
22
3+
pub mod diagnostics;
34
mod doc;
45
pub mod lexer;
56
pub mod pt;
6-
pub mod diagnostics;
77
pub use diagnostics::Diagnostic;
88

99
#[allow(clippy::all)]
@@ -56,7 +56,6 @@ pub fn parse(src: &str, file_no: usize) -> Result<pt::SourceUnit, Vec<Diagnostic
5656
}
5757
}
5858

59-
6059
pub fn box_option<T>(o: Option<T>) -> Option<Box<T>> {
6160
o.map(Box::new)
6261
}
@@ -171,4 +170,4 @@ mod test {
171170

172171
assert_eq!(e, a);
173172
}
174-
}
173+
}

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ pub mod emit;
55
pub mod file_resolver;
66
#[cfg(feature = "llvm")]
77
pub mod linker;
8-
pub mod parser;
9-
8+
pub use solang_parser as parser;
109
// In Sema, we use result unit for returning early
1110
// when code-misparses. The error will be added to the namespace diagnostics, no need to have anything but unit
1211
// as error.

src/parser/doc.rs

-77
This file was deleted.

0 commit comments

Comments
 (0)