Interpret bare string or char as self.
authorChris Hanson <org/chris-hanson/cph>
Tue, 9 Oct 2001 16:02:43 +0000 (16:02 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 9 Oct 2001 16:02:43 +0000 (16:02 +0000)
v7/src/star-parser/matcher.scm

index 6573abe8cc0f7079e9de666991a0e6d21b5683d4..8f3419b72d0cfb5debb8be5815245ab9a4d60b49 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: matcher.scm,v 1.14 2001/07/14 11:42:26 cph Exp $
+;;; $Id: matcher.scm,v 1.15 2001/10/09 16:02:43 cph Exp $
 ;;;
 ;;; Copyright (c) 2001 Massachusetts Institute of Technology
 ;;;
           (if preprocessor
               (preprocessor expression external-bindings internal-bindings)
               expression)))
+       ((string? expression)
+        (preprocess-matcher-expression `(STRING ,expression)
+                                       external-bindings
+                                       internal-bindings))
+       ((char? expression)
+        (preprocess-matcher-expression `(CHAR ,expression)
+                                       external-bindings
+                                       internal-bindings))
        (else
         (error "Unknown matcher expression:" expression))))
 
 (define-matcher-preprocessor 'CHAR-SET
   (lambda (expression external-bindings internal-bindings)
     internal-bindings
-    (let ((arg (check-1-arg expression)))
-      (if (string? arg)
-         `(,(car expression)
-           ,(handle-complex-expression
+    `(,(car expression)
+      ,(handle-complex-expression
+       (let ((arg (check-1-arg expression)))
+         (if (string? arg)
              (if (string-prefix? "^" arg)
                  `(RE-COMPILE-CHAR-SET ,(string-tail arg 1) #T)
                  `(RE-COMPILE-CHAR-SET ,arg #F))
-             external-bindings))
-         expression))))
+             arg))
+       external-bindings))))
 
 (define-matcher-preprocessor 'ALPHABET
   (lambda (expression external-bindings internal-bindings)
-    external-bindings internal-bindings
-    expression))
+    internal-bindings
+    `(,(car expression)
+      ,(handle-complex-expression (check-1-arg expression)
+                                 external-bindings))))
 
 (define-matcher-preprocessor 'WITH-POINTER
   (lambda (expression external-bindings internal-bindings)