From bbf182f762f251382dddac7cb9d75ba89c65da58 Mon Sep 17 00:00:00 2001 From: brevalferrari Date: Thu, 19 Jun 2025 14:12:14 +0200 Subject: [PATCH] make Expression Display using original string --- Cargo.toml | 2 +- src/compiler.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c222e04..2dadb3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bliplib" -version = "0.2.4" +version = "0.2.5" edition = "2024" authors = ["Breval Ferrari "] description = "The Bizarre Language for Intermodulation Programming (BLIP)" diff --git a/src/compiler.rs b/src/compiler.rs index 7355e0e..e1b1fc1 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -2,7 +2,7 @@ use std::{ any::{Any, TypeId, type_name}, collections::BTreeMap, f64, - fmt::Debug, + fmt::{Debug, Display}, str::FromStr, }; @@ -289,6 +289,12 @@ impl FromStr for Expression { } } +impl Display for Expression { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + Display::fmt(&self.from, f) + } +} + /// Compiler context which persists from one token to the other. #[derive(Debug, Clone, new)] #[cfg_attr(test, derive(PartialEq))]