diff options
Diffstat (limited to 'load.lisp')
-rw-r--r-- | load.lisp | 30 |
1 files changed, 8 insertions, 22 deletions
@@ -18,39 +18,25 @@ (crit signed-digits) nothing))) (read-from-string - (str:from-list - (remove nil (append base (cons dot fraction) (cons (when e #\d) exponent)))))))) + (coerce + (remove nil (append base (cons dot fraction) (cons (when e #\d) exponent))) + 'string))))) (defparameter string-literal (comp ((_ (unit #\")) (chars (optional (many (one-of (comp ((slash (unit #\\)) (escaped (unit)) (codepoints (if (char= escaped #\u) - (comp ((cp0 (unit digit-char-p)) - (cp1 (unit digit-char-p)) - (cp2 (unit digit-char-p)) - (cp3 (unit digit-char-p))) - (let ((str (make-string 7))) - (setf (char str 0) #\#) - (setf (char str 1) #\\) - (setf (char str 2) #\u) - (setf (char str 3) cp0) - (setf (char str 4) cp1) - (setf (char str 5) cp2) - (setf (char str 6) cp3) - str)) + (repeat (unit digit-char-p) 4) nothing))) (case escaped - (#\n - #\Newline) - (#\t - #\Tab) - (#\u - (read-from-string codepoints)) + (#\n #\Newline) + (#\t #\Tab) + (#\u (read-from-string (coerce (append '(#\# #\\ #\u) codepoints) 'string))) (t escaped))) (unit (and (char/= it #\") (char/= it #\\))))))) (_ (crit (unit #\")))) - (str:from-list chars))) + (coerce chars 'string))) (defparameter true-symbol (comp ((_ (unit #\t)) |