Commit fc1f6cec authored by asmyles's avatar asmyles

more uri syntax stuff

darcs-hash:c2e23f96458a4b7b13f2ca1b3d037186b2e43542
parent b9017d1c
......@@ -31,3 +31,21 @@
(uri (read stream t nil t))))
(set-dispatch-macro-character (char uri-dmc 0) (char uri-dmc 1) readtable)))
(defmacro with-uri-syntax ((uri-dmc) &body body)
`(let ((*readtable* (copy-readtable))
(*print-pprint-dispatch* (copy-pprint-dispatch)))
(set-uri-reader-syntax ,uri-dmc)
(set-uri-printer-syntax ,uri-dmc)
,@body))
(defmacro using-topicmap-syntax (uri-dmc)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(topicmap:set-uri-reader-syntax ,uri-dmc)))
;this temporarily overides print-object from uri
(defun set-uri-printer-syntax (uri-dmc &optional (table *print-pprint-dispatch*))
(flet ((uri (stream uri)
(if *print-escape*
(format stream "~A~A" uri-dmc uri)
(print-object stream uri))))
(set-pprint-dispatch 'uri (function uri) 1 table)))
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