From 12a025dd5b65f183960e417dc352c3e58cd91474 Mon Sep 17 00:00:00 2001 From: RobbyV2 Date: Tue, 10 Dec 2024 15:40:57 +0000 Subject: [PATCH] 0.9.516 - Method parsing fix --- Cargo.lock | 2 +- Cargo.toml | 2 +- installer/pseudolang.nsi | 4 ++-- readme.md | 2 +- src/parser.rs | 3 +++ src/tests/mod.rs | 26 ++++++++++++++++++++++++++ wapm.toml | 2 +- 7 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca0eba8..28e89d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,7 +112,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "fplc" -version = "0.9.515" +version = "0.9.516" dependencies = [ "chrono", "chrono-tz", diff --git a/Cargo.toml b/Cargo.toml index f14c15c..811bcfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "fplc" -version = "0.9.515" +version = "0.9.516" edition = "2021" description = "A pseudolang interpreter written in Rust" repository = "https://github.com/PseudoLang-Software-Foundation/Pseudolang" diff --git a/installer/pseudolang.nsi b/installer/pseudolang.nsi index 1235c0e..8dbe05c 100644 --- a/installer/pseudolang.nsi +++ b/installer/pseudolang.nsi @@ -4,7 +4,7 @@ !define MUI_ICON "Pseudolang-Logo.ico" -Name "PseudoLang Installer v0.9.515" +Name "PseudoLang Installer v0.9.516" InstallDir "$PROGRAMFILES\PseudoLang\" OutFile "../release/installer/pseudolang-setup-x64.exe" BrandingText "(c) 2024 PseudoLang Software Foundation" @@ -33,7 +33,7 @@ Section "" WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$INSTDIR;$R0" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayName" "Pseudolang" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayVersion" "0.9.515" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayVersion" "0.9.516" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "Publisher" "Pseudolang Software Foundation" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayIcon" "$INSTDIR\Pseudolang-Logo.ico" diff --git a/readme.md b/readme.md index 076a356..6e6ea04 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@

Build and Test Pseudolang - Version + Version Nightly Releases

diff --git a/src/parser.rs b/src/parser.rs index fa3eb8f..7ba7ef3 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -334,6 +334,9 @@ impl Parser { } Ok(AstNode::Return(Box::new(expr))) } + } else if self.is_expression_start() { + let expr = self.parse_expression(debug)?; + Ok(AstNode::Return(Box::new(expr))) } else { Ok(AstNode::Return(Box::new(AstNode::Block(vec![])))) } diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 77a725b..a51e1d6 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -144,6 +144,32 @@ mod test { ); } + #[test] + fn test_return() { + assert_output(r#" + PROCEDURE test1(num) { + RETURN (num) + } + + PROCEDURE test2(num) { + RETURN num + } + + PROCEDURE test3() { + RETURN + } + + PROCEDURE test4() { + RETURN () + } + + DISPLAY(test1(5)) + DISPLAY(test2(6)) + DISPLAY(test3()) + DISPLAY(test4()) + "#, "5\n6"); + } + #[test] fn test_boolean_operations() { assert_output("DISPLAY(TRUE AND FALSE)", "false"); diff --git a/wapm.toml b/wapm.toml index 93315ab..9da7bf1 100644 --- a/wapm.toml +++ b/wapm.toml @@ -1,7 +1,7 @@ [package] name = "pseudolang/fplc" -version = "0.9.515" +version = "0.9.516" description = "A pseudolang interpreter written in Rust" license = "MIT" readme = "readme.md"