Commit 472dff42 authored by Vladimir Sedach's avatar Vladimir Sedach

Replaced list character accumulator with vector-push-extend in template reader.

parent efc4a5fe
......@@ -16,18 +16,18 @@ True by default.")
read URI templates from your own dispatch character."
(let ((*readtable* (copy-readtable))
(template-accumulator ())
(string-accumulator ())
(string-accumulator #1=(make-array 10 :element-type 'character :adjustable t :fill-pointer 0))
(next-char))
(set-syntax-from-char #\} #\))
(flet ((collect-string ()
(when string-accumulator
(push (coerce (reverse string-accumulator) 'string) template-accumulator)
(setf string-accumulator ()))))
(when (< 0 (length string-accumulator))
(push string-accumulator template-accumulator)
(setf string-accumulator #1#))))
(loop until (member (setf next-char (read-char stream nil #\Space recursive-p)) '(#\Space #\Newline #\Tab #\)))
do (if (char= #\{ next-char)
(progn (collect-string)
(push `(maybe-uri-encode (progn ,@(read-delimited-list #\} stream))) template-accumulator))
(push next-char string-accumulator))
(vector-push-extend next-char string-accumulator))
finally (unread-char next-char stream) (collect-string))
(reverse template-accumulator))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment