Changeset 14813 in project


Ignore:
Timestamp:
05/28/09 03:43:54 (10 years ago)
Author:
Ivan Raikov
Message:

fixes in drop and collect

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/abnf/abnf.scm

    r14812 r14813  
    5050          )
    5151
    52    (import scheme chicken data-structures srfi-1 srfi-14)
    53 
    54    (require-extension matchable )
     52   (import scheme chicken data-structures )
     53
     54   (require-extension matchable srfi-1 srfi-14)
    5555
    5656   (require-library lexgen)
     
    191191             (else #f)))))
    192192
    193 (define (drop p)
    194   (bind (lambda (x) (drop-while atom? x)) p))
     193(define (drop p) (bind (lambda (x) (drop-while char? x)) p))
    195194
    196195(define (consume p)
     
    203202
    204203(define (collect . rest)
    205   (define (consumed-atoms cs)
     204  (define (consumed-chars cs)
    206205    (and (pair? cs)
    207206         (let loop ((cs cs) (ax (list)))
    208207           (cond ((null? cs)         `(,ax))
    209                  ((atom? (car cs))   (loop (cdr cs) (cons (car cs) ax)))
     208                 ((char? (car cs))   (loop (cdr cs) (cons (car cs) ax)))
    210209                 (else               (cons ax cs))))))
    211210  (let-optionals rest ((kons #f))
     
    214213                      (else car))))
    215214      (lambda (x)
    216         (let ((x1 (consumed-atoms x)))
     215        (let ((x1 (consumed-chars x)))
    217216          (and x1 (cons (make x1) (cdr x1))))))))
    218217
Note: See TracChangeset for help on using the changeset viewer.