Skip to content

Commit

Permalink
0.9.498
Browse files Browse the repository at this point in the history
- Fixes
  • Loading branch information
RobbyV2 committed Nov 24, 2024
1 parent a20a77c commit 106f317
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "fplc"
version = "0.9.497"
version = "0.9.498"
edition = "2021"
description = "A pseudolang interpreter written in Rust"

Expand Down
6 changes: 4 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ use std::fs;
use std::path::Path;

fn main() {
let version = env::var("CARGO_PKG_VERSION").unwrap();
static CARGO_PKG_VERSION: &str = "CARGO_PKG_VERSION";
static OUT_DIR: &str = "OUT_DIR";

let out_dir = env::var("OUT_DIR").unwrap();
let version = env::var(CARGO_PKG_VERSION).unwrap();
let out_dir = env::var(OUT_DIR).unwrap();
let dest_path = Path::new(&out_dir).join("version.rs");

fs::write(
Expand Down
4 changes: 2 additions & 2 deletions installer/pseudolang.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

!define MUI_ICON "Pseudolang-Logo.ico"

Name "PseudoLang Installer v0.9.497"
Name "PseudoLang Installer v0.9.498"
InstallDir "$PROGRAMFILES\PseudoLang\"
OutFile "../release/installer/pseudolang-setup-x64.exe"
BrandingText "(c) 2024 PseudoLang Software Foundation"
Expand Down Expand Up @@ -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.497"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pseudolang" "DisplayVersion" "0.9.498"
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"

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div align="center">
<p>
<img src="https://github.com/PseudoLang-Software-Foundation/Pseudolang/actions/workflows/build.yml/badge.svg" alt="Build and Test Pseudolang">
<img src="https://img.shields.io/badge/Version-0.9.497-green" alt="Version">
<img src="https://img.shields.io/badge/Version-0.9.498-green" alt="Version">
<a href="https://nightly.link/PseudoLang-Software-Foundation/Pseudolang/workflows/build/main"><img src="https://img.shields.io/badge/Nightly-Releases-purple" alt="Nightly Releases"></a>
</p>
</div>
Expand Down
15 changes: 6 additions & 9 deletions src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ fn evaluate_node(
if debug {
println!("Assigning {} = {:?}", name, val);
}
match &**value {
AstNode::FormattedString(_, _) => {
let output = value_to_string(&val);
env.borrow_mut().output.push_str(&output);
env.borrow_mut().output.push('\n');
}
_ => {}
if let AstNode::FormattedString(_, _) = &**value {
let output = value_to_string(&val);
env.borrow_mut().output.push_str(&output);
env.borrow_mut().output.push('\n');
}
env.borrow_mut().set(name.clone(), val.clone());
Ok(val)
Expand Down Expand Up @@ -238,13 +235,13 @@ fn evaluate_node(
let value = if let Some(expr) = expr {
let result = evaluate_node(expr, Rc::clone(&env), debug)?;
let output = value_to_string(&result);
print!("{}\n", output);
println!("{}", output);
stdout().flush().map_err(|e| e.to_string())?;
env.borrow_mut().output.push_str(&output);
env.borrow_mut().output.push('\n');
result
} else {
print!("\n");
println!("");
stdout().flush().map_err(|e| e.to_string())?;
env.borrow_mut().output.push('\n');
Value::Unit
Expand Down
2 changes: 1 addition & 1 deletion src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'a> Lexer<'a> {
}
Token::CommentBlock => {
let mut found_end = false;
while let Some(_) = self.chars.next() {
while self.chars.next().is_some() {
self.pos += 1;

if self.input[self.pos..].starts_with("COMMENTBLOCK") {
Expand Down
64 changes: 29 additions & 35 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,16 @@ impl Parser {
Some(Token::Import) => self.parse_import(debug),
Some(Token::Return) => {
self.advance();
match self.peek() {
Some(Token::OpenParen) => {
self.advance();
let expr = self.parse_expression(debug)?;
if !self.match_token(&Token::CloseParen) {
return Err("Expected ')' after return expression".to_string());
}
Ok(AstNode::Return(Box::new(expr)))
}
_ => {
let expr = self.parse_expression(debug)?;
Ok(AstNode::Return(Box::new(expr)))
if let Some(Token::OpenParen) = self.peek() {
self.advance();
let expr = self.parse_expression(debug)?;
if !self.match_token(&Token::CloseParen) {
return Err("Expected ')' after return expression".to_string());
}
Ok(AstNode::Return(Box::new(expr)))
} else {
let expr = self.parse_expression(debug)?;
Ok(AstNode::Return(Box::new(expr)))
}
}
Some(Token::Input) => {
Expand Down Expand Up @@ -980,32 +977,29 @@ impl Parser {
Self::debug_print(debug, "Starting repeat parse");
self.advance();

match self.peek() {
Some(Token::Until) => {
self.advance();
if !self.match_token(&Token::OpenParen) {
return Err("Expected '(' after REPEAT UNTIL".to_string());
}
let condition = self.parse_expression(debug)?;
if !self.match_token(&Token::CloseParen) {
return Err("Expected ')' after condition".to_string());
}

while let Some(Token::Newline) = self.peek() {
self.advance();
}
if self.peek() == Some(&Token::Until) {
self.advance();
if !self.match_token(&Token::OpenParen) {
return Err("Expected '(' after REPEAT UNTIL".to_string());
}
let condition = self.parse_expression(debug)?;
if !self.match_token(&Token::CloseParen) {
return Err("Expected ')' after condition".to_string());
}

let body = self.parse_block(debug)?;
Ok(AstNode::RepeatUntil(Box::new(body), Box::new(condition)))
while let Some(Token::Newline) = self.peek() {
self.advance();
}
_ => {
let times = self.parse_expression(debug)?;
if !self.match_token(&Token::Times) {
return Err("Expected TIMES after repeat count".to_string());
}
let body = self.parse_block(debug)?;
Ok(AstNode::RepeatTimes(Box::new(times), Box::new(body)))

let body = self.parse_block(debug)?;
Ok(AstNode::RepeatUntil(Box::new(body), Box::new(condition)))
} else {
let times = self.parse_expression(debug)?;
if !self.match_token(&Token::Times) {
return Err("Expected TIMES after repeat count".to_string());
}
let body = self.parse_block(debug)?;
Ok(AstNode::RepeatTimes(Box::new(times), Box::new(body)))
}
}

Expand Down

0 comments on commit 106f317

Please sign in to comment.