Permalink
Browse files

Rename READ-UNTIL to PARSE

  • Loading branch information...
davazp committed Dec 27, 2011
1 parent 03e619d commit 6f9655c2bca1d0fb6b34b068eb49e45a3c8cfd62
Showing with 9 additions and 9 deletions.
  1. +5 −5 content-line.lisp
  2. +1 −1 types-duration.lisp
  3. +2 −2 types.lisp
  4. +1 −1 utils.lisp
View
@@ -23,9 +23,9 @@
(defun read-params-value (stream)
(if (char= (peek-char nil stream) #\")
(prog2 (read-char stream)
- (read-until stream "#\"" #\newline)
+ (parse stream "#\"" #\newline)
(read-char stream))
- (read-until stream ",;:" #\Newline)))
+ (parse stream ",;:" #\Newline)))
(defun read-params-values (stream)
(cons (read-params-value stream)
@@ -38,7 +38,7 @@
(let ((plist nil)
(count 0))
(while (char= (read-char stream) #\;)
- (let ((name (read-until stream "=" (coerce #(#\Newline #\: #\;) 'string))))
+ (let ((name (parse stream "=" (coerce #(#\Newline #\: #\;) 'string))))
(read-char stream)
(push (read-params-values stream) plist)
(push name plist)
@@ -54,7 +54,7 @@
(char= ch #\space)
(char= ch #\tab))
do (read-char stream))
- (values (read-until stream ";:" #\Newline)
+ (values (parse stream ";:" #\Newline)
(read-params stream)
(read-line stream)))
@@ -76,7 +76,7 @@
(defun write-content-line (name params value stream)
(declare (stream stream))
- (format stream "~a~{;~a=~{~a~^,~}~}:~a~%"
+ (format stream "~a~{;~a=~{~a~^,~}~}:~a~%"
name
(loop for (param values)
on (list-parameters (parameter-table params)) by #'cddr
View
@@ -174,7 +174,7 @@
((digit-char-p ch)
(values
(parse-integer
- (read-until in (complement #'digit-char-p) "" nil))))
+ (parse in (complement #'digit-char-p) "" nil))))
(t
(read-char in)))))
;; Return the following token, then upgrade the
View
@@ -155,14 +155,14 @@
(setf sign -1)
(read-char in)))
;; Read integer part
- (let ((istring (read-until in (complement #'digit-char-p) nil nil)))
+ (let ((istring (parse in (complement #'digit-char-p) nil nil)))
(setf x (parse-integer istring)))
;; Read fractinal part (if any)
(let ((dot (read-char in nil)))
(unless (null dot)
(unless (char= dot #\.)
(%parse-error "Bad formed float."))
- (let ((fstring (read-until in (complement #'digit-char-p) nil nil)))
+ (let ((fstring (parse in (complement #'digit-char-p) nil nil)))
(setf y (/ (float (parse-integer fstring))
(expt 10 (length fstring))))))))
(* sign (+ x y))))
View
@@ -286,7 +286,7 @@
;;; Read characters from STREAM until it finds a char of CHAR-BAG. If
;;; it finds a NON-EXPECT character, it signals an error. If an end of
;;; file condition is signaled and EOF-ERROR-P is nil, return nil.
-(defun read-until (stream char-bag &optional (not-expect "") (eof-error-p t))
+(defun parse (stream char-bag &optional (not-expect "") (eof-error-p t))
(flet (;; Check if CH is a terminal char
(terminal-char-p (ch)
(etypecase char-bag

0 comments on commit 6f9655c

Please sign in to comment.