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 # 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] [0.2.0]
- Completely re-wrote the tokenizer to use `logos` - 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"> <ModMetadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>Slang</Name> <Name>Slang</Name>
<Author>JoeDiertay</Author> <Author>JoeDiertay</Author>
<Version>0.2.0</Version> <Version>0.2.1</Version>
<Description> <Description>
[h1]Slang: High-Level Programming for Stationeers[/h1] [h1]Slang: High-Level Programming for Stationeers[/h1]

View File

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

View File

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

View File

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

View File

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

View File

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