*** empty log message ***

original commit: 8df669f6a6cd1ece741f95aba83d6e37b6b498cf
tokens
Scott Owens 23 years ago
parent 85a29c420a
commit 62a86122aa

@ -63,8 +63,8 @@
;; c = char | eof ;; c = char | eof
;; lex-buf = ;; lex-buf =
;; (make-lex-buffer input-port (c list) (c list) int int int (int list) boolean) ;; (make-lex-buffer input-port (c list) (c list) int int int (int list))
(define-struct lex-buffer (ip from to offset line col line-lengths tab-skips has-seen-eof?)) (define-struct lex-buffer (ip from to offset line col line-lengths tab-skips))
;; make-lex-buf: input-port -> lex-buf ;; make-lex-buf: input-port -> lex-buf
(define make-lex-buf (define make-lex-buf
@ -74,7 +74,7 @@
((not (input-port? ip)) ((not (input-port? ip))
(raise-type-error 'make-lex-buf "input-port" 0 ip)) (raise-type-error 'make-lex-buf "input-port" 0 ip))
(else (else
(make-lex-buffer ip null null 1 1 1 null null #f)))) (make-lex-buffer ip null null 1 1 1 null null))))
((ip offsets) ((ip offsets)
(cond (cond
((not (input-port? ip)) ((not (input-port? ip))
@ -85,19 +85,12 @@
(not (andmap (lambda (x) (>= x 0)) offsets))) (not (andmap (lambda (x) (>= x 0)) offsets)))
(raise-type-error 'make-lex-buf "list of 3 non-negative exact integers" 1 ip offsets)) (raise-type-error 'make-lex-buf "list of 3 non-negative exact integers" 1 ip offsets))
(else (else
(make-lex-buffer ip null null (caddr offsets) (car offsets) (cadr offsets) null null #f)))))) (make-lex-buffer ip null null (caddr offsets) (car offsets) (cadr offsets) null null))))))
(define (get-next lb) (define (get-next lb)
(cond (cond
((null? (lex-buffer-from lb)) ((null? (lex-buffer-from lb))
(let ((res (read-char (lex-buffer-ip lb)))) (read-char (lex-buffer-ip lb)))
(if (eof-object? res)
(if (lex-buffer-has-seen-eof? lb)
(raise-read-error
(format "lex-buf: No characters left in input stream")
#f #f #f #f #f)
(set-lex-buffer-has-seen-eof?! lb #t)))
res))
(else (else
(begin0 (begin0
(car (lex-buffer-from lb)) (car (lex-buffer-from lb))

Loading…
Cancel
Save