[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mhc:02160] Re: 形式エラーのチェックについて質問



野口です。

先に質問した以下の件につきまして、patch を作成してみました。
X-SC-Time: と X-XC-Alarm: についても、形式違反がある場合にはC-cC-cの際
に警告させます。

From: NOGUCHI Yusuke <nogunogu@xxxxxxxxxxxxxxxxx>
Subject: [mhc:02159] 形式エラーのチェックについて質問
Date: Fri, 30 Sep 2005 13:51:43 +0900 (JST)

> と警告してくれるのですが、X-SC-Time: フィールドでは
> 
>   X-SC-Time: 1000-12:00
> 
> のような不正形式(":"の入力忘れ)としてしまった場合でも、警告せずにその
> まま登録してしまうようです。

以上、ご検討いただければ幸いです。
-- 
NOGUCHI Yusuke <nogunogu@xxxxxxxxxxxxxxxxx>
*** mhc-parse.el.1	Fri Sep 30 13:37:06 2005
--- mhc-parse.el	Mon Oct  3 15:33:46 2005
***************
*** 78,84 ****
     (mhc-eword-decode-string (mhc-parse/continuous-lines)))
    schedule)
  
! (defconst mhc-parse/time-regexp "\\([012][0-9]\\):\\([0-5][0-9]\\)")
  
  (defun mhc-parse/time (record schedule)
    (let ((time (mhc-parse/continuous-lines)))
--- 78,84 ----
     (mhc-eword-decode-string (mhc-parse/continuous-lines)))
    schedule)
  
! (defconst mhc-parse/time-regexp "\\([012]*[0-9]\\):\\([0-5][0-9]\\)")
  
  (defun mhc-parse/time (record schedule)
    (let ((time (mhc-parse/continuous-lines)))
***************
*** 94,100 ****
  		       (string-to-number (match-string 2 time)))))
         ((string-match (concat "^-" mhc-parse/time-regexp "$") time)
  	(setq end (+ (* 60 (string-to-number (match-string 1 time)))
! 		     (string-to-number (match-string 2 time))))))
        (mhc-schedule/set-time schedule begin end)))
    schedule)
  
--- 94,107 ----
  		       (string-to-number (match-string 2 time)))))
         ((string-match (concat "^-" mhc-parse/time-regexp "$") time)
  	(setq end (+ (* 60 (string-to-number (match-string 1 time)))
! 		     (string-to-number (match-string 2 time)))))
!        ((string-match (concat "^" mhc-parse/time-regexp " " mhc-parse/time-regexp "$") time)
! 	)
!        ((string= "" time)
! 	)
!        (t ;; parse error
! 	(error "Parse ERROR!!!(at X-SC-Time:)"))
!        )
        (mhc-schedule/set-time schedule begin end)))
    schedule)
  
***************
*** 103,110 ****
    (mhc-logic-parse-old-style-date (mhc-schedule-condition schedule))
    (mhc-parse/time record schedule))
  
  (defun mhc-parse/alarm (record schedule)
!   (mhc-schedule/set-alarm schedule (mhc-parse/continuous-lines))
    schedule)
  
  (defun mhc-parse/category (record schedule)
--- 110,124 ----
    (mhc-logic-parse-old-style-date (mhc-schedule-condition schedule))
    (mhc-parse/time record schedule))
  
+ (defconst mhc-parse/alarm-regexp "[0-9]+ \\(minute$\\|hour$\\|day$\\)")
+ 
  (defun mhc-parse/alarm (record schedule)
!   (let ((alarm (mhc-parse/continuous-lines)))
!     (if (or (string-match mhc-parse/alarm-regexp alarm)
! 	    (string= "" alarm))
! 	()
!       (error "Parse ERROR!!! (at X-SC-Alarm:)"))
!     (mhc-schedule/set-alarm schedule alarm))
    schedule)
  
  (defun mhc-parse/category (record schedule)