1 ;;; std11-parse.el --- STD 11 parser for GNU Emacs
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, RFC 822, STD 11
7 ;; Version: $Id: std11-parse.el,v 0.4 1996-08-28 17:25:56 morioka Exp $
9 ;; This file is part of tl (Tiny Library).
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with This program; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
34 (defconst std11-space-chars " \t\n")
35 (defconst std11-spaces-regexp (concat "^[" std11-space-chars "]+"))
36 (defconst std11-special-chars "][()<>@,;:\\<>.\"")
37 (defconst std11-atom-regexp
38 (concat "^[^" std11-special-chars std11-space-chars "]+"))
40 (defun std11-analyze-spaces (str)
41 (if (string-match std11-spaces-regexp str)
42 (let ((end (match-end 0)))
43 (cons (cons 'spaces (substring str 0 end))
47 (defun std11-analyze-special (str)
48 (if (and (> (length str) 0)
49 (find (aref str 0) std11-special-chars)
51 (cons (cons 'specials (substring str 0 1))
55 (defun std11-analyze-atom (str)
56 (if (string-match std11-atom-regexp str)
57 (let ((end (match-end 0)))
58 (cons (cons 'atom (substring str 0 end))
62 (defun std11-analyze-quoted-string (str)
63 (let ((len (length str)))
65 (eq (aref str 0) ?\"))
69 (setq chr (aref str i))
75 (setq dest (concat dest (char-to-string (aref str i))))
79 (cons (cons 'quoted-string dest)
80 (substring str (1+ i)))
84 (setq dest (concat dest (char-to-string (aref str i))))
93 (provide 'std11-parse)
95 ;;; std11-parse.el ends here