*** empty log message ***

original commit: 6986dd5d52829308189ef6e3d6f5be94a28186cc
tokens
Scott Owens 23 years ago
parent 67313d8a93
commit db43a04859

@ -85,22 +85,22 @@
(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 (add1 (caddr offsets)) (add1 (car offsets)) (add1 (cadr offsets)) null null)))))) (make-lex-buffer ip null null (caddr offsets) (car offsets) (cadr offsets) null null))))))
;; next-char: lex-buf -> c (define (get-next lb)
;; gets the next character from the buffer
(define (next-char lb)
(let ((get-next
(lambda ()
(cond (cond
((null? (lex-buffer-from lb)) ((null? (lex-buffer-from lb))
(read-char (lex-buffer-ip lb))) (read-char (lex-buffer-ip lb)))
(else (else
(begin0 (begin0
(car (lex-buffer-from lb)) (car (lex-buffer-from lb))
(set-lex-buffer-from! lb (cdr (lex-buffer-from lb))))))))) (set-lex-buffer-from! lb (cdr (lex-buffer-from lb)))))))
;; next-char: lex-buf -> c
;; gets the next character from the buffer
(define (next-char lb)
(let ((char-in (let ((char-in
(let ((real-char (get-next))) (let ((real-char (get-next lb)))
(if (eq? #\return real-char) (if (eq? #\return real-char)
(let ((second-char (get-next))) (let ((second-char (get-next)))
(if (not (eq? second-char #\newline)) (if (not (eq? second-char #\newline))
@ -125,7 +125,7 @@
(else (else
(set-lex-buffer-col! lb (add1 (lex-buffer-col lb))))) (set-lex-buffer-col! lb (add1 (lex-buffer-col lb)))))
(set-lex-buffer-offset! lb (add1 (lex-buffer-offset lb))) (set-lex-buffer-offset! lb (add1 (lex-buffer-offset lb)))
char-in))) char-in))
;; push-back: lex-buf * int -> c list ;; push-back: lex-buf * int -> c list
;; pushes the last read i characters back to be read again ;; pushes the last read i characters back to be read again

Loading…
Cancel
Save