aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-08-16 14:33:43 +0000
committerChong Yidong2009-08-16 14:33:43 +0000
commit1200ac269afbf9d297cced4bf0b02b615f13d3a0 (patch)
tree37e00fac89c814924917b6f7fe9eb0e98c72e6d8
parent1abbe4e53150562ad7731510672fca35374f1a89 (diff)
downloademacs-1200ac269afbf9d297cced4bf0b02b615f13d3a0.tar.gz
emacs-1200ac269afbf9d297cced4bf0b02b615f13d3a0.zip
* calendar/parse-time.el (parse-time-string-chars): Compute using
character classes (Bug#3190).
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/calendar/parse-time.el22
2 files changed, 10 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2cdb28ddc3b..492337757da 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12009-08-16 Chong Yidong <cyd@stupidchicken.com> 12009-08-16 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * calendar/parse-time.el (parse-time-string-chars): Compute using
4 character classes (Bug#3190).
5
3 * progmodes/sh-script.el (sh-maybe-here-document): Avoid inserting 6 * progmodes/sh-script.el (sh-maybe-here-document): Avoid inserting
4 another heredoc if the user adds another < (Bug#3226). 7 another heredoc if the user adds another < (Bug#3226).
5 8
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index fabed88f0a2..27a71269281 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -37,7 +37,6 @@
37 37
38(eval-when-compile (require 'cl)) ;and ah ain't kiddin' 'bout it 38(eval-when-compile (require 'cl)) ;and ah ain't kiddin' 'bout it
39 39
40(defvar parse-time-syntax (make-vector 256 nil))
41(defvar parse-time-digits (make-vector 256 nil)) 40(defvar parse-time-digits (make-vector 256 nil))
42 41
43;; Byte-compiler warnings 42;; Byte-compiler warnings
@@ -48,24 +47,17 @@
48 (loop for i from ?0 to ?9 47 (loop for i from ?0 to ?9
49 do (aset parse-time-digits i (- i ?0)))) 48 do (aset parse-time-digits i (- i ?0))))
50 49
51(unless (aref parse-time-syntax ?0)
52 (loop for i from ?0 to ?9
53 do (aset parse-time-syntax i ?0))
54 (loop for i from ?A to ?Z
55 do (aset parse-time-syntax i ?A))
56 (loop for i from ?a to ?z
57 do (aset parse-time-syntax i ?a))
58 (aset parse-time-syntax ?+ 1)
59 (aset parse-time-syntax ?- -1)
60 (aset parse-time-syntax ?: ?d)
61 )
62
63(defsubst digit-char-p (char) 50(defsubst digit-char-p (char)
64 (aref parse-time-digits char)) 51 (aref parse-time-digits char))
65 52
66(defsubst parse-time-string-chars (char) 53(defsubst parse-time-string-chars (char)
67 (and (< char (length parse-time-syntax)) 54 (let (case-fold-search str)
68 (aref parse-time-syntax char))) 55 (cond ((eq char ?+) 1)
56 ((eq char ?-) -1)
57 ((eq char ?:) ?d)
58 ((string-match "[[:upper:]]" (setq str (string char))) ?A)
59 ((string-match "[[:lower:]]" str) ?a)
60 ((string-match "[[:digit:]]" str) ?0))))
69 61
70(put 'parse-error 'error-conditions '(parse-error error)) 62(put 'parse-error 'error-conditions '(parse-error error))
71(put 'parse-error 'error-message "Parsing error") 63(put 'parse-error 'error-message "Parsing error")