From 56d7d46579fbe6904e2697cb303c628d834e3c02 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 25 Mar 2018 08:36:58 -0700 Subject: [PATCH] Tweak spar patterns. * Rename (quote ) to (noise ). * Rename (keyword ) to (noise-keyword ). * Implement (keyword ) that matches and then pushes it. --- src/runtime/mit-macros.scm | 4 ++-- src/runtime/syntax-parser.scm | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index d23432742..3f1dbe8be 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -371,7 +371,7 @@ USA. (delay (scons-rule (let ((action-pattern - '(if (keyword =>) + '(if (noise-keyword =>) (and (values apply) any) (and (values eval) @@ -379,7 +379,7 @@ USA. `(any (list (* (list (elt (list (elt (* any))) ,action-pattern)))) - (or (list (elt (keyword else) + (or (list (elt (noise-keyword else) ,action-pattern)) (values #f)))) (lambda (expr clauses else-clause) diff --git a/src/runtime/syntax-parser.scm b/src/runtime/syntax-parser.scm index 67e4bca12..4e1370013 100644 --- a/src/runtime/syntax-parser.scm +++ b/src/runtime/syntax-parser.scm @@ -488,9 +488,12 @@ USA. ('('if form form form) (apply :if (map loop (cdr pattern)))) ('('or * form) (apply :or (map loop (cdr pattern)))) ('('and * form) (apply :seq (map loop (cdr pattern)))) - ('('quote form) (:match-elt (:eqv?) (cadr pattern) (:form))) - ('('keyword identifier) + ('('noise form) (:match-elt (:eqv?) (cadr pattern) (:form))) + ('('noise-keyword identifier) (:match-elt (:compare) (cadr pattern) (:form))) + ('('keyword identifier) + (:seq (:match-elt (:compare) (cadr pattern) (:form)) + (:push (cadr pattern)))) ('('values * form) (apply :push (map convert-spar-arg (cdr pattern)))) ('('value-of + form) -- 2.25.1