From: morioka Date: Wed, 28 Aug 1996 17:25:56 +0000 (+0000) Subject: (std11-analyze-quoted-string): New function. X-Git-Tag: XEmacs-20_3-b6~52 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=689b812f9770c8669918b116a48a1ee452feaeb7;p=elisp%2Fapel.git (std11-analyze-quoted-string): New function. --- diff --git a/std11-parse.el b/std11-parse.el index d56b4ff..2514776 100644 --- a/std11-parse.el +++ b/std11-parse.el @@ -4,7 +4,7 @@ ;; Author: MORIOKA Tomohiko ;; Keywords: mail, news, RFC 822, STD 11 -;; Version: $Id: std11-parse.el,v 0.3 1996-08-28 17:15:33 morioka Exp $ +;; Version: $Id: std11-parse.el,v 0.4 1996-08-28 17:25:56 morioka Exp $ ;; This file is part of tl (Tiny Library). @@ -59,6 +59,33 @@ (substring str end) )))) +(defun std11-analyze-quoted-string (str) + (let ((len (length str))) + (if (and (> len 0) + (eq (aref str 0) ?\")) + (let ((i 1) chr dest) + (catch 'tag + (while (< i len) + (setq chr (aref str i)) + (cond ((eq chr ?\\) + (setq i (1+ i)) + (if (>= i len) + (throw 'tag nil) + ) + (setq dest (concat dest (char-to-string (aref str i)))) + ) + ((eq chr ?\") + (throw 'tag + (cons (cons 'quoted-string dest) + (substring str (1+ i))) + ) + ) + (t + (setq dest (concat dest (char-to-string (aref str i)))) + )) + (setq i (1+ i)) + )))))) + ;;; @ end ;;;