diff --git a/collects/combinator-parser/private-combinator/combinator-parser.scm b/collects/combinator-parser/private-combinator/combinator-parser.scm index 51f28f403e..913a06963b 100644 --- a/collects/combinator-parser/private-combinator/combinator-parser.scm +++ b/collects/combinator-parser/private-combinator/combinator-parser.scm @@ -22,7 +22,6 @@ [(and (res? result) (res-a result) (null? (res-rest result))) (car (res-a (!!! result)))] [(and (res? result) (res-a result) (res-possible-error result)) - (printf "res fail~n") (fail-type->message (!!! (res-possible-error result)))] [(and (res? result) (res-a result)) (make-err @@ -32,7 +31,6 @@ (and src? (make-src-lst (position-token-start-pos (!!! (car (res-rest result)))))))] [(res? result) - (printf "res fail2~n") (fail-type->message (res-msg (!!! result)))] [(or (choice-res? result) (pair? result)) (let* ([options (if (choice-res? result) (choice-res-matches result) result)] @@ -47,7 +45,7 @@ (cond [(not (null? finished-options)) (car (res-a (!!! (car finished-options))))] [(not (null? possible-errors)) - (printf "choice or pair fail~n") + ;(printf "choice or pair fail~n") (!!! (fail-type->message (res-possible-error (!!! (car (sort-used possible-errors))))))] [else @@ -62,12 +60,13 @@ [(and (repeat-res? result) (eq? 'out-of-input (repeat-res-stop (!!! result)))) (res-a (repeat-res-a result))] [(and (repeat-res? result) (fail-type? (repeat-res-stop (!!! result)))) - (printf "repeat-fail~n") + ;(printf "repeat-fail~n") (!!! (fail-type->message (!!! (repeat-res-stop (!!! result)))))] [else (error 'parser (format "Internal error: recieved unexpected input ~a" (!!! result)))])]) (cond [(err? out) + ;(printf "returning error") (make-err (!!! (err-msg out)) (list (!!! file) (!!! (first (err-src out))) diff --git a/collects/combinator-parser/private-combinator/combinator.scm b/collects/combinator-parser/private-combinator/combinator.scm index ee61af84e9..932ee4cb88 100644 --- a/collects/combinator-parser/private-combinator/combinator.scm +++ b/collects/combinator-parser/private-combinator/combinator.scm @@ -26,8 +26,7 @@ [spell? (if spell? spell? (lambda (token) (when (position-token? token) (set! token (position-token-token token))) - (and (token-value token) - (misspelled name (token-value token)))))] + (if (token-value token) (misspelled name (token-value token)) 0)))] [case? (if case? case? (lambda (token) (when (position-token? token) (set! token (position-token-token token))) diff --git a/collects/combinator-parser/private-combinator/errors.scm b/collects/combinator-parser/private-combinator/errors.scm index 4d0c2d579f..c80159c0e4 100644 --- a/collects/combinator-parser/private-combinator/errors.scm +++ b/collects/combinator-parser/private-combinator/errors.scm @@ -24,7 +24,7 @@ [name (fail-type-name fail-type)] [a (a/an name)] [msg (lambda (m) (make-err m (fail-type-src fail-type)))]) - #;(printf "fail-type->message ~a~n" fail-type) + ;(printf "fail-type->message ~a~n" fail-type) (cond [(terminal-fail? fail-type) (combine-message @@ -184,8 +184,8 @@ (define (first-n n lst) (let loop ([count 0] [l lst]) (cond - [(= count n) null] - [else (cons (car lst) (loop (add1 count) (cdr lst)))]))) + [(>= count n) null] + [else (cons (car l) (loop (add1 count) (cdr l)))]))) (define (get-ties lst evaluate) (letrec ([getter diff --git a/collects/combinator-parser/private-combinator/parser-sigs.ss b/collects/combinator-parser/private-combinator/parser-sigs.ss index 0e23688998..191a27db02 100644 --- a/collects/combinator-parser/private-combinator/parser-sigs.ss +++ b/collects/combinator-parser/private-combinator/parser-sigs.ss @@ -116,7 +116,7 @@ (thunk (token-value x)) (thunk (token-value x) (car args) (cadr args)))) name - (lambda (token) #f) + (lambda (token) 0) (lambda (token) #f))) ...))))])))) (define-syntaxes (sequence choose ^)