More tweaks to syntax-parser interface.
authorChris Hanson <org/chris-hanson/cph>
Wed, 7 Mar 2018 01:46:34 +0000 (17:46 -0800)
committerChris Hanson <org/chris-hanson/cph>
Wed, 7 Mar 2018 01:46:34 +0000 (17:46 -0800)
src/runtime/runtime.pkg
src/runtime/syntax-parser.scm

index 82727d6da5bd9633050527c2295371f41c269e52..b371eb8a942f2090ef28e1278b8e5783035e0c19 100644 (file)
@@ -4560,8 +4560,10 @@ USA.
          spar-or
          spar-push
          spar-push-body
+         spar-push-elt
+         spar-push-elt-if
          spar-push-id
-         spar-push-id=
+         spar-push-if
          spar-push-value
          spar-push-values
          spar-repeat
index af4388dba47ce962873f6aaa4bab31f537a0c1f8..4828c30e6de0ee5d2364708494549de945af7460 100644 (file)
@@ -184,6 +184,10 @@ USA.
             (%output-push-all output (%subst-args input senv output args))
             failure)))
 
+(define (spar-push-if predicate . args)
+  (spar-seq (apply spar-match predicate args)
+           (apply spar-push args)))
+
 (define (spar-push-value procedure . args)
   (lambda (input senv output success failure)
     (success input
@@ -332,6 +336,12 @@ USA.
                failure)
          (failure)))))
 
+(define (spar-push-elt . args)
+  (spar-elt (apply spar-push args)))
+
+(define (spar-push-elt-if . args)
+  (spar-elt (apply spar-push-if args)))
+
 (define-deferred spar-match-null
   (spar-match null? spar-arg:form))
 
@@ -376,16 +386,6 @@ USA.
     (spar-match identifier? spar-arg:form)
     (spar-push spar-arg:form)
     spar-discard-form))
-
-(define (spar-push-id= id)
-  (spar-seq
-    (spar-match (lambda (form senv)
-                 (and (identifier? form)
-                      (identifier=? senv form senv id)))
-               spar-arg:form
-               spar-arg:senv)
-    (spar-push spar-arg:form)
-    spar-discard-form))
 \f
 ;;;; Value combinators