summaryrefslogtreecommitdiff
path: root/rust/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/parser.rs')
-rw-r--r--rust/src/parser.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/src/parser.rs b/rust/src/parser.rs
index 459219c..2c2dced 100644
--- a/rust/src/parser.rs
+++ b/rust/src/parser.rs
@@ -62,7 +62,11 @@ fn tokenize(arg: &str) -> Vec<Token> {
fn terminate(result: &mut Vec<Token>, word: &mut String) {
if !word.is_empty() {
let w = word.clone();
- result.push(Token::Word(w));
+ if w == "lam" {
+ result.push(Token::Lambda);
+ } else {
+ result.push(Token::Word(w));
+ }
word.clear();
}
}
@@ -154,6 +158,11 @@ mod tests {
}
#[test]
+ fn tokenize_lambda_symbol() {
+ assert_eq!(vec![Lambda, LParen,], tokenize("lam ("));
+ }
+
+ #[test]
fn parse_application_of_two_values() {
assert_eq!(
App(Box::new(Sym("foo".to_string())), Box::new(Num(42))),