From 84e1662aaa672357c41b855b4c727a1d9b823508 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 3 Jan 2025 16:39:19 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit semver: chore --- src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.rs b/src/main.rs index 96a8bf7..e0028e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,21 @@ pub mod lexer; pub mod parser; const INPUT: &str = " +type Color { + Red, + Hex (string), + Rgb { r: int, g: int, b: int } +} + +code Color { + fn to_hex(color ~ Color) -> string { + match color: + Red => \"#FF0000\" + Hex(hex) => hex + Rgb { r, g, b } => format!(\"#{:02X}{:02X}{:02X}\", r, g, b) + } +} + fn main() { let a = |a ~ int| { 1 + 1; a };