X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=std11-parse.el;h=34d22d3671bf1223b4796972fa09e9b8023009e1;hb=1fe99126318bdf29d6b478fcae5e357a525c0f36;hp=d56b4ff2a38fef771189f6f51e296d0bf76fce1e;hpb=c29b2ad7bd49257ba157b4d5657d6b10308d6568;p=elisp%2Fapel.git diff --git a/std11-parse.el b/std11-parse.el index d56b4ff..34d22d3 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.6 1996-08-28 17:35:10 morioka Exp $ ;; This file is part of tl (Tiny Library). @@ -59,6 +59,40 @@ (substring str end) )))) +(defun std11-analyze-enclosure (str type open close) + (let ((len (length str))) + (if (and (> len 0) + (eq (aref str 0) open)) + (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 close) + (throw 'tag + (cons (cons type dest) (substring str (1+ i))) + ) + ) + (t + (setq dest (concat dest (char-to-string (aref str i)))) + )) + (setq i (1+ i)) + )))))) + +(defun std11-analyze-quoted-string (str) + (std11-analyze-enclosure str 'quoted-string ?\" ?\") + ) + +(defun std11-analyze-domain-literal (str) + (std11-analyze-enclosure str 'domain-literal ?\[ ?\]) + ) + ;;; @ end ;;;