X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=std11-parse.el;h=9139530cb94b3a4e2a9480639619cb4b1bf016a6;hb=f2c53adc1093ecc0df0f2a835973ca29f0895f84;hp=681b8a007d84f95b0432ce741762e6a54b702380;hpb=96804c3e952cc713724b162f9dadd4b7956e5e64;p=elisp%2Fapel.git diff --git a/std11-parse.el b/std11-parse.el index 681b8a0..9139530 100644 --- a/std11-parse.el +++ b/std11-parse.el @@ -1,13 +1,12 @@ ;;; std11-parse.el --- STD 11 parser for GNU Emacs -;; Copyright (C) 1995,1996 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. -;; Author: MORIOKA Tomohiko +;; Author: MORIOKA Tomohiko ;; Keywords: mail, news, RFC 822, STD 11 -;; Version: -;; $Id: std11-parse.el,v 0.13 1996-10-01 13:29:39 morioka Exp $ +;; Version: $Id: std11-parse.el,v 1.1 1998-02-04 07:21:11 morioka Exp $ -;; This file is part of tl (Tiny Library). +;; This file is part of MU (Message Utilities). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -20,8 +19,8 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with This program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: @@ -34,10 +33,13 @@ ;;; (defconst std11-space-chars " \t\n") -(defconst std11-spaces-regexp (concat "[" std11-space-chars "]+")) -(defconst std11-special-chars "][()<>@,;:\\<>.\"") +(defconst std11-spaces-regexp (` (, (concat "[" std11-space-chars "]+")))) +(defconst std11-special-char-list '(?\] ?\[ + ?\( ?\) ?< ?> ?@ + ?, ?\; ?: ?\\ ?\" + ?.)) (defconst std11-atom-regexp - (concat "^[^" std11-special-chars std11-space-chars "]+")) + (` (, (concat "^[^" std11-special-char-list std11-space-chars "]+")))) (defun std11-analyze-spaces (string) (if (and (string-match std11-spaces-regexp string) @@ -49,8 +51,7 @@ (defun std11-analyze-special (str) (if (and (> (length str) 0) - (find (aref str 0) std11-special-chars) - ) + (memq (aref str 0) std11-special-char-list)) (cons (cons 'specials (substring str 0 1)) (substring str 1) ))) @@ -68,7 +69,7 @@ ) (if (and (> len i) (eq (aref str i) open)) - (let (p chr dest) + (let (p chr) (setq i (1+ i)) (catch 'tag (while (< i len) @@ -162,12 +163,12 @@ (let (token itl parsed token-value) (while (and lal (setq token (car lal)) - (if (and (setq token-value (cdr token)) - (find-non-ascii-charset-string token-value) - ) - (setq token nil) - (std11-ignored-token-p token) - )) + (or (std11-ignored-token-p token) + (if (and (setq token-value (cdr token)) + (find-non-ascii-charset-string token-value) + ) + (setq token nil) + ))) (setq lal (cdr lal)) (setq itl (cons token itl)) ) @@ -433,6 +434,24 @@ (nreverse dest) )))) +(defun std11-parse-msg-id (lal) + (let ((ret (std11-parse-ascii-token lal)) + < addr-spec >) + (if (and ret + (setq < (car ret)) + (string-equal (cdr (assq 'specials <)) "<") + (setq lal (cdr ret)) + (setq ret (std11-parse-addr-spec lal)) + (setq addr-spec (car ret)) + (setq lal (cdr ret)) + (setq ret (std11-parse-ascii-token lal)) + (setq > (car ret)) + (string-equal (cdr (assq 'specials >)) ">") + ) + (cons (cons 'msg-id (cdr addr-spec)) + (cdr ret)) + ))) + ;;; @ end ;;;