diff --git a/Cargo.lock b/Cargo.lock index 6b014bd..202f5bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,7 +102,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "fplc" -version = "0.9.495" +version = "0.9.496" dependencies = [ "chrono", "chrono-tz", diff --git a/Cargo.toml b/Cargo.toml index 6388dff..760a101 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "fplc" -version = "0.9.495" +version = "0.9.496" edition = "2021" description = "A pseudolang interpreter written in Rust" diff --git a/installer/pseudolang.nsi b/installer/pseudolang.nsi index cab3815..e1304c8 100644 --- a/installer/pseudolang.nsi +++ b/installer/pseudolang.nsi @@ -4,7 +4,7 @@ !define MUI_ICON "Pseudolang-Logo.ico" -Name "PseudoLang Installer v0.9.495" +Name "PseudoLang Installer v0.9.496" 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.495" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayVersion" "0.9.496" 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 342b1bc..87cc1b4 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@

Build and Test Pseudolang - Version + Version Nightly Releases

@@ -61,7 +61,6 @@ The file `src/tests/mod.rs` also contains various unit tests (examples of code) - [ ] Dictionaries - [ ] Better error handling (line, column) -- [ ] Time - [ ] Networking - [ ] File IO - [ ] System integration (terminal commands, process management, environment variables) @@ -75,6 +74,7 @@ The file `src/tests/mod.rs` also contains various unit tests (examples of code) Misc - [ ] Testing for INPUT and SLEEP (mocking framework) +- [ ] More escape characters diff --git a/src/parser.rs b/src/parser.rs index 7bd2410..7181be7 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -339,13 +339,13 @@ impl Parser { if !self.match_token(&Token::OpenParen) { return Err("Expected '(' after INPUT".to_string()); } - let prompt = if let Some(Token::String(_)) = self.peek() { + let prompt = if self.peek() != Some(&Token::CloseParen) { Some(Box::new(self.parse_expression(debug)?)) } else { None }; if !self.match_token(&Token::CloseParen) { - return Err("Expected ')' after INPUT expression".to_string()); + return Err("Expected ')' after INPUT".to_string()); } Ok(AstNode::Input(prompt)) } @@ -671,7 +671,7 @@ impl Parser { if !self.match_token(&Token::OpenParen) { return Err("Expected '(' after INPUT".to_string()); } - let prompt = if let Some(Token::String(_)) = self.peek() { + let prompt = if self.peek() != Some(&Token::CloseParen) { Some(Box::new(self.parse_expression(debug)?)) } else { None diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 3ff98da..c3e918e 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -18,6 +18,24 @@ mod test { } } + #[test] + fn test_display() { + assert_output("DISPLAY(42)", "42"); + assert_output("DISPLAY(TRUE)", "true"); + assert_output(r#"DISPLAY("Hello")"#, "Hello"); + assert_output("DISPLAY([1, 2, 3])", "[1, 2, 3]"); + assert_output("DISPLAY(5.5)", "5.5"); + assert_output("DISPLAY(-42)", "-42"); + assert_output("DISPLAY(FALSE)", "false"); + assert_output("DISPLAY([])", "[]"); + assert_output( + r#" + DISPLAYINLINE("Hello, ") + DISPLAYINLINE("World!")"#, + "Hello, World!", + ); + } + #[test] fn test_basic_arithmetic() { assert_output("DISPLAY(5 + 3)", "8"); @@ -1136,16 +1154,6 @@ DISPLAY(str[0])"#, } } - #[test] - fn test_misc() { - assert_output( - r#" - DISPLAYINLINE("Hello, ") - DISPLAYINLINE("World!")"#, - "Hello, World!", - ); - } - #[test] fn test_merge_sort() { assert_output(