+;;; @ stext parser
+;;;
+
+(defun www-xml-parse-string (string)
+ (require 'xml)
+ (nthcdr
+ 2
+ (car
+ (with-temp-buffer
+ (insert "<top>")
+ (insert string)
+ (insert "</top>")
+ (xml-parse-region (point-min)(point-max))))))
+
+(defun www-xml-to-stext-props (props)
+ (let (dest)
+ (dolist (cell props)
+ (setq dest (cons (cdr cell)
+ (cons (intern (format ":%s" (car cell)))
+ dest))))
+ (nreverse dest)))
+
+(defun www-xml-to-stext-unit (unit)
+ (let (name props children)
+ (cond
+ ((stringp unit)
+ unit)
+ ((consp unit)
+ (setq name (car unit))
+ (if (stringp name)
+ nil
+ (setq props (www-xml-to-stext-props (nth 1 unit))
+ children (nthcdr 2 unit))
+ (if children
+ (setq children (www-xml-to-stext-list children)))
+ (when (and (eq name 'link)
+ (consp (car children))
+ (eq (caar children) 'ref))
+ (setq props (list* :ref (nthcdr 2 (car children))
+ props)
+ children (cdr children)))
+ (if children
+ (list* name props children)
+ (if props
+ (list name props)
+ (list name))))
+ )
+ (t
+ (format "%S" unit)))))
+
+(defun www-xml-to-stext-list (trees)
+ (cond
+ ((atom trees)
+ (www-xml-to-stext-unit trees)
+ )
+ ((equal trees '(("")))
+ nil)
+ (t
+ (mapcar #'www-xml-to-stext-unit
+ trees))))
+
+(defun www-stext-parse-xml-string (string)
+ (www-xml-to-stext-list
+ (www-xml-parse-string string)))
+
+
+;;; @ parser
+;;;
+
+(defun www-parse-string-default (string)
+ (setq string (decode-uri-string string 'utf-8-mcs-er))
+ (condition-case nil
+ ;; (let ((ret
+ ;; (mapcar #'read (split-string string " "))))
+ ;; (if (cdr ret)
+ ;; ret
+ ;; (car ret)))
+ (let ((i 0)
+ (len (length string))
+ dest ret)
+ (while (< i len)
+ (setq ret (read-from-string string i))
+ (setq dest (cons (car ret) dest)
+ i (cdr ret)))
+ (if (cdr dest)
+ (nreverse dest)
+ (if (atom (car dest))
+ (car dest)
+ (nreverse dest))))
+ (error nil)))
+
+(defun www-parse-string-as-space-separated-char-list (string genre)