Update henceforth

This commit is contained in:
Dominic Grimm 2023-03-24 21:13:40 +01:00
parent d6f7a51e11
commit cdd5b8855a
Signed by: dergrimm
GPG key ID: 12EFFCAEA9E620BF
14 changed files with 683 additions and 314 deletions

383
Cargo.lock generated
View file

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
version = "0.17.0"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
dependencies = [
"gimli",
]
@ -19,13 +19,48 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "anyhow"
version = "1.0.65"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
dependencies = [
"backtrace",
]
[[package]]
name = "askama"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e"
dependencies = [
"askama_derive",
"askama_escape",
"humansize",
"num-traits",
"percent-encoding",
]
[[package]]
name = "askama_derive"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c22fbe0413545c098358e56966ff22cdd039e10215ae213cfbd65032b119fc94"
dependencies = [
"basic-toml",
"mime",
"mime_guess",
"nom",
"proc-macro2",
"quote",
"serde",
"syn 2.0.8",
]
[[package]]
name = "askama_escape"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
[[package]]
name = "atty"
version = "0.2.14"
@ -45,9 +80,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.66"
version = "0.3.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7"
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
dependencies = [
"addr2line",
"cc",
@ -58,6 +93,15 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "basic-toml"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1"
dependencies = [
"serde",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -66,18 +110,18 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
version = "0.10.3"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "cc"
version = "1.0.73"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-if"
@ -87,9 +131,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "3.2.22"
version = "3.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750"
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
dependencies = [
"atty",
"bitflags",
@ -112,7 +156,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -126,16 +170,15 @@ dependencies = [
[[package]]
name = "console"
version = "0.15.2"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c"
checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60"
dependencies = [
"encode_unicode",
"lazy_static",
"libc",
"terminal_size",
"unicode-width",
"winapi",
"windows-sys",
]
[[package]]
@ -159,9 +202,9 @@ dependencies = [
[[package]]
name = "digest"
version = "0.10.5"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer",
"crypto-common",
@ -169,9 +212,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "encode_unicode"
@ -191,9 +234,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.7"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
@ -202,9 +245,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.26.2"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
[[package]]
name = "hashbrown"
@ -214,9 +257,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "heck"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hence"
@ -227,7 +270,6 @@ dependencies = [
"console",
"itertools",
"parse_int",
"radix_fmt",
"rand",
"rhexdump",
"rust-embed",
@ -239,12 +281,14 @@ name = "henceforth"
version = "0.1.0"
dependencies = [
"anyhow",
"askama",
"clap",
"hence",
"indexmap",
"itertools",
"lazy_static",
"parse_int",
"snailquote",
]
[[package]]
@ -257,10 +301,19 @@ dependencies = [
]
[[package]]
name = "indexmap"
version = "1.9.1"
name = "humansize"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
dependencies = [
"libm",
]
[[package]]
name = "indexmap"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown",
@ -283,9 +336,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.135"
version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libm"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
[[package]]
name = "memchr"
@ -294,14 +353,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "miniz_oxide"
version = "0.5.4"
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
dependencies = [
"adler",
]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "num-traits"
version = "0.2.15"
@ -313,24 +404,24 @@ dependencies = [
[[package]]
name = "object"
version = "0.29.0"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.15.0"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "os_str_bytes"
version = "6.3.0"
version = "6.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267"
[[package]]
name = "parse_int"
@ -342,10 +433,16 @@ dependencies = [
]
[[package]]
name = "ppv-lite86"
version = "0.2.16"
name = "percent-encoding"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-error"
@ -356,7 +453,7 @@ dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"version_check",
]
@ -373,28 +470,22 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.47"
version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "radix_fmt"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426"
[[package]]
name = "rand"
version = "0.8.5"
@ -433,9 +524,9 @@ checksum = "c5e9af64574935e39f24d1c0313a997c8b880ca0e087c888bc6af8af31579847"
[[package]]
name = "rust-embed"
version = "6.4.1"
version = "6.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e26934cd67a1da1165efe61cba4047cc1b4a526019da609fcce13a1000afb5fa"
checksum = "cb133b9a38b5543fad3807fb2028ea47c5f2b566f4f5e28a11902f1a358348b6"
dependencies = [
"rust-embed-impl",
"rust-embed-utils",
@ -444,22 +535,22 @@ dependencies = [
[[package]]
name = "rust-embed-impl"
version = "6.3.0"
version = "6.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e35d7b402e273544cc08e0824aa3404333fab8a90ac43589d3d5b72f4b346e12"
checksum = "4d4e0f0ced47ded9a68374ac145edd65a6c1fa13a96447b873660b2a568a0fd7"
dependencies = [
"proc-macro2",
"quote",
"rust-embed-utils",
"syn",
"syn 1.0.109",
"walkdir",
]
[[package]]
name = "rust-embed-utils"
version = "7.3.0"
version = "7.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1669d81dfabd1b5f8e2856b8bbe146c6192b0ba22162edc738ac0a5de18f054"
checksum = "512b0ab6853f7e14e3c8754acb43d6f748bb9ced66aa5915a6553ac8213f7731"
dependencies = [
"sha2",
"walkdir",
@ -467,9 +558,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
version = "0.1.21"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b"
[[package]]
name = "same-file"
@ -480,6 +571,26 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "serde"
version = "1.0.158"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.158"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
]
[[package]]
name = "sha2"
version = "0.10.6"
@ -491,6 +602,16 @@ dependencies = [
"digest",
]
[[package]]
name = "snailquote"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec62a949bda7f15800481a711909f946e1204f2460f89210eaf7f57730f88f86"
dependencies = [
"thiserror",
"unicode_categories",
]
[[package]]
name = "strsim"
version = "0.10.0"
@ -499,9 +620,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.102"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9"
dependencies = [
"proc-macro2",
"quote",
@ -510,34 +642,44 @@ dependencies = [
[[package]]
name = "termcolor"
version = "1.1.3"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
dependencies = [
"winapi-util",
]
[[package]]
name = "terminal_size"
version = "0.1.17"
name = "textwrap"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]]
name = "thiserror"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
dependencies = [
"libc",
"winapi",
"thiserror-impl",
]
[[package]]
name = "textwrap"
version = "0.15.1"
name = "thiserror-impl"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
]
[[package]]
name = "typenum"
version = "1.15.0"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "unescape"
@ -546,10 +688,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e"
[[package]]
name = "unicode-ident"
version = "1.0.5"
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "unicode-width"
@ -557,6 +708,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "unicode_categories"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
[[package]]
name = "version_check"
version = "0.9.4"
@ -565,12 +722,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
version = "2.3.2"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
dependencies = [
"same-file",
"winapi",
"winapi-util",
]
@ -610,3 +766,60 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"

View file

@ -1,32 +1,24 @@
.include "$lib/core.asm"
.include "$lib/std.asm"
.include "$lib/main.asm"
.define MEM_LOOP_I, CORE_MEM_MEM
.define MEM_LOOP_J, (MEM_LOOP_I + 1)
.define MEM_CALL_STACK_LEN, 16
.define MEM_CALL_STACK_PTR, (MEM_LOOP_J + 1)
.define MEM_CALL_STACK_END, (MEM_CALL_STACK_PTR + MEM_CALL_STACK_LEN)
.define MEM_ALLOC_PTR, MEM_CALL_STACK_END
.macro stack_transfer_alu
.std_ld
tlr CORE_REG_B
.std_ld
tlr CORE_REG_A
.endmacro
.macro call_stack_jump, call_stack_jump_arg_0_label, call_stack_jump_arg_1_offset
.std_rset CORE_REG_C, call_stack_jump_arg_0_label
.std_rset CORE_REG_D, (call_stack_jump_arg_1_offset + 7)
ts call_stack_jump
tlr CORE_REG_PC
.endmacro
.macro return_call_stack_jump
.std_jump return_call_stack_jump
.endmacro
.std_rset CORE_REG_A, MEM_CALL_STACK_PTR
.std_set MEM_CALL_STACK_PTR
.std_rset CORE_REG_A, (MEM_ALLOC_PTR + 1)
.std_set MEM_ALLOC_PTR
.jump_main
call_stack_jump:
.std_get MEM_CALL_STACK_PTR
tlr CORE_REG_A
@ -35,12 +27,14 @@ tlr CORE_REG_A
tlr CORE_REG_A
tlr CORE_REG_B
.std_set MEM_CALL_STACK_PTR
tsr CORE_REG_D
tlr CORE_REG_A
tsr CORE_REG_B
set
tsr CORE_REG_C
tlr CORE_REG_PC
return_call_stack_jump:
.std_get MEM_CALL_STACK_PTR
tlr CORE_REG_A
@ -49,20 +43,92 @@ tlr CORE_REG_C
.std_alu CORE_ALU_SUB
tlr CORE_REG_A
.std_set MEM_CALL_STACK_PTR
tsr CORE_REG_C
get
tlr CORE_REG_PC
words_0:
; word: "test"
push 40
push 2
.stack_transfer_alu
.macro stack_transfer_alu
.std_ld
tlr CORE_REG_B
.std_ld
tlr CORE_REG_A
.endmacro
.macro call_stack_jump, call_stack_jump_arg_0_label, call_stack_jump_arg_1_offset
.std_rset CORE_REG_C, call_stack_jump_arg_0_label
.std_rset CORE_REG_D, (call_stack_jump_arg_1_offset + 7)
ts call_stack_jump
tlr CORE_REG_PC
.endmacro
.macro return_call_stack_jump
.std_jump return_call_stack_jump
.endmacro
; data
; strings
data_strings_0:
; original : "test\n"
; size : 5
.bytes 0x74
.bytes 0x65
.bytes 0x73
.bytes 0x74
.bytes 0x0a
data_strings_end_0:
data_strings_1:
; original : "jdsafhjfnjfn\n"
; size : 13
.bytes 0x6a
.bytes 0x64
.bytes 0x73
.bytes 0x61
.bytes 0x66
.bytes 0x68
.bytes 0x6a
.bytes 0x66
.bytes 0x6e
.bytes 0x6a
.bytes 0x66
.bytes 0x6e
.bytes 0x0a
data_strings_end_1:
; conditions
; words
; main
.def_main
ts NULL ; reset tmp
.std_rset CORE_REG_B, data_strings_0
loop_strings_0:
tsr CORE_REG_B
get
tlr CORE_REG_A
.std_set CORE_MEM_CHR
.std_rset CORE_REG_A, 1
.std_alu CORE_ALU_ADD
tls
.return_call_stack_jump
main:
.main main
.call_stack_jump words_0, OFFSET
dbg
.call_stack_jump words_0, OFFSET
tlr CORE_REG_B
.std_rset CORE_REG_A, data_strings_end_0
.std_alu CORE_ALU_GT
tlr CORE_REG_A
.std_cond_jump loop_strings_0
.std_rset CORE_REG_B, data_strings_1
loop_strings_1:
tsr CORE_REG_B
get
tlr CORE_REG_A
.std_set CORE_MEM_CHR
.std_rset CORE_REG_A, 1
.std_alu CORE_ALU_ADD
tlr CORE_REG_B
.std_rset CORE_REG_A, data_strings_end_1
.std_alu CORE_ALU_GT
tlr CORE_REG_A
.std_cond_jump loop_strings_1
.std_stop

View file

@ -1,3 +1,4 @@
: test 40 2 + ;
test debug test
." test\n"
." jdsafhjfnjfn\n"

View file

@ -11,7 +11,6 @@ repository = "https://git.dergrimm.net/dergrimm/hence.git"
itertools = "0.10.2"
clap = { version = "3.2.16", features = ["derive"] }
rhexdump = "0.1.1"
radix_fmt = "1"
rand = "0.8.5"
console = "0.15.1"
anyhow = { version = "1.0.62", features = ["backtrace"] }

View file

@ -1,6 +1,5 @@
use anyhow::{bail, Result};
use itertools::Itertools;
use radix_fmt::radix;
use rust_embed::RustEmbed;
use std::collections::{HashMap, HashSet};
use std::fs;
@ -119,33 +118,12 @@ impl Data {
let bytes = arg.resolve_bytes(self)?;
println!("{}", assembly);
let bin_num = radix(num, 2).to_string();
println!(
" => 0b{}{}",
"0000000000000000"[..16 - bin_num.len()].to_owned(),
bin_num
);
println!(" => 0b{:0>16b}", num);
println!(" => {}", num);
let hex_num = radix(num, 16).to_string();
println!(
" => 0x{}{}",
"0000"[..4 - hex_num.len()].to_owned(),
hex_num
);
println!(" => 0x{:0>4x}", num);
println!(
" => [{}]",
bytes
.iter()
.map(|n| {
let num = radix(*n, 16).to_string();
format!(
"0x{}{}",
"00".chars().take(2 - num.len()).collect::<String>(),
num
)
})
.join(", ")
bytes.iter().map(|n| format!("{:0>2x}", n)).join(" ")
);
}
@ -162,7 +140,7 @@ impl Data {
Ok(None)
}
"define_num_nl" => {
"define_num_no_lazy" => {
let name = match &args[0] {
arg::Arg::Variable(x) => x,
_ => {
@ -219,7 +197,6 @@ impl Data {
}
"if" => {
let cond = (args[0].resolve_number(self)? & 1) == 1;
dbg!(cond);
let mut if_depth: usize = 1;
let body: Vec<_> = self
@ -245,7 +222,6 @@ impl Data {
self.body_stack
.drain((self.body_stack.len() - body.len() - 1)..)
.for_each(drop);
dbg!(&body);
let mut iter = body.iter().enumerate();
if let Some(pos) = loop {
@ -360,7 +336,6 @@ impl Data {
}
);
}
// dbg!(&args);
for (i, arg) in args.iter().enumerate() {
self.constants.insert(m.args[i].clone(), arg.clone());
}
@ -382,10 +357,7 @@ impl Data {
.insert(offset_name.clone(), arg::Arg::Number(self.offset));
if let Some(x) = self.resolve_node()? {
if self.offset + (x.len() as u16) > 32 * 1024 {
bail!(
"Offset out of bounds: 0x{} > 0x8000",
radix(self.offset, 16)
);
bail!("Offset out of bounds: 0x{:0>4x} > 0x8000", self.offset);
}
for byte in x {
self.program[self.offset as usize] = byte;

View file

@ -1,6 +1,5 @@
use anyhow::{bail, Result};
use itertools::Itertools;
use radix_fmt::radix;
use std::cmp::Ordering;
use std::io::{self, Write};
use std::time::Instant;
@ -219,7 +218,7 @@ impl Emulator {
self.tmp = self.last_time.elapsed().as_millis() as u16;
self.last_time = time;
}
_ => bail!("Invalid ALU operation: 0x{}", radix(operation, 16)),
_ => bail!("Invalid ALU operation: 0x{:0>4x}", operation),
}
Ok(())
@ -289,7 +288,7 @@ impl Emulator {
0x0c => {
self.set_memory(self.tmp, self.reg_a)?;
}
_ => bail!("Invalid opcode: 0x{}", radix(self.reg_opc, 16)),
_ => bail!("Invalid opcode: 0x{:0>4x}", self.reg_opc),
}
Ok(())

View file

@ -48,7 +48,7 @@ fn main() -> Result<()> {
Commands::Lex { src } => {
let assembly = fs::read_to_string(src)?;
let tokens = lexer::lex(&assembly)?;
dbg!(tokens);
println!("{:#?}", tokens);
Ok(())
}
@ -56,7 +56,7 @@ fn main() -> Result<()> {
let assembly = fs::read_to_string(src)?;
let tokens = lexer::lex(&assembly)?;
let ast = parser::parse(tokens)?;
dbg!(ast);
println!("{:#?}", ast);
Ok(())
}

View file

@ -15,3 +15,5 @@ itertools = "0.10.2"
parse_int = "0.6.0"
indexmap = "1.9.1"
lazy_static = "1.4.0"
askama = "0.12.0"
snailquote = "0.3.1"

View file

@ -6,20 +6,21 @@ use std::collections::HashMap;
use crate::parser;
mod instruction;
pub mod instruction;
pub mod templates;
pub use instruction::Instruction;
pub const TEMPLATE_ASM: &str = include_str!("compiler/templates/default.asm");
// pub const TEMPLATE_ASM: &str = include_str!("compiler/templates/default.asm");
lazy_static! {
#[derive(Debug)]
pub static ref TEMPLATE: hence::parser::ast::Body = hence::parser::parse(
hence::lexer::lex(TEMPLATE_ASM).unwrap()
)
.unwrap()
.body;
}
// lazy_static! {
// #[derive(Debug)]
// pub static ref TEMPLATE: hence::parser::ast::Body = hence::parser::parse(
// hence::lexer::lex(TEMPLATE_ASM).unwrap()
// )
// .unwrap()
// .body;
// }
pub trait Compilable<T, U> {
fn compile(&self, data: &T) -> Result<U>;
@ -54,8 +55,6 @@ pub struct Compiler {
impl Compiler {
pub fn default() -> Self {
Self {
// words: HashMap::new(),
// conditions: IndexSet::new(),
strings: IndexSet::new(),
words: HashMap::new(),
conditions: vec![],
@ -123,22 +122,16 @@ impl Compiler {
);
}
parser::ast::Node::Condition { if_body, else_body } => {
// let if_instructions = self.generate_instructions(if_body, optimize)?;
// let else_instructions = self.generate_instructions(else_body, optimize)?;
// let id = self.conditions.len();
// let origin = self.callable_graph.add_node(CallableId::Condition(id));
// self.conditions.push(Condition {
// if_instructions: if_instructions.clone(),
// else_instructions: else_instructions.clone(),
// callable_graph_node: origin,
// });
// instructions.push(Instruction::Condition(id));
// self.add_graph_edges(origin, if_instructions)?;
// self.add_graph_edges(origin, else_instructions)?;
// dbg!(&self);
let if_instructions = self.generate_instructions(if_body, optimize)?;
let else_instructions = self.generate_instructions(else_body, optimize)?;
let id = self.conditions.len();
self.conditions.push(Condition {
if_instructions: if_instructions.clone(),
else_instructions: else_instructions.clone(),
});
instructions.push(Instruction::Condition(id));
}
parser::ast::Node::Word(x) => {
dbg!(&self.words, &x);
if let Some(ins) = Instruction::from_word(&x) {
instructions.push(ins);
} else if let Some(w) = self.words.get_mut(&x) {
@ -154,99 +147,156 @@ impl Compiler {
Ok(instructions)
}
pub fn embed(&self, body: hence::parser::ast::Body) -> Result<hence::parser::ast::Body> {
let mut x = TEMPLATE.to_vec();
pub fn embed(&self, body: hence::parser::ast::Body) -> Result<String> {
let strings = self
.strings
.iter()
.enumerate()
.map(|(id, s)| templates::IdLike {
id,
data: s.to_owned(),
})
.collect();
dbg!(&self.strings);
// for (id, s) in self.strings.iter().enumerate() {
// x.extend([
// hence::parser::ast::Node::Label(format!("data_strings_{}", id)),
// hence::parser::ast::Node::MacroCall {
// name: "bytes".to_string(),
// args: vec![hence::arg::Arg::String(s.to_string())],
// },
// hence::parser::ast::Node::Label(format!("data_strings_end_{}", id)),
// ]);
// }
// strings
for (id, s) in self.strings.iter().enumerate() {
x.extend([
hence::parser::ast::Node::Label(format!("data_strings_{}", id)),
hence::parser::ast::Node::MacroCall {
name: "bytes".to_string(),
args: vec![hence::arg::Arg::String(s.to_string())],
},
hence::parser::ast::Node::Label(format!("data_strings_end_{}", id)),
]);
}
// conditions
for (id, c) in self.conditions.iter().enumerate() {
x.push(hence::parser::ast::Node::Label(format!(
"conditions_if_{}",
id
)));
x.extend(
// for (id, c) in self.conditions.iter().enumerate() {
// x.push(hence::parser::ast::Node::Label(format!(
// "conditions_if_{}",
// id
// )));
// x.extend(
// c.if_instructions
// .iter()
// .map(|ins| ins.compile(self))
// .collect::<Result<Vec<_>>>()?
// .into_iter()
// .flatten(),
// );
// x.push(hence::parser::ast::Node::Label(format!(
// "conditions_else_{}",
// id
// )));
// x.extend(
// c.else_instructions
// .iter()
// .map(|ins| ins.compile(self))
// .collect::<Result<Vec<_>>>()?
// .into_iter()
// .flatten(),
// );
// }
let conditions = self
.conditions
.iter()
.enumerate()
.map(|(id, c)| {
Ok(templates::IdLike {
id,
data: (
c.if_instructions
.iter()
.map(|ins| ins.compile(self))
.collect::<Result<Vec<_>>>()?
.into_iter()
.flatten(),
);
x.push(hence::parser::ast::Node::Label(format!(
"conditions_else_{}",
id
)));
x.extend(
.flatten()
.collect(),
c.else_instructions
.iter()
.map(|ins| ins.compile(self))
.collect::<Result<Vec<_>>>()?
.into_iter()
.flatten(),
);
}
.flatten()
.collect(),
),
})
})
.collect::<Result<Vec<_>>>()?;
// words
for (name, word) in &self
// for (name, word) in &self
// .words
// .iter()
// .filter(|(_, w)| w.times_used > 1)
// .sorted_by(|a, b| Ord::cmp(&a.1.id, &b.1.id))
// .collect::<Vec<_>>()
// {
// x.extend(vec![
// hence::parser::ast::Node::Label(format!("words_{}", word.id)),
// hence::parser::ast::Node::Comment(format!("word: \"{}\"", name)),
// ]);
// x.extend(
// word.instructions
// .iter()
// .map(|ins| ins.compile(self))
// .collect::<Result<Vec<hence::parser::ast::Body>>>()
// .unwrap()
// .into_iter()
// .flatten(),
// );
// x.push(hence::parser::ast::Node::MacroCall {
// name: "return_call_stack_jump".to_string(),
// args: vec![],
// });
// }
let words = self
.words
.iter()
.filter(|(_, w)| w.times_used > 1)
.sorted_by(|a, b| Ord::cmp(&a.1.id, &b.1.id))
.collect::<Vec<_>>()
{
x.extend(vec![
hence::parser::ast::Node::Label(format!("words_{}", word.id)),
hence::parser::ast::Node::Comment(format!("word: \"{}\"", name)),
]);
x.extend(
word.instructions
.map(|(name, w)| {
Ok(templates::IdLike {
id: w.id,
data: (
name.to_owned(),
w.instructions
.iter()
.map(|ins| ins.compile(self))
.collect::<Result<Vec<hence::parser::ast::Body>>>()
.unwrap()
.collect::<Result<Vec<_>>>()?
.into_iter()
.flatten(),
);
x.push(hence::parser::ast::Node::MacroCall {
name: "return_call_stack_jump".to_string(),
args: vec![],
});
.flatten()
.collect(),
),
})
})
.collect::<Result<Vec<_>>>()?;
// x.extend([
// hence::parser::ast::Node::Label("main".to_string()),
// hence::parser::ast::Node::MacroCall {
// name: "main".to_string(),
// args: vec![hence::arg::Arg::Variable("main".to_string())],
// },
// ]);
// x.extend(body);
// x.push(hence::parser::ast::Node::MacroCall {
// name: "std_stop".to_string(),
// args: vec![],
// });
Ok(templates::DefaultTemplate {
strings,
conditions,
words,
main: body,
}
x.extend([
hence::parser::ast::Node::Label("main".to_string()),
hence::parser::ast::Node::MacroCall {
name: "main".to_string(),
args: vec![hence::arg::Arg::Variable("main".to_string())],
},
]);
x.extend(body);
x.push(hence::parser::ast::Node::MacroCall {
name: "std_stop".to_string(),
args: vec![],
});
Ok(x)
.to_string())
}
}
pub fn compile(ast: parser::ast::AST, optimize: bool) -> Result<hence::parser::ast::AST> {
pub fn compile(ast: parser::ast::AST, optimize: bool) -> Result<String> {
let mut data = Compiler::default();
let instructions = data.generate_instructions(ast.body, optimize)?;
Ok(hence::parser::ast::AST {
body: data.embed(
Ok(data.embed(
instructions
.iter()
.map(|ins| ins.compile(&data))
@ -254,6 +304,5 @@ pub fn compile(ast: parser::ast::AST, optimize: bool) -> Result<hence::parser::a
.into_iter()
.flatten()
.collect(),
)?,
})
)?)
}

View file

@ -1249,7 +1249,7 @@ impl compiler::Compilable<compiler::Compiler, hence::parser::ast::Body> for Inst
Instruction::AsmQuote(x) => Ok(hence::parser::parse(hence::lexer::lex(x)?)?.body),
// Instruction::Condition(x) => Ok(vec![]),
Instruction::Condition(x) => {
dbg!(x);
// dbg!(x);
Ok(vec![])
}

View file

@ -0,0 +1,16 @@
use askama::Template;
use hence::assembler::ToCode;
pub struct IdLike<T, U> {
pub id: T,
pub data: U,
}
#[derive(Template)]
#[template(path = "default.asm", escape = "none")]
pub struct DefaultTemplate {
pub strings: Vec<IdLike<usize, String>>,
pub conditions: Vec<IdLike<usize, (hence::parser::ast::Body, hence::parser::ast::Body)>>,
pub words: Vec<IdLike<usize, (String, hence::parser::ast::Body)>>,
pub main: hence::parser::ast::Body,
}

View file

@ -1,6 +1,5 @@
use anyhow::Result;
use clap::{Parser, Subcommand};
use hence::assembler::ToCode;
use std::fs;
use henceforth::*;
@ -64,8 +63,7 @@ fn main() -> Result<()> {
let source = fs::read_to_string(&src)?;
let tokens = lexer::lex(&source)?;
let ast = parser::parse(tokens)?;
let ast = compiler::compile(ast, optimize.unwrap_or(true))?;
let assembly = format!("{}\n", ast.to_code());
let assembly = format!("{}\n", compiler::compile(ast, optimize.unwrap_or(true))?);
if dump {
print!("{}", assembly);

View file

@ -36,7 +36,10 @@ pub fn parse(tokens: Vec<lexer::Token>) -> Result<ast::AST> {
body.push(ast::Node::Comment(x.trim().to_string()));
}
lexer::Token::StringLiteral { mode, string } => {
body.push(ast::Node::String { mode, string });
body.push(ast::Node::String {
mode,
string: snailquote::unescape(&format!("\"{}\"", string))?,
});
}
lexer::Token::Number(x) => body.push(ast::Node::Number(parse_int::parse(&x)?)),
lexer::Token::Word(x) => match x.as_str() {

View file

@ -1,3 +1,7 @@
{%- macro escape_name(name) -%}
{% if name.starts_with('"') %}{{ name }}{% else %}"{{ name }}"{% endif %}
{%- endmacro -%}
.include "$lib/core.asm"
.include "$lib/std.asm"
.include "$lib/main.asm"
@ -11,24 +15,6 @@
.define MEM_ALLOC_PTR, MEM_CALL_STACK_END
.macro stack_transfer_alu
.std_ld
tlr CORE_REG_B
.std_ld
tlr CORE_REG_A
.endmacro
.macro call_stack_jump, call_stack_jump_arg_0_label, call_stack_jump_arg_1_offset
.std_rset CORE_REG_C, call_stack_jump_arg_0_label
.std_rset CORE_REG_D, (call_stack_jump_arg_1_offset + 7)
ts call_stack_jump
tlr CORE_REG_PC
.endmacro
.macro return_call_stack_jump
.std_jump return_call_stack_jump
.endmacro
.std_rset CORE_REG_A, MEM_CALL_STACK_PTR
.std_set MEM_CALL_STACK_PTR
@ -65,3 +51,68 @@ return_call_stack_jump:
tsr CORE_REG_C
get
tlr CORE_REG_PC
.macro stack_transfer_alu
.std_ld
tlr CORE_REG_B
.std_ld
tlr CORE_REG_A
.endmacro
.macro call_stack_jump, call_stack_jump_arg_0_label, call_stack_jump_arg_1_offset
.std_rset CORE_REG_C, call_stack_jump_arg_0_label
.std_rset CORE_REG_D, (call_stack_jump_arg_1_offset + 7)
ts call_stack_jump
tlr CORE_REG_PC
.endmacro
.macro return_call_stack_jump
.std_jump return_call_stack_jump
.endmacro
; data
; strings
{%- for s in strings %}
{% let bytes = s.data.as_bytes() -%}
data_strings_{{ s.id }}:
{% let name = snailquote::escape(s.data) -%}
; original : {% call escape_name(name) %}
; size : {{ bytes.len() }}
{%- for byte in bytes %}
.bytes {{ "0x{:02x}"|format(byte) }}
{%- endfor %}
data_strings_end_{{ s.id }}:
{% endfor %}
; conditions
{%- for c in conditions %}
; condition: {{ c.id }}
conditions_if_{{ c.id }}:
{%- for ins in c.data.0 %}
{{ ins.to_code() }}
{%- endfor %}
conditions_else_{{ c.id }}:
{%- for ins in c.data.0 %}
{{ ins.to_code() }}
{%- endfor %}
{% endfor %}
; words
{%- for w in words %}
words_{{ w.id }}:
{% let name = snailquote::escape(w.data.0) -%}
; name : {% call escape_name(name) %}
{%- for node in w.data.1 %}
{{ node.to_code() }}
{%- endfor %}
.return_call_stack_jump
{% endfor %}
; main
.def_main
ts NULL ; reset tmp
{% for node in main %}
{{ node.to_code() }}
{%- endfor %}
.std_stop