Fixed bug where infix wouldn't rewind when encountering a comma, causing the rest of a syscall parse in an assignment expression to fail

This commit is contained in:
2025-12-10 00:09:16 -07:00
parent 0fde11a2bf
commit 9c260ef2d5
7 changed files with 14 additions and 7 deletions

View File

@@ -1,5 +1,10 @@
# Changelog
[0.2.1]
- Added support for `loadSlot` and `setSlot`
- Fixed bug where syscalls like `max(1, 2)` were not allowed in assignment expressions
[0.2.0]
- Completely re-wrote the tokenizer to use `logos`

View File

@@ -2,7 +2,7 @@
<ModMetadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>Slang</Name>
<Author>JoeDiertay</Author>
<Version>0.2.0</Version>
<Version>0.2.1</Version>
<Description>
[h1]Slang: High-Level Programming for Stationeers[/h1]

View File

@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<AssemblyName>StationeersSlang</AssemblyName>
<Description>Slang Compiler Bridge</Description>
<Version>0.2.0</Version>
<Version>0.2.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

View File

@@ -909,7 +909,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
[[package]]
name = "slang"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anyhow",
"clap",

View File

@@ -1,6 +1,6 @@
[package]
name = "slang"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
[workspace]

View File

@@ -249,7 +249,7 @@ fn test_max_from_game() -> Result<()> {
debug
r#"
let item = 0;
item = max(1, 2);
item = max(1 + 2, 2);
"#
};
@@ -260,7 +260,7 @@ fn test_max_from_game() -> Result<()> {
j main
main:
move r8 0 #item
max r15 1 2
max r15 3 2
move r8 r15 #item
"
}

View File

@@ -1059,7 +1059,9 @@ impl<'a> Parser<'a> {
if token_matches!(
temp_token,
TokenType::Symbol(Symbol::Semicolon) | TokenType::Symbol(Symbol::RParen)
TokenType::Symbol(Symbol::Semicolon)
| TokenType::Symbol(Symbol::RParen)
| TokenType::Symbol(Symbol::Comma)
) {
self.tokenizer.seek(SeekFrom::Current(-1))?;
}