annotate lisp/mu/std11-parse.el @ 8:4b173ad71786 r19-15b5

Import from CVS: tag r19-15b5
author cvs
date Mon, 13 Aug 2007 08:47:35 +0200
parents b82b59fe008d
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; std11-parse.el --- STD 11 parser for GNU Emacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; Keywords: mail, news, RFC 822, STD 11
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Version:
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
8 ;; $Id: std11-parse.el,v 1.2 1996/12/22 00:29:20 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;; This file is part of MU (Message Utilities).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 (require 'std11)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 (require 'emu)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 ;;; @ lexical analyze
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 (defconst std11-space-chars " \t\n")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 (defconst std11-spaces-regexp (concat "[" std11-space-chars "]+"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (defconst std11-special-chars "][()<>@,;:\\<>.\"")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 (defconst std11-atom-regexp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 (concat "^[^" std11-special-chars std11-space-chars "]+"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 (defun std11-analyze-spaces (string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 (if (and (string-match std11-spaces-regexp string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 (= (match-beginning 0) 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 (let ((end (match-end 0)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (cons (cons 'spaces (substring string 0 end))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 (substring string end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (defun std11-analyze-special (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (if (and (> (length str) 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 (find (aref str 0) std11-special-chars)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (cons (cons 'specials (substring str 0 1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (substring str 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (defun std11-analyze-atom (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (if (string-match std11-atom-regexp str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 (let ((end (match-end 0)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 (cons (cons 'atom (substring str 0 end))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (substring str end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (defun std11-check-enclosure (str open close &optional recursive from)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 (let ((len (length str))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (i (or from 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (if (and (> len i)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (eq (aref str i) open))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (let (p chr)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (setq i (1+ i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 (catch 'tag
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (while (< i len)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (setq chr (aref str i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (cond ((eq chr ?\\)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (setq i (1+ i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (if (>= i len)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (throw 'tag nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (setq i (1+ i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 ((eq chr close)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 (throw 'tag (1+ i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 ((eq chr open)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 (if (and recursive
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (setq p (std11-check-enclosure
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 str open close recursive i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (setq i p)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (throw 'tag nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (setq i (1+ i))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 ))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (defun std11-analyze-quoted-string (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (let ((p (std11-check-enclosure str ?\" ?\")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (if p
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (cons (cons 'quoted-string (substring str 1 (1- p)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (substring str p))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 (defun std11-analyze-domain-literal (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 (let ((p (std11-check-enclosure str ?\[ ?\])))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (if p
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (cons (cons 'domain-literal (substring str 1 (1- p)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 (substring str p))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (defun std11-analyze-comment (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (let ((p (std11-check-enclosure str ?\( ?\) t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (if p
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (cons (cons 'comment (substring str 1 (1- p)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (substring str p))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (defun std11-lexical-analyze (str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (let (dest ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 (while (not (string-equal str ""))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (setq ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 (or (std11-analyze-quoted-string str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (std11-analyze-domain-literal str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (std11-analyze-comment str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (std11-analyze-spaces str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (std11-analyze-special str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (std11-analyze-atom str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 '((error) . "")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (setq dest (cons (car ret) dest))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (setq str (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 (nreverse dest)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 ;;; @ parser
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (defun std11-ignored-token-p (token)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 (let ((type (car token)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (or (eq type 'spaces)(eq type 'comment))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (defun std11-parse-token (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 (let (token itl)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (while (and lal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (setq token (car lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (std11-ignored-token-p token)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 (setq lal (cdr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 (setq itl (cons token itl))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (cons (nreverse (cons token itl))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (cdr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 (defun std11-parse-ascii-token (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (let (token itl parsed token-value)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (while (and lal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 (setq token (car lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 (if (and (setq token-value (cdr token))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 (find-non-ascii-charset-string token-value)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 (setq token nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 (std11-ignored-token-p token)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (setq lal (cdr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (setq itl (cons token itl))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 (if (and token
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 (setq parsed (nreverse (cons token itl)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 (cons parsed (cdr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (defun std11-parse-token-or-comment (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 (let (token itl)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (while (and lal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (setq token (car lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (eq (car token) 'spaces)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (setq lal (cdr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 (setq itl (cons token itl))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 (cons (nreverse (cons token itl))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (cdr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 (defun std11-parse-word (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (let ((ret (std11-parse-ascii-token lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 (let ((elt (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (rest (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 (if (or (assq 'atom elt)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 (assq 'quoted-string elt))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 (cons (cons 'word elt) rest)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 )))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 (defun std11-parse-word-or-comment (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 (let ((ret (std11-parse-token-or-comment lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 (let ((elt (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 (rest (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211 (cond ((or (assq 'atom elt)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212 (assq 'quoted-string elt))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213 (cons (cons 'word elt) rest)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
214 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215 ((assq 'comment elt)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216 (cons (cons 'comment-word elt) rest)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
217 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 (defun std11-parse-phrase (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221 (let (ret phrase)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222 (while (setq ret (std11-parse-word-or-comment lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 (setq phrase (append phrase (cdr (car ret))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 (if phrase
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227 (cons (cons 'phrase phrase) lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
228 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
230 (defun std11-parse-local-part (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231 (let ((ret (std11-parse-word lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233 (let ((local-part (cdr (car ret))) dot)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
234 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 (while (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236 (setq dot (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 (string-equal (cdr (assq 'specials dot)) ".")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 (setq ret (std11-parse-word (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239 (setq local-part
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240 (append local-part dot (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
243 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244 (cons (cons 'local-part local-part) lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (defun std11-parse-sub-domain (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 (let ((ret (std11-parse-ascii-token lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 (let ((sub-domain (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 (if (or (assq 'atom sub-domain)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 (assq 'domain-literal sub-domain)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 (cons (cons 'sub-domain sub-domain)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 (cdr ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 )))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 (defun std11-parse-domain (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260 (let ((ret (std11-parse-sub-domain lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 (let ((domain (cdr (car ret))) dot)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (while (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 (setq dot (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 (string-equal (cdr (assq 'specials dot)) ".")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (setq ret (std11-parse-sub-domain (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 (setq domain
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 (append domain dot (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273 (cons (cons 'domain domain) lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276 (defun std11-parse-at-domain (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 (let ((ret (std11-parse-ascii-token lal)) at-sign)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 (if (and ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279 (setq at-sign (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 (string-equal (cdr (assq 'specials at-sign)) "@")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 (setq ret (std11-parse-domain (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283 (cons (cons 'at-domain (append at-sign (cdr (car ret))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287 (defun std11-parse-addr-spec (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 (let ((ret (std11-parse-local-part lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
289 addr)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
290 (if (and ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
291 (prog1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
292 (setq addr (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
293 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
294 (and (setq ret (std11-parse-at-domain lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
295 (setq addr (append addr (cdr (car ret))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
296 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
297 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
298 (cons (cons 'addr-spec addr) lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
299 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
300
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
301 (defun std11-parse-route (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302 (let ((ret (std11-parse-at-domain lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 route comma colon)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
304 (if (and ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 (setq route (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
307 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
308 (while (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309 (setq comma (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310 (string-equal (cdr (assq 'specials comma)) ",")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (setq ret (std11-parse-at-domain (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 (setq route (append route comma (cdr (car ret))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 (setq colon (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 (string-equal (cdr (assq 'specials colon)) ":")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
319 (setq route (append route colon))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
320 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
322 (cons (cons 'route route)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 (cdr ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
325 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
326
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
327 (defun std11-parse-route-addr (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
328 (let ((ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
329 < route addr-spec >)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
330 (if (and ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
331 (setq < (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
332 (string-equal (cdr (assq 'specials <)) "<")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
333 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
334 (progn (and (setq ret (std11-parse-route lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
335 (setq route (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
336 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
337 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
338 (setq ret (std11-parse-addr-spec lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
339 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 (setq addr-spec (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
341 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
342 (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
343 (setq > (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
344 (string-equal (cdr (assq 'specials >)) ">")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
345 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
346 (cons (cons 'route-addr (append route addr-spec))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
347 (cdr ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
348 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
349 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
350
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
351 (defun std11-parse-phrase-route-addr (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
352 (let ((ret (std11-parse-phrase lal)) phrase)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
353 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
354 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
355 (setq phrase (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
356 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
357 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
358 (if (setq ret (std11-parse-route-addr lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
359 (cons (list 'phrase-route-addr
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
360 phrase
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
361 (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
362 (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
364
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
365 (defun std11-parse-mailbox (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
366 (let ((ret (or (std11-parse-phrase-route-addr lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
367 (std11-parse-addr-spec lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
368 mbox comment)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
369 (if (and ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
370 (prog1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
371 (setq mbox (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
372 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
373 (if (and (setq ret (std11-parse-token-or-comment lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
374 (setq comment (cdr (assq 'comment (car ret))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
375 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
376 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
377 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
378 (cons (list 'mailbox mbox comment)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
379 lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
380 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
381
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
382 (defun std11-parse-group (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
383 (let ((ret (std11-parse-phrase lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
384 phrase colon comma mbox semicolon)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
385 (if (and ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
386 (setq phrase (cdr (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
387 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
388 (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
389 (setq colon (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
390 (string-equal (cdr (assq 'specials colon)) ":")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
391 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
392 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
393 (and (setq ret (std11-parse-mailbox lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
394 (setq mbox (list (car ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
395 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
396 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
397 (while (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
398 (setq comma (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
399 (string-equal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
400 (cdr (assq 'specials comma)) ",")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
401 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
402 (setq ret (std11-parse-mailbox lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
403 (setq mbox (cons (car ret) mbox))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
404 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
405 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
406 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
407 (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
408 (setq semicolon (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
409 (string-equal (cdr (assq 'specials semicolon)) ";")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
410 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
411 (cons (list 'group phrase (nreverse mbox))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
412 (cdr ret)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
413 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
414 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
415
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
416 (defun std11-parse-address (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
417 (or (std11-parse-group lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
418 (std11-parse-mailbox lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
419 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
420
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
421 (defun std11-parse-addresses (lal)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
422 (let ((ret (std11-parse-address lal)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
423 (if ret
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
424 (let ((dest (list (car ret))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
425 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
426 (while (and (setq ret (std11-parse-ascii-token lal))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
427 (string-equal (cdr (assq 'specials (car ret))) ",")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
428 (setq ret (std11-parse-address (cdr ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
429 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
430 (setq dest (cons (car ret) dest))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
431 (setq lal (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
432 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
433 (nreverse dest)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
434 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
435
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
436
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
437 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
438 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
439
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
440 (provide 'std11-parse)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
441
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
442 ;;; std11-parse.el ends here