From 08d41686be58f253ded06bc2b9f36dd683a3b5ea Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Sat, 2 Mar 2024 22:08:00 -0800 Subject: [PATCH] cute unicode tricks --- src/syntax/parser.lalrpop | 1 + src/syntax/tokens.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/syntax/parser.lalrpop b/src/syntax/parser.lalrpop index 03ac419..cb5d37c 100644 --- a/src/syntax/parser.lalrpop +++ b/src/syntax/parser.lalrpop @@ -45,6 +45,7 @@ extern { "-" => Token::Operator('-'), "*" => Token::Operator('*'), "/" => Token::Operator('/'), + "÷" => Token::Operator('/'), // the previous items just match their tokens, and if you try // to name and use "their value", you get their source location. diff --git a/src/syntax/tokens.rs b/src/syntax/tokens.rs index 48c1c52..0b0e486 100644 --- a/src/syntax/tokens.rs +++ b/src/syntax/tokens.rs @@ -60,6 +60,7 @@ pub enum Token { #[token("}")] CloseBrace, + #[token("λ")] #[token("lambda")] #[token("function")] Function, @@ -72,7 +73,7 @@ pub enum Token { // Next are the operators for NGR. We only have 4, now, but // we might extend these later, or even make them user-definable! - #[regex(r"[+\-*/]", |v| v.slice().chars().next())] + #[regex(r"[+\-*/÷]", |v| v.slice().chars().next())] Operator(char), /// Numbers capture both the value we read from the input,