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 };