;;; -*-Scheme-*-
;;;
-;;; $Id: matcher.scm,v 1.4 2001/06/26 21:16:44 cph Exp $
+;;; $Id: matcher.scm,v 1.5 2001/06/27 02:00:08 cph Exp $
;;;
;;; Copyright (c) 2001 Massachusetts Institute of Technology
;;;
\f
;;;; Matchers
-(define-macro (define-matcher form compiler-body)
+(define-macro (define-matcher form . compiler-body)
(let ((name (car form))
(parameters (cdr form)))
(if (symbol? parameters)
`(DEFINE-MATCHER-COMPILER ',name #F
(LAMBDA (POINTERS IF-SUCCEED IF-FAIL ,parameters)
- ,compiler-body))
+ ,@compiler-body))
`(DEFINE-MATCHER-COMPILER ',name ,(length parameters)
(LAMBDA (POINTERS IF-SUCCEED IF-FAIL ,@parameters)
- ,compiler-body)))))
+ ,@compiler-body)))))
(define (define-matcher-compiler keyword arity compiler)
(hash-table/put! matcher-compilers keyword (cons arity compiler))
`(MATCH-PARSER-BUFFER-STRING-CI ,*buffer-name* ,string))
\f
(define-matcher (* expression)
+ if-fail
(handle-pending-backtracking pointers
(lambda (pointers)
- (let ((v (generate-uninterned-symbol)))
+ (let ((pointers (unknown-location pointers))
+ (v (generate-uninterned-symbol)))
`(BEGIN
(LET ,v ()
- ,(compile-matcher-expression expression (no-pointers)
+ ,(compile-matcher-expression expression pointers
(simple-backtracking-continuation `(,v))
(simple-backtracking-continuation `UNSPECIFIC)))
- ,(if-succeed (no-pointers)))))))
+ ,(if-succeed pointers))))))
(define-matcher (seq . expressions)
(with-current-pointer pointers
;;; -*-Scheme-*-
;;;
-;;; $Id: parser.scm,v 1.8 2001/06/27 01:53:53 cph Exp $
+;;; $Id: parser.scm,v 1.9 2001/06/27 01:57:16 cph Exp $
;;;
;;; Copyright (c) 2001 Massachusetts Institute of Technology
;;;
,(if-fail pointers)))))))
(define-parser (* parser)
+ if-fail
(handle-pending-backtracking pointers
(lambda (pointers)
(with-variable-binding