From 455fbc51bf249577ee2f22916d21c725f171b473 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 18 Jul 1998 23:22:33 +0000 Subject: [PATCH] * (TESTPAT): add test result by FLIM-FLAM. * eword-decode.el (eword-lexical-analyze-internal): restrict calling `eword-analyze-encoded-word' after calling `eword-analyze-spaces'. --- ChangeLog | 8 ++++++++ TESTPAT | 31 ++++++++++++++++++++++++++++++- eword-decode.el | 25 ++++++++++++++++--------- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 059c0f9..a6e8ccc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 1998-07-18 Tanaka Akira + * (TESTPAT): add test result by FLIM-FLAM. + + * eword-decode.el (eword-lexical-analyze-internal): restrict + calling `eword-analyze-encoded-word' after calling + `eword-analyze-spaces'. + +1998-07-18 Tanaka Akira + * (TESTPAT): add test. * eword-decode.el (eword-analyze-quoted-string): quote string as diff --git a/TESTPAT b/TESTPAT index 82f0605..5df90d1 100644 --- a/TESTPAT +++ b/TESTPAT @@ -76,6 +76,7 @@ "From: Nathaniel Borenstein (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)" "From: Nathaniel Borenstein (.HNmNeNlNy NoNa NiNlNhNtNp)")*B +; FLIM-FLAM (decode "From: foo@bar.baz (=?ISO-8859-1?Q?a?=)" @@ -171,16 +172,19 @@ "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=\\a=?ISO-2022-JP?B?GyRCJCQbKEI=?=)" "From: akr@jaist.ac.jp ($B$"(B\\a$B$$(B)") +; FLIM-FLAM (decode "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=a=?ISO-2022-JP?B?GyRCJCQbKEI=?=)" "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=a=?ISO-2022-JP?B?GyRCJCQbKEI=?=)") +; FLIM-FLAM (decode "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=(=?ISO-2022-JP?B?GyRCJCQbKEI=?=)=?ISO-2022-JP?B?GyRCJCYbKEI=?=)" "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=(=?ISO-2022-JP?B?GyRCJCQbKEI=?=)=?ISO-2022-JP?B?GyRCJCYbKEI=?=)") +; FLIM-FLAM (decode "From: akr@jaist.ac.jp @@ -193,6 +197,7 @@ "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=(=?ISO-2022-JP?B?GyRCJCQbKEI=?=)=?ISO-2022-JP?B?GyRCJCYbKEI=?=)" 'ignore-76bytes-limit) +; FLIM-FLAM (decode "From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?= @@ -206,6 +211,7 @@ =?ISO-2022-JP?B?GyhC?=(=?ISO-2022-JP?B?GyRCJCQbKEI=?= =?ISO-2022-JP?B?GyhC?=)=?ISO-2022-JP?B?GyRCJCYbKEI=?=)" 'zero-characters-encoded-word-hack) +; FLIM-FLAM (decode "From: a=?ISO-2022-JP?B?GyRCJCIbKEI=?= " @@ -269,6 +275,7 @@ (decode "From: < =?ISO-2022-JP?B?GyRCJCIbKEI=?= @jaist.ac.jp>" "From: < =?ISO-2022-JP?B?GyRCJCIbKEI=?= @jaist.ac.jp>") +; FLIM-FLAM (decode "From: =?ISO-2022-JP?Q?=1B=24BAA=1B=28B?= " @@ -285,6 +292,7 @@ (encode "From: \"$B$"(B($B$"(B)\" " "From: =?ISO-2022-JP?B?GyRCJCIbKEIoGyRCJCIbKEIp?= ") +; FLIM-FLAM (decode "From: =?ISO-2022-JP?B?GyRCJCIbKEIoGyRCJCIbKEIp?= " @@ -294,18 +302,21 @@ "From: $B$"(B($B$"(B) " "From: =?ISO-2022-JP?B?GyRCJCIbKEIoGyRCJCIbKEIp?= " 'encode-sticked-comment-as-atom) +; FLIM-FLAM (encode "From: $B$"(B($B$"(B) " "From: =?ISO-2022-JP?B?GyRCJCIbKEI=?=(=?ISO-2022-JP?B?GyRCJCIbKEI=?=) " 'permit-sticked-comment) +; FLIM-FLAM (encode "From: $B$"(B($B$"(B) " "From: =?ISO-2022-JP?B?GyRCJCIbKEI=?= (=?ISO-2022-JP?B?GyRCJCIbKEI=?=) " 'separate-sticked-comment) +; FLIM-FLAM (decode "From: =?ISO-2022-JP?B?GyRCJCIbKEI=?=(=?ISO-2022-JP?B?GyRCJCIbKEI=?=) @@ -324,6 +335,7 @@ (encode "From: \"a\\\"b$B$"(Bc\\\\\" " "From: =?ISO-2022-JP?B?YSJiGyRCJCIbKEJjXA==?= ") +; FLIM-FLAM (decode "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=" @@ -338,6 +350,7 @@ "To: $B$"(B" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=" 'permit-sticked-special) +; FLIM-FLAM (encode "To: $B$"(B" @@ -357,6 +370,7 @@ "To: ,$B$"(B" "To: ,=?ISO-2022-JP?B?GyRCJCIbKEI=?=" 'permit-sticked-special) +; FLIM-FLAM (encode "To: ,$B$"(B" @@ -376,6 +390,7 @@ "To: akr@jaist.ac.jp,$B$"(B" "To: akr@jaist.ac.jp,=?ISO-2022-JP?B?GyRCJCIbKEI=?=" 'permit-sticked-special) +; FLIM-FLAM (encode "To: akr@jaist.ac.jp,$B$"(B" @@ -395,11 +410,13 @@ "To: $B$"(B:akr@jaist.ac.jp;" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=:akr@jaist.ac.jp;" 'permit-sticked-special) +; FLIM-FLAM (encode "To: $B$"(B:akr@jaist.ac.jp;" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?= :akr@jaist.ac.jp;" 'separate-sticked-special) +; FLIM-FLAM (decode "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=:=?ISO-2022-JP?B?GyRCJCQbKEI=?=;" @@ -414,18 +431,21 @@ "To: $B$"(B:$B$$(B;" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=:=?ISO-2022-JP?B?GyRCJCQbKEI=?=;" 'ignore-76bytes-limit 'permit-sticked-special) +; FLIM-FLAM (encode "To: $B$"(B:$B$$(B;" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=:=?ISO-2022-JP?B?GyRCJCQbKEI=?= =?ISO-2022-JP?B?GyhC?=;" 'zero-characters-encoded-word-hack 'permit-sticked-special) +; FLIM-FLAM (encode "To: $B$"(B:$B$$(B;" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?= : =?ISO-2022-JP?B?GyRCJCQbKEI=?= ;" 'separate-sticked-special) +; FLIM-FLAM (decode "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=:=?ISO-2022-JP?B?GyRCJCQbKEI=?=,=?ISO-2022-JP?B?GyRCJCYbKEI=?=;,=?ISO-2022-JP?B?GyRCJCgbKEI=?=" @@ -440,6 +460,7 @@ "To: $B$"(B:$B$$(B,$B$&(B;,$B$((B" "To: =?ISO-2022-JP?B?GyRCJCIbKEI=?=:=?ISO-2022-JP?B?GyRCJCQbKEI=?=,=?ISO-2022-JP?B?GyRCJCYbKEI=?=;,=?ISO-2022-JP?B?GyRCJCgbKEI=?=" 'ignore-76bytes-limit 'permit-sticked-special) +; FLIM-FLAM (encode "To: $B$"(B:$B$$(B,$B$&(B;,$B$((B" @@ -447,6 +468,7 @@ =?ISO-2022-JP?B?GyhC?=,=?ISO-2022-JP?B?GyRCJCYbKEI=?= =?ISO-2022-JP?B?GyhC?=;,=?ISO-2022-JP?B?GyRCJCgbKEI=?=" 'zero-characters-encoded-word-hack 'permit-sticked-special) +; FLIM-FLAM (encode "To: $B$"(B:$B$$(B,$B$&(B;,$B$((B" @@ -454,6 +476,7 @@ , =?ISO-2022-JP?B?GyRCJCYbKEI=?= ;, =?ISO-2022-JP?B?GyRCJCgbKEI=?= " 'separate-sticked-special) +; FLIM-FLAM (decode "Subject: =?ISO-2022-JP?B?GyRCJCIbKEI=?=" @@ -514,17 +537,19 @@ (decode "Subject: =?US-ASCII?Q?a=0D=0A_b?=" "Subject: a b") +; FLIM-FLAM (decode "Subject: =?ISO-2022-JP?B?GyRCJCIbKEI=?= a =?ISO-2022-JP?B?GyRCJCQbKEI=?=" -"From: $B$"(B a $B$$(B") +"Subject: $B$"(B a $B$$(B") (encode "Subject: $B0$(B $BR_(B" "Subject: =?ISO-2022-JP?B?GyRCMCQbKEIgICAgICAgICAgICAgICAgICAgICAgICAgICAg?= =?US-ASCII?Q?____________________________________________________________?= =?ISO-2022-JP?B?ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBskQlJfGyhC?=") +; FLIM-FLAM (decode "Subject: =?ISO-2022-JP?B?GyRCMCQbKEIgICAgICAgICAgICAgICAgICAgICAgICAgICAg?= @@ -536,6 +561,7 @@ "Subject: $B0$(B $BR_(B" "Subject: =?ISO-2022-JP?B?GyQpQrCkICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDS3w==" 'ignore-76bytes-limit 'ignore-75bytes-limit) +; FLIM-FLAM (decode "Subject:=?ISO-2022-JP?B?GyRCJCIbKEI=?=" @@ -557,10 +583,12 @@ (encode "From: \"abcdefghijklmnopqrst.AN!()\\\"\\\\\" "*B "From: =?ISO-8859-1?Q?abcdefghijklmnopqrst=A1=28=29=22=5C?= ") +; FLIM-FLAM (encode "From: akr@jaist.ac.jp (abcdefghijklmnopqrst.AN!\\(\\)\"\\\\)"*B "From: akr@jaist.ac.jp (=?ISO-8859-1?Q?abcdefghijklmnopqrst=A1=28=29\"=5C?=)") +; FLIM-FLAM (decode "Subject: ?= =?" @@ -597,6 +625,7 @@ (encode "Subject: .HN`$BNm(B"*B "Subject: =?ISO-8859-8?Q?=E0?= =?ISO-2022-JP?B?GyRCTm0bKEI=?=") +; FLIM-FLAM (decode "Subject: =?ISO-8859-8?Q?=E0_?= =?ISO-2022-JP?B?GyRCTm0bKEI=?=" diff --git a/eword-decode.el b/eword-decode.el index c8a4a0f..4663610 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -644,17 +644,24 @@ be the result." )))) (defun eword-lexical-analyze-internal (string must-unfold) - (let (dest ret) + (let ((last 'eword-analyze-spaces) + dest ret) (while (not (string-equal string "")) (setq ret - (let ((rest eword-lexical-analyzers) - func r) - (while (and (setq func (car rest)) - (null (setq r (funcall func string must-unfold))) - ) - (setq rest (cdr rest))) - (or r `((error . ,string) . "")) - )) + (let ((rest eword-lexical-analyzers) + func r) + (while (and (setq func (car rest)) + (or + (and + (not eword-decode-sticked-encoded-word) + (not (eq last 'eword-analyze-spaces)) + (eq func 'eword-analyze-encoded-word)) + (null (setq r (funcall func string must-unfold)))) + ) + (setq rest (cdr rest))) + (setq last func) + (or r `((error . ,string) . "")) + )) (setq dest (cons (car ret) dest)) (setq string (cdr ret)) ) -- 1.7.10.4