From a887ceffa674adcbd724bc810e648468e1472f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20H=C3=B6lting?= <87192362+moritz-hoelting@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:41:08 +0000 Subject: [PATCH] update shulkerscript-lang dependency fixes bug of literal command directly after comment resulting in error --- src/wasm/webcompiler/Cargo.toml | 2 +- src/wasm/webcompiler/src/util.rs | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/wasm/webcompiler/Cargo.toml b/src/wasm/webcompiler/Cargo.toml index 4a82af2..b34b887 100644 --- a/src/wasm/webcompiler/Cargo.toml +++ b/src/wasm/webcompiler/Cargo.toml @@ -13,7 +13,7 @@ opt-level = "s" [dependencies] wasm-bindgen = "0.2.92" -shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "4505def6c0bc43f9e67274a305453a6ac7ca517f" } +shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "6422737cf396cf7e36ba63d2e89535bfcfc32264" } serde = "1.0" serde-wasm-bindgen = "0.6.5" anyhow = "1.0.86" diff --git a/src/wasm/webcompiler/src/util.rs b/src/wasm/webcompiler/src/util.rs index 499c901..b144114 100644 --- a/src/wasm/webcompiler/src/util.rs +++ b/src/wasm/webcompiler/src/util.rs @@ -16,15 +16,21 @@ fn tokenize( printer: &Printer, file_provider: &impl FileProvider, path: &Path, + identifier: String, ) -> Result { - let source_file = SourceFile::load(path, file_provider)?; + let source_file = SourceFile::load(path, identifier, file_provider)?; Ok(TokenStream::tokenize(&source_file, printer)) } /// Parses the source code at the given path. -fn parse(printer: &Printer, file_provider: &impl FileProvider, path: &Path) -> Result { - let tokens = tokenize(printer, file_provider, path)?; +fn parse( + printer: &Printer, + file_provider: &impl FileProvider, + path: &Path, + identifier: String, +) -> Result { + let tokens = tokenize(printer, file_provider, path, identifier)?; if printer.has_printed() { return Err(Error::Other("An error occurred while tokenizing the source code.").into()); @@ -55,9 +61,14 @@ where let programs = script_paths .iter() .map(|(program_identifier, path)| { - let program = parse(printer, file_provider, path.as_ref())?; + let program = parse( + printer, + file_provider, + path.as_ref(), + program_identifier.clone(), + )?; - Ok((program_identifier, program)) + Ok(program) }) .collect::>();