diff --git a/Cargo.lock b/Cargo.lock index b4e64ee..502d0fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,9 +37,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "ariadne" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44055e597c674aef7cb903b2b9f6e4cba1277ed0d2d61dae7cd52d7ffa81f8e2" +checksum = "31beedec3ce83ae6da3a79592b3d8d7afd146a5b15bb9bb940279aced60faa89" dependencies = [ "unicode-width", "yansi", diff --git a/Cargo.toml b/Cargo.toml index 2434c6e..30f90cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -ariadne = "0.4.1" +ariadne = "0.5.0" chumsky = "0.9.3" console_error_panic_hook = "0.1.7" itertools = "0.13.0" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..63d8f92 --- /dev/null +++ b/flake.lock @@ -0,0 +1,93 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1733392399, + "narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1728538411, + "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1733538766, + "narHash": "sha256-FEDfBpM82XGdHDbLDJC4lV+QXSVN1rERt1MqtBGJZds=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "66526479b295ad238843a8a7367d2da7ec102757", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a748816 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } + { + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + perSystem = { self', lib, system, pkgs, config, ... }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + + overlays = with inputs; [ + rust-overlay.overlays.default + ]; + }; + + devShells.default = + let + rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + in + pkgs.mkShell { + packages = [ + rust-toolchain + pkgs.wasm-pack + pkgs.nodejs + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..1765a1f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rust-src", "rust-analyzer"] +targets = [ "wasm32-unknown-unknown" ] \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 66ff005..21396d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,7 +57,7 @@ pub fn format_errors( let mut error_output = Vec::new(); errors.into_iter().for_each(|e| { - Report::build(ReportKind::Error, (), e.span().start) + Report::build(ReportKind::Error, e.span()) .with_message(e.to_string()) .with_label(Label::new(e.span()).with_color(Color::Red)) .finish() diff --git a/src/main.rs b/src/main.rs index 9796a87..f891135 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ fn main() { if let Err(err) = tokens.clone() { err.into_iter().for_each(|e| { - Report::build(ReportKind::Error, (), e.span().start) + Report::build(ReportKind::Error, e.span()) .with_message(e.to_string()) .with_label(Label::new(e.span()).with_color(Color::Red)) .finish() @@ -37,7 +37,7 @@ fn main() { println!("{:#?}", err); err.into_iter().for_each(|e| { - Report::build(ReportKind::Error, (), e.span().start) + Report::build(ReportKind::Error, e.span()) .with_message(e.to_string()) .with_label(Label::new(e.span()).with_color(Color::Red)) .finish()