update shulkerscript-lang dependency

fixes bug of literal command directly after comment resulting in error
This commit is contained in:
Moritz Hölting 2024-08-28 11:41:08 +00:00
parent a2db8e9f6d
commit a887ceffa6
2 changed files with 17 additions and 6 deletions

View File

@ -13,7 +13,7 @@ opt-level = "s"
[dependencies] [dependencies]
wasm-bindgen = "0.2.92" 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 = "1.0"
serde-wasm-bindgen = "0.6.5" serde-wasm-bindgen = "0.6.5"
anyhow = "1.0.86" anyhow = "1.0.86"

View File

@ -16,15 +16,21 @@ fn tokenize(
printer: &Printer, printer: &Printer,
file_provider: &impl FileProvider, file_provider: &impl FileProvider,
path: &Path, path: &Path,
identifier: String,
) -> Result<TokenStream> { ) -> Result<TokenStream> {
let source_file = SourceFile::load(path, file_provider)?; let source_file = SourceFile::load(path, identifier, file_provider)?;
Ok(TokenStream::tokenize(&source_file, printer)) Ok(TokenStream::tokenize(&source_file, printer))
} }
/// Parses the source code at the given path. /// Parses the source code at the given path.
fn parse(printer: &Printer, file_provider: &impl FileProvider, path: &Path) -> Result<ProgramFile> { fn parse(
let tokens = tokenize(printer, file_provider, path)?; printer: &Printer,
file_provider: &impl FileProvider,
path: &Path,
identifier: String,
) -> Result<ProgramFile> {
let tokens = tokenize(printer, file_provider, path, identifier)?;
if printer.has_printed() { if printer.has_printed() {
return Err(Error::Other("An error occurred while tokenizing the source code.").into()); return Err(Error::Other("An error occurred while tokenizing the source code.").into());
@ -55,9 +61,14 @@ where
let programs = script_paths let programs = script_paths
.iter() .iter()
.map(|(program_identifier, path)| { .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::<Vec<_>>(); .collect::<Vec<_>>();