λ Support functions! #5

Open
acw wants to merge 59 commits from awick/functions into develop
2 changed files with 3 additions and 1 deletions
Showing only changes of commit 08d41686be - Show all commits

View File

@@ -45,6 +45,7 @@ extern {
"-" => Token::Operator('-'), "-" => Token::Operator('-'),
"*" => Token::Operator('*'), "*" => Token::Operator('*'),
"/" => Token::Operator('/'), "/" => Token::Operator('/'),
"÷" => Token::Operator('/'),
// the previous items just match their tokens, and if you try // the previous items just match their tokens, and if you try
// to name and use "their value", you get their source location. // to name and use "their value", you get their source location.

View File

@@ -60,6 +60,7 @@ pub enum Token {
#[token("}")] #[token("}")]
CloseBrace, CloseBrace,
#[token("λ")]
#[token("lambda")] #[token("lambda")]
#[token("function")] #[token("function")]
Function, Function,
@@ -72,7 +73,7 @@ pub enum Token {
// Next are the operators for NGR. We only have 4, now, but // Next are the operators for NGR. We only have 4, now, but
// we might extend these later, or even make them user-definable! // 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), Operator(char),
/// Numbers capture both the value we read from the input, /// Numbers capture both the value we read from the input,