(nnrss-wash-html-in-text-plain-parts): New variable.
[gnus] / lisp / ietf-drums.el
1 ;;; ietf-drums.el --- Functions for parsing RFC822bis headers
2
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;;   2005 Free Software Foundation, Inc.
5
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 ;;; Commentary:
25
26 ;; DRUMS is an IETF Working Group that works (or worked) on the
27 ;; successor to RFC822, "Standard For The Format Of Arpa Internet Text
28 ;; Messages".  This library is based on
29 ;; draft-ietf-drums-msg-fmt-05.txt, released on 1998-08-05.
30
31 ;; Pending a real regression self test suite, Simon Josefsson added
32 ;; various self test expressions snipped from bug reports, and their
33 ;; expected value, below.  I you believe it could be useful, please
34 ;; add your own test cases, or write a real self test suite, or just
35 ;; remove this.
36
37 ;; <m3oekvfd50.fsf@whitebox.m5r.de>
38 ;; (ietf-drums-parse-address "'foo' <foo@example.com>")
39 ;; => ("foo@example.com" . "'foo'")
40
41 ;;; Code:
42
43 (eval-when-compile (require 'cl))
44 (require 'time-date)
45 (require 'mm-util)
46
47 (defvar ietf-drums-no-ws-ctl-token "\001-\010\013\014\016-\037\177"
48   "US-ASCII control characters excluding CR, LF and white space.")
49 (defvar ietf-drums-text-token "\001-\011\013\014\016-\177"
50   "US-ASCII characters excluding CR and LF.")
51 (defvar ietf-drums-specials-token "()<>[]:;@\\,.\""
52   "Special characters.")
53 (defvar ietf-drums-quote-token "\\"
54   "Quote character.")
55 (defvar ietf-drums-wsp-token " \t"
56   "White space.")
57 (defvar ietf-drums-fws-regexp
58   (concat "[" ietf-drums-wsp-token "]*\n[" ietf-drums-wsp-token "]+")
59   "Folding white space.")
60 (defvar ietf-drums-atext-token "-^a-zA-Z0-9!#$%&'*+/=?_`{|}~"
61   "Textual token.")
62 (defvar ietf-drums-dot-atext-token "-^a-zA-Z0-9!#$%&'*+/=?_`{|}~."
63   "Textual token including full stop.")
64 (defvar ietf-drums-qtext-token
65   (concat ietf-drums-no-ws-ctl-token "\041\043-\133\135-\177")
66   "Non-white-space control characters, plus the rest of ASCII excluding
67 backslash and doublequote.")
68 (defvar ietf-drums-tspecials "][()<>@,;:\\\"/?="
69   "Tspecials.")
70
71 (defvar ietf-drums-syntax-table
72   (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
73     (modify-syntax-entry ?\\ "/" table)
74     (modify-syntax-entry ?< "(" table)
75     (modify-syntax-entry ?> ")" table)
76     (modify-syntax-entry ?@ "w" table)
77     (modify-syntax-entry ?/ "w" table)
78     (modify-syntax-entry ?* "_" table)
79     (modify-syntax-entry ?\; "_" table)
80     (modify-syntax-entry ?\' "_" table)
81     (if (featurep 'xemacs)
82         (let ((i 128))
83           (while (< i 256)
84             (modify-syntax-entry i "w" table)
85             (setq i (1+ i)))))
86     table))
87
88 (defun ietf-drums-token-to-list (token)