Skip to content

Commit a59a34d

Browse files
Significant cleanup of CLI interface
- Switched to structopt, built off of clap - Added `--log` and `--log-format` for `tracing-subscriber` - Moved `int lex` to a more general `unpretty` a la Rust's -Zunpretty= - Remove expr_parser in favour of a (soon to be completed) unpretty AST backend - Add `codespan_reporting::files::Files` to `calypso_diagnostic`'s prelude - Fix description in main Cargo.toml (woops how did I never notice I never changed that) - Generally appease clippy - Fix pre-commit hook as I accidentally made a fatal `cargo check` not exit with a non-zero code when it should
1 parent 8abd877 commit a59a34d

File tree

16 files changed

+432
-410
lines changed

16 files changed

+432
-410
lines changed

.etc/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def main():
88
res = subprocess.run(["cargo", "check", "--workspace", "--all-features", "--all-targets"])
99
if res.returncode != 0:
1010
print("Failure while building code.\nCommit aborted.")
11-
return
11+
sys.exit(-1)
1212

1313
print("Running `cargo test --workspace --all-features`...")
1414
res = subprocess.run(["cargo", "test", "--workspace", "--all-features"])

Cargo.lock

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ dependencies = [
136136
"calypso_filety",
137137
"calypso_parsing",
138138
"calypso_repl",
139-
"clap",
140139
"mimalloc",
141140
"once_cell",
142141
"saturnvm",
142+
"structopt",
143143
"tracing-subscriber",
144144
"vergen",
145145
]
@@ -282,7 +282,6 @@ dependencies = [
282282
"textwrap",
283283
"unicode-width",
284284
"vec_map",
285-
"yaml-rust",
286285
]
287286

288287
[[package]]
@@ -493,6 +492,15 @@ dependencies = [
493492
"ahash",
494493
]
495494

495+
[[package]]
496+
name = "heck"
497+
version = "0.3.3"
498+
source = "registry+https://github.com/rust-lang/crates.io-index"
499+
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
500+
dependencies = [
501+
"unicode-segmentation",
502+
]
503+
496504
[[package]]
497505
name = "hermit-abi"
498506
version = "0.1.18"
@@ -1171,6 +1179,30 @@ version = "0.8.0"
11711179
source = "registry+https://github.com/rust-lang/crates.io-index"
11721180
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
11731181

1182+
[[package]]
1183+
name = "structopt"
1184+
version = "0.3.22"
1185+
source = "registry+https://github.com/rust-lang/crates.io-index"
1186+
checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71"
1187+
dependencies = [
1188+
"clap",
1189+
"lazy_static",
1190+
"structopt-derive",
1191+
]
1192+
1193+
[[package]]
1194+
name = "structopt-derive"
1195+
version = "0.4.15"
1196+
source = "registry+https://github.com/rust-lang/crates.io-index"
1197+
checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10"
1198+
dependencies = [
1199+
"heck",
1200+
"proc-macro-error",
1201+
"proc-macro2",
1202+
"quote",
1203+
"syn",
1204+
]
1205+
11741206
[[package]]
11751207
name = "syn"
11761208
version = "1.0.73"
@@ -1493,9 +1525,3 @@ name = "wyz"
14931525
version = "0.2.0"
14941526
source = "registry+https://github.com/rust-lang/crates.io-index"
14951527
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
1496-
1497-
[[package]]
1498-
name = "yaml-rust"
1499-
version = "0.3.5"
1500-
source = "registry+https://github.com/rust-lang/crates.io-index"
1501-
checksum = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992"

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "calypso"
33
version = "0.1.0"
44
authors = ["ThePuzzlemaker <[email protected]>"]
55
edition = "2018"
6-
description = "A (very work-in-progress) general-purpose interpreted language with built-in systems for cryptography, ciphers, and encodings, implemented with Rust."
6+
description = "Calypso is a mostly imperative language with some functional influences that is focused on flexibility and simplicity."
77
readme = "README.md"
88
homepage = "https://github.com/calypso-lang/calypso/"
99
repository = "https://github.com/calypso-lang/calypso/"
@@ -13,7 +13,6 @@ categories = ["development-tools", "parser-implementations"]
1313
build = "build.rs"
1414

1515
[dependencies]
16-
clap = { version = "2.33.3", features = ["yaml"] }
1716
mimalloc = { version = "0.1.26", optional = true }
1817
calypso_parsing = { path = "libs/calypso_parsing", version = "0.1.0" }
1918
calypso_diagnostic = { path = "libs/calypso_diagnostic", version = "0.1.0" }
@@ -24,6 +23,7 @@ tracing-subscriber = { version = "0.2.19", features = ["parking_lot"] }
2423
once_cell = "1.8.0"
2524
calypso_common = { path = "libs/calypso_common", version = "0.1.0" }
2625
calypso_filety = { path = "libs/calypso_filety", version = "2.0.0" }
26+
structopt = "0.3.22"
2727

2828
[features]
2929
default = ["mimalloc", "mimalloc/secure"]

libs/calypso_diagnostic/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ pub mod prelude {
1717
pub use super::diagnostic::{self, EnsembleBuilder, LabelStyle};
1818
pub use super::err;
1919
pub use super::error::DiagnosticError;
20+
pub use super::reporting::files::Files;
2021
}

libs/calypso_diagnostic/src/messages/E0001.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

libs/calypso_diagnostic/src/messages/E0002.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

libs/calypso_parsing/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,3 @@ itertools = "0.10.1"
2424

2525
[build-dependencies]
2626
lalrpop = "0.19.5"
27-
28-
[[example]]
29-
name = "expr_parser"
30-
path = "examples/expr_parser.rs"

libs/calypso_parsing/examples/expr_parser.rs

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)