tm 7.106.
[elisp/tm.git] / tl-header.el
index 262ba1c..fe37fec 100644 (file)
@@ -1,12 +1,12 @@
 ;;;
-;;; $Id: tl-header.el,v 4.2 1994/08/03 04:39:55 morioka Exp $
+;;; $Id: tl-header.el,v 5.2 1994/12/07 07:29:33 morioka Exp $
 ;;;
 
 (provide 'tl-header)
 
-(defconst message/quoted-string-regexp "\".*\"")
+(defconst message/quoted-string-regexp "\"[^\"]*\"")
 (defconst message/field-name-regexp "^[!-9;-~]+:")
-(defconst message/field-body-regexp ".*\\(\n[ \t]+.*\\)*")
+(defconst message/field-body-regexp ".*\\(\n[ \t].*\\)*")
 (defconst message/field-regexp
   (concat message/field-name-regexp
          message/field-body-regexp))
       nil)
     ))
 
+(defun message::match-ctexts (str)
+  (if (string-match "^[^()\\\\]+" str)
+      (let ((e (match-end 0)))
+       (list (substring str 0 e)(substring str e))
+       )))
+
+(defun message::match-comment (str)
+  (catch 'tag
+    (if (and (>= (length str) 2)
+            (= (elt str 0) ?\()
+            )
+       (let ((dest "") ret)
+         (setq str (substring str 1))
+         (while (cond ((string= str "")
+                       (throw 'tag nil)
+                       )
+                      ((not (= (elt str 0) ?\)))
+                       (setq ret (or (message::match-ctexts str)
+                                     (message::match-comment str)
+                                     ))
+                       ))
+           (setq dest (concat dest (car ret)))
+           (setq str (nth 1 ret))
+           )
+         (if (= (elt str 0) ?\))
+             (list (concat "(" dest ")") (substring str 1))
+           )
+         ))))
+
 (defun message/parse-comment (str)
   (if (string-match "^\\s +" str)
       (setq str (substring str (match-end 0)))
     )
-  (if (string-match "^([^,]*)" str)
-      (list (list "(" (substring str 1 (- (match-end 0) 1)) ")")
-           (substring str (match-end 0))
-           )
-    ))
+  (let ((ret (message::match-comment str)))
+    (if ret
+       (list (list "(" (substring (car ret) 1 (- (length (car ret)) 1))
+                   ")")
+             (nth 1 ret)
+             )
+      )))
 
 (defun message/parse-address (str)
   (let ((ret (or
       )
     (concat dest str)
     ))
+
+(defun message/strip-quoted-string (str)
+  (let ((max (- (length str) 1))
+       )
+    (if (and (eq (elt str 0) ?\")
+            (eq (elt str max) ?\")
+            )
+       (substring str 1 max)
+      str)))