use nac3core

This commit is contained in:
Sebastien Bourdeauducq 2024-09-06 12:14:13 +08:00
parent f6cf631a68
commit aa64afe955
5 changed files with 256 additions and 63 deletions

257
Cargo.lock generated
View File

@ -301,7 +301,7 @@ dependencies = [
"futures-lite 2.3.0",
"parking",
"polling 3.7.3",
"rustix 0.38.35",
"rustix 0.38.36",
"slab",
"tracing",
"windows-sys 0.59.0",
@ -346,7 +346,7 @@ dependencies = [
"cfg-if",
"event-listener 3.1.0",
"futures-lite 1.13.0",
"rustix 0.38.35",
"rustix 0.38.36",
"windows-sys 0.48.0",
]
@ -373,7 +373,7 @@ dependencies = [
"cfg-if",
"futures-core",
"futures-io",
"rustix 0.38.35",
"rustix 0.38.36",
"signal-hook-registry",
"slab",
"windows-sys 0.59.0",
@ -581,9 +581,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bytemuck"
version = "1.17.1"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2"
checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
dependencies = [
"bytemuck_derive",
]
@ -626,7 +626,7 @@ dependencies = [
"bitflags 2.6.0",
"log",
"polling 3.7.3",
"rustix 0.38.35",
"rustix 0.38.36",
"slab",
"thiserror",
]
@ -640,7 +640,7 @@ dependencies = [
"bitflags 2.6.0",
"log",
"polling 3.7.3",
"rustix 0.38.35",
"rustix 0.38.36",
"slab",
"thiserror",
]
@ -652,7 +652,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02"
dependencies = [
"calloop 0.12.4",
"rustix 0.38.35",
"rustix 0.38.36",
"wayland-backend",
"wayland-client",
]
@ -664,7 +664,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
dependencies = [
"calloop 0.13.0",
"rustix 0.38.35",
"rustix 0.38.36",
"wayland-backend",
"wayland-client",
]
@ -686,7 +686,7 @@ version = "0.1.0"
dependencies = [
"eframe",
"egui_extras",
"nac3parser",
"nac3core",
]
[[package]]
@ -843,6 +843,56 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-queue"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
@ -1611,6 +1661,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.3.9"
@ -1687,6 +1743,31 @@ dependencies = [
"hashbrown",
]
[[package]]
name = "inkwell"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b597a7b2cdf279aeef6d7149071e35e4bc87c2cf05a5b7f2d731300bffe587ea"
dependencies = [
"either",
"inkwell_internals",
"libc",
"llvm-sys",
"once_cell",
"thiserror",
]
[[package]]
name = "inkwell_internals"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fa4d8d74483041a882adaa9a29f633253a66dde85055f0495c121620ac484b2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.77",
]
[[package]]
name = "instant"
version = "0.1.13"
@ -1716,6 +1797,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.11"
@ -1788,7 +1878,7 @@ dependencies = [
"ascii-canvas",
"bit-set",
"ena",
"itertools",
"itertools 0.11.0",
"lalrpop-util",
"petgraph",
"pico-args",
@ -1887,6 +1977,19 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
[[package]]
name = "llvm-sys"
version = "140.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3dc78e9857c0231ec11e3bdccf63870493fdc7d0570b0ea7d50bf5df0cb1a0c"
dependencies = [
"cc",
"lazy_static",
"libc",
"regex",
"semver",
]
[[package]]
name = "lock_api"
version = "0.4.12"
@ -1998,7 +2101,7 @@ dependencies = [
[[package]]
name = "nac3ast"
version = "0.1.0"
source = "git+https://git.m-labs.hk/M-Labs/nac3?rev=bd06155f348ecb421ad88fca65405f3a49408570#bd06155f348ecb421ad88fca65405f3a49408570"
source = "git+https://git.m-labs.hk/M-Labs/nac3?rev=6098b1b853d759de6a2980220faa217c25a2fb2b#6098b1b853d759de6a2980220faa217c25a2fb2b"
dependencies = [
"fxhash",
"lazy_static",
@ -2006,10 +2109,27 @@ dependencies = [
"string-interner",
]
[[package]]
name = "nac3core"
version = "0.1.0"
source = "git+https://git.m-labs.hk/M-Labs/nac3?rev=6098b1b853d759de6a2980220faa217c25a2fb2b#6098b1b853d759de6a2980220faa217c25a2fb2b"
dependencies = [
"crossbeam",
"indexmap",
"inkwell",
"itertools 0.13.0",
"nac3parser",
"parking_lot",
"rayon",
"regex",
"strum",
"strum_macros",
]
[[package]]
name = "nac3parser"
version = "0.1.2"
source = "git+https://git.m-labs.hk/M-Labs/nac3?rev=bd06155f348ecb421ad88fca65405f3a49408570#bd06155f348ecb421ad88fca65405f3a49408570"
source = "git+https://git.m-labs.hk/M-Labs/nac3?rev=6098b1b853d759de6a2980220faa217c25a2fb2b#6098b1b853d759de6a2980220faa217c25a2fb2b"
dependencies = [
"ahash",
"lalrpop",
@ -2517,7 +2637,7 @@ dependencies = [
"concurrent-queue",
"hermit-abi 0.4.0",
"pin-project-lite",
"rustix 0.38.35",
"rustix 0.38.36",
"tracing",
"windows-sys 0.59.0",
]
@ -2594,9 +2714,9 @@ dependencies = [
[[package]]
name = "quick-xml"
version = "0.34.0"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f24d770aeca0eacb81ac29dfbc55ebcc09312fdd1f8bbecdc7e4a84e000e3b4"
checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc"
dependencies = [
"memchr",
]
@ -2652,6 +2772,26 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
[[package]]
name = "rayon"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
@ -2747,9 +2887,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.35"
version = "0.38.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f"
checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36"
dependencies = [
"bitflags 2.6.0",
"errno",
@ -2804,6 +2944,12 @@ dependencies = [
"tiny-skia",
]
[[package]]
name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
version = "1.0.209"
@ -2826,9 +2972,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.127"
version = "1.0.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
dependencies = [
"itoa",
"memchr",
@ -2922,7 +3068,7 @@ dependencies = [
"libc",
"log",
"memmap2",
"rustix 0.38.35",
"rustix 0.38.36",
"thiserror",
"wayland-backend",
"wayland-client",
@ -2947,14 +3093,14 @@ dependencies = [
"libc",
"log",
"memmap2",
"rustix 0.38.35",
"rustix 0.38.36",
"thiserror",
"wayland-backend",
"wayland-client",
"wayland-csd-frame",
"wayland-cursor",
"wayland-protocols 0.32.3",
"wayland-protocols-wlr 0.3.3",
"wayland-protocols 0.32.4",
"wayland-protocols-wlr 0.3.4",
"wayland-scanner",
"xkeysym",
]
@ -3034,6 +3180,25 @@ dependencies = [
"precomputed-hash",
]
[[package]]
name = "strum"
version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
[[package]]
name = "strum_macros"
version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
dependencies = [
"heck",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.77",
]
[[package]]
name = "syn"
version = "1.0.109"
@ -3087,7 +3252,7 @@ dependencies = [
"cfg-if",
"fastrand 2.1.1",
"once_cell",
"rustix 0.38.35",
"rustix 0.38.36",
"windows-sys 0.59.0",
]
@ -3532,13 +3697,13 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "wayland-backend"
version = "0.3.6"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90e11ce2ca99c97b940ee83edbae9da2d56a08f9ea8158550fd77fa31722993"
checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6"
dependencies = [
"cc",
"downcast-rs",
"rustix 0.38.35",
"rustix 0.38.36",
"scoped-tls",
"smallvec",
"wayland-sys",
@ -3546,12 +3711,12 @@ dependencies = [
[[package]]
name = "wayland-client"
version = "0.31.5"
version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e321577a0a165911bdcfb39cf029302479d7527b517ee58ab0f6ad09edf0943"
checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d"
dependencies = [
"bitflags 2.6.0",
"rustix 0.38.35",
"rustix 0.38.36",
"wayland-backend",
"wayland-scanner",
]
@ -3569,11 +3734,11 @@ dependencies = [
[[package]]
name = "wayland-cursor"
version = "0.31.5"
version = "0.31.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ef9489a8df197ebf3a8ce8a7a7f0a2320035c3743f3c1bd0bdbccf07ce64f95"
checksum = "3a94697e66e76c85923b0d28a0c251e8f0666f58fc47d316c0f4da6da75d37cb"
dependencies = [
"rustix 0.38.35",
"rustix 0.38.36",
"wayland-client",
"xcursor",
]
@ -3592,9 +3757,9 @@ dependencies = [
[[package]]
name = "wayland-protocols"
version = "0.32.3"
version = "0.32.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62989625a776e827cc0f15d41444a3cea5205b963c3a25be48ae1b52d6b4daaa"
checksum = "2b5755d77ae9040bb872a25026555ce4cb0ae75fd923e90d25fba07d81057de0"
dependencies = [
"bitflags 2.6.0",
"wayland-backend",
@ -3630,33 +3795,33 @@ dependencies = [
[[package]]
name = "wayland-protocols-wlr"
version = "0.3.3"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd993de54a40a40fbe5601d9f1fbcaef0aebcc5fda447d7dc8f6dcbaae4f8953"
checksum = "dad87b5fd1b1d3ca2f792df8f686a2a11e3fe1077b71096f7a175ab699f89109"
dependencies = [
"bitflags 2.6.0",
"wayland-backend",
"wayland-client",
"wayland-protocols 0.32.3",
"wayland-protocols 0.32.4",
"wayland-scanner",
]
[[package]]
name = "wayland-scanner"
version = "0.31.4"
version = "0.31.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7b56f89937f1cf2ee1f1259cf2936a17a1f45d8f0aa1019fae6d470d304cfa6"
checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3"
dependencies = [
"proc-macro2",
"quick-xml 0.34.0",
"quick-xml 0.36.1",
"quote",
]
[[package]]
name = "wayland-sys"
version = "0.31.4"
version = "0.31.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43676fe2daf68754ecf1d72026e4e6c15483198b5d24e888b74d3f22f887a148"
checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09"
dependencies = [
"dlib",
"log",
@ -4139,7 +4304,7 @@ dependencies = [
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.2",
"redox_syscall 0.3.5",
"rustix 0.38.35",
"rustix 0.38.36",
"sctk-adwaita",
"smithay-client-toolkit 0.18.1",
"smol_str",
@ -4198,7 +4363,7 @@ dependencies = [
"libc",
"libloading 0.8.5",
"once_cell",
"rustix 0.38.35",
"rustix 0.38.36",
"x11rb-protocol",
]

View File

@ -3,12 +3,10 @@ name = "cells"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
eframe = "0.28"
egui_extras = { version = "0.28", features = ["syntect"]}
[dependencies.nac3parser]
[dependencies.nac3core]
git = "https://git.m-labs.hk/M-Labs/nac3"
rev = "bd06155f348ecb421ad88fca65405f3a49408570"
rev = "6098b1b853d759de6a2980220faa217c25a2fb2b"

View File

@ -1,24 +1,42 @@
{
"nodes": {
"nac3": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1725593528,
"narHash": "sha256-pUgwm4mgbXNh5QtkJ9+Fr55dKf3uRSpKeFwlvZz1OkQ=",
"ref": "refs/heads/master",
"rev": "6098b1b853d759de6a2980220faa217c25a2fb2b",
"revCount": 1329,
"type": "git",
"url": "https://git.m-labs.hk/m-labs/nac3.git"
},
"original": {
"type": "git",
"url": "https://git.m-labs.hk/m-labs/nac3.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725001927,
"narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=",
"owner": "nixos",
"lastModified": 1725432240,
"narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"rev": "ad416d066ca1222956472ab7d0555a6946746a80",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"nac3": "nac3"
}
}
},

View File

@ -1,18 +1,28 @@
{
description = "Cells";
inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
inputs.nac3 = { type = "git"; url = "https://git.m-labs.hk/m-labs/nac3.git"; };
outputs = { self, nixpkgs }:
outputs = { self, nac3 }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
pkgs = import nac3.inputs.nixpkgs { system = "x86_64-linux"; };
libraryPath = pkgs.lib.makeLibraryPath [ pkgs.wayland pkgs.libxkbcommon pkgs.libGL ];
in {
packages.x86_64-linux.default = pkgs.rustPlatform.buildRustPackage {
name = "cells";
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = [ pkgs.makeWrapper ];
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"nac3ast-0.1.0" = "sha256-pUgwm4mgbXNh5QtkJ9+Fr55dKf3uRSpKeFwlvZz1OkQ=";
};
};
nativeBuildInputs = [
nac3.packages.x86_64-linux.llvm-nac3
nac3.packages.x86_64-linux.llvm-tools-irrt
pkgs.makeWrapper
];
buildInputs = [ nac3.packages.x86_64-linux.llvm-nac3 ];
postFixup = "wrapProgram $out/bin/cells --set LD_LIBRARY_PATH ${libraryPath}";
};
devShells.x86_64-linux.default = pkgs.mkShell {
@ -20,6 +30,8 @@
buildInputs = [
pkgs.cargo
pkgs.rustc
nac3.packages.x86_64-linux.llvm-nac3
nac3.packages.x86_64-linux.llvm-tools-irrt
];
shellHook = "export LD_LIBRARY_PATH=${libraryPath}";
};

View File

@ -1,5 +1,5 @@
use eframe::egui;
use nac3parser::parser;
use nac3core::nac3parser::parser;
fn main() -> eframe::Result {