* Fixed the char-numeric? Numeric property.

This commit is contained in:
Abdulaziz Ghuloum 2007-09-13 07:04:13 -04:00
parent 9a62c12c66
commit a85669fc4d
5 changed files with 104 additions and 90 deletions

Binary file not shown.

View File

@ -237,10 +237,13 @@
[_ C ba sc]
[else C ba ex]
;;;
[bitwise-and D bw]
[bitwise-arithmetic-shift C bw]
[bitwise-arithmetic-shift-left C bw]
[bitwise-arithmetic-shift-right C bw]
[bitwise-not D bw]
[bitwise-and D bw]
[bitwise-ior D bw]
[bitwise-xor D bw]
[bitwise-bit-count D bw]
[bitwise-bit-field D bw]
[bitwise-bit-set? D bw]
@ -248,12 +251,9 @@
[bitwise-copy-bit-field D bw]
[bitwise-first-bit-set D bw]
[bitwise-if D bw]
[bitwise-ior D bw]
[bitwise-length D bw]
[bitwise-not D bw]
[bitwise-reverse-bit-field D bw]
[bitwise-rotate-bit-field D bw]
[bitwise-xor D bw]
;;;
[fixnum? C fx]
[fx* D fx]

View File

@ -124,9 +124,9 @@
[Mn ,(+ 05 constituent-property) "Mark, Nonspacing"]
[Mc ,(+ 06 constituent-property) "Mark, Spacing Combining"]
[Me ,(+ 07 constituent-property) "Mark, Enclosing"]
[Nd ,(+ 08 constituent-property numeric-property) "Number, Decimal Digit"]
[Nl ,(+ 09 constituent-property alphabetic-property numeric-property) "Number, Letter"]
[No ,(+ 10 constituent-property numeric-property) "Number, Other"]
[Nd ,(+ 08 constituent-property) "Number, Decimal Digit"]
[Nl ,(+ 09 constituent-property alphabetic-property) "Number, Letter"]
[No ,(+ 10 constituent-property) "Number, Other"]
[Pc ,(+ 11 constituent-property) "Punctuation, Connector"]
[Pd ,(+ 12 constituent-property) "Punctuation, Dash"]
[Ps ,(+ 13 ) "Punctuation, Open"]
@ -215,11 +215,16 @@
;;; interesting parts of each element in ls are:
;;; field0: the character index, numeric
;;; field2: the category, symbolic
;;; field8: if set, then the char has the numeric property
(for-each
(lambda (x)
(let ([idx (hex-string->number (list-ref x 0))]
[cat (category-index (string->symbol (list-ref x 2)))])
(vector-set! v idx cat)))
[cat (category-index (string->symbol (list-ref x 2)))]
[num? (list-ref x 8)])
(vector-set! v idx
(if (string=? num? "")
cat
(fxlogor cat numeric-property)))))
ls))
;;; every element of v now maps to the category-index.
(let ([ls (get-unicode-data "UNIDATA/PropList.txt")])

View File

@ -1,6 +1,6 @@
;;; DO NOT EDIT
;;; automatically generated
;;; 1486 elements in vectors
;;; 1490 elements in vectors
(begin
(define constituent-property 65536)
@ -27,7 +27,7 @@
2364 2366 2369 2377 2381 2382 2384 2385 2389 2392 2402 2404 2406 2416 2417
2427 2432 2434 2436 2437 2445 2447 2449 2451 2473 2474 2481 2483 2486 2490
2492 2494 2497 2501 2503 2505 2507 2509 2511 2519 2520 2524 2526 2527 2530
2532 2534 2544 2546 2548 2554 2555 2561 2563 2565 2571 2575 2577 2579 2601
2532 2534 2544 2546 2548 2552 2555 2561 2563 2565 2571 2575 2577 2579 2601
2602 2609 2610 2612 2613 2615 2616 2618 2620 2622 2625 2627 2631 2633 2635
2637 2638 2649 2653 2655 2662 2672 2674 2677 2689 2691 2693 2702 2703 2706
2707 2729 2730 2737 2738 2740 2741 2746 2748 2750 2753 2758 2759 2761 2763
@ -105,20 +105,21 @@
66600 66640 66718 66720 66730 67584 67590 67592 67594 67638 67639 67641
67644 67645 67647 67648 67840 67862 67866 67871 67872 68096 68097 68100
68101 68103 68108 68112 68116 68117 68120 68121 68148 68152 68155 68159
68160 68168 68176 68185 73728 74607 74752 74851 74864 74868 118784 119030
119040 119079 119082 119141 119143 119146 119149 119155 119163 119171
119173 119180 119210 119214 119262 119296 119362 119365 119366 119552
119639 119648 119666 119808 119834 119860 119886 119893 119894 119912
119938 119964 119966 119968 119970 119971 119973 119975 119977 119981
119982 119990 119994 119997 120004 120005 120016 120042 120068 120070
120071 120075 120077 120085 120086 120093 120094 120120 120122 120123
120127 120128 120133 120135 120138 120145 120146 120172 120198 120224
120250 120276 120302 120328 120354 120380 120406 120432 120458 120486
120488 120513 120514 120539 120540 120546 120571 120572 120597 120598
120604 120629 120630 120655 120656 120662 120687 120688 120713 120714
120720 120745 120746 120771 120772 120778 120780 120782 120832 131072
131073 173782 173783 194560 195102 917505 917506 917536 917632 917760
918000 983040 983041 1048573 1048574 1048576 1048577 1114109 1114110))
68160 68168 68176 68185 73728 74607 74752 74802 74804 74838 74840 74851
74864 74868 118784 119030 119040 119079 119082 119141 119143 119146 119149
119155 119163 119171 119173 119180 119210 119214 119262 119296 119362
119365 119366 119552 119639 119648 119666 119808 119834 119860 119886
119893 119894 119912 119938 119964 119966 119968 119970 119971 119973
119975 119977 119981 119982 119990 119994 119997 120004 120005 120016
120042 120068 120070 120071 120075 120077 120085 120086 120093 120094
120120 120122 120123 120127 120128 120133 120135 120138 120145 120146
120172 120198 120224 120250 120276 120302 120328 120354 120380 120406
120432 120458 120486 120488 120513 120514 120539 120540 120546 120571
120572 120597 120598 120604 120629 120630 120655 120656 120662 120687
120688 120713 120714 120720 120745 120746 120771 120772 120778 120780
120782 120832 131072 131073 173782 173783 194560 195102 917505 917506
917536 917632 917760 918000 983040 983041 1048573 1048574 1048576 1048577
1114109 1114110))
(define unicode-categories-values-vector
'#(25 4194329 25 4194326 65553 65555 65553 #(13 14 65553 65554 65553 65548)
65553 2162696 65553 65554 65553 1245184 #(13 65553 14 65556 65547 65556)
@ -204,56 +205,56 @@
1114117 65553 2162696 65553 29 1114116 #(29 1114117) 1114118 29 1114116 29
1114116 29 1114116 29 1114116 #(29 1114116) 29 1114116 29 #(65541 1114116)
1114118 1114117 29 1114118 29 1114118 #(65541 1114116) 29 1114118 29
1114116 29 1114116 1114117 29 2162696 1114116 65555 2162698 65557 29
1114117 #(1114118 29) 1114116 29 1114116 29 1114116 29 1114116 29 1114116
29 1114116 29 1114116 29 #(65541 29) 1114118 1114117 29 1114117 29 1114117
65541 29 1114116 #(29 1114116) 29 2162696 1114117 1114116 29 1114117
#(1114118 29) 1114116 29 1114116 29 1114116 29 1114116 29 1114116 29
1114116 29 #(65541 1114116) 1114118 1114117 29 1114117 #(1114118 29)
1114118 65541 29 1114116 29 1114116 1114117 29 2162696 #(29 65555) 29
1114117 1114118 29 1114116 29 1114116 29 1114116 29 1114116 29 1114116 29
1114116 29 #(65541 1114116 1114118 1114117 1114118) 1114117 29 1114118 29
1114118 65541 29 #(1114117 1114118) 29 1114116 29 1114116 29 2162696
#(65557 1114116) 29 #(1114117 1114116 29) 1114116 29 1114116 29 1114116 29
1114116 #(29 1114116 29) 1114116 29 1114116 29 1114116 29 1114116 29
1114118 1114117 1114118 29 1114118 29 1114118 65541 29 1114118 29 2162696
2162698 65557 #(65555 65557) 29 1114118 29 1114116 29 1114116 29 1114116 29
1114116 29 1114116 29 1114117 1114118 29 1114117 29 1114117 65541 29
1114117 29 1114116 29 2162696 29 1114118 29 1114116 29 1114116 29 1114116
29 1114116 29 1114116 29 #(65541 1114116 1114118 1114117) 1114118
#(29 1114117) 1114118 29 1114118 #(1114117 65541) 29 1114118 29
#(1114116 29) 1114116 1114117 29 2162696 29 65557 29 1114118 29 1114116 29
1114116 29 1114116 29 1114116 29 1114118 1114117 29 1114118 29 1114118
65541 29 1114118 29 1114116 29 2162696 29 1114118 29 1114116 29 1114116 29
1114116 #(29 1114116) 29 1114116 29 65541 29 1114118 1114117
#(29 1114117 29) 1114118 29 1114118 65553 29 1114116 1114117 1114116
1114117 29 65555 1114116 1114115 65541 #(1114117 65541 65553) 2162696 65553
29 1114116 #(29 1114116) 29 1114116 #(29 1114116) 29 1114116 29 1114116 29
1114116 29 1114116 #(29 1114116 29 1114116) 29 1114116 29 1114116 1114117
1114116 1114117 29 1114117 1114116 29 1114116 #(29 1114115 29) 65541
1114117 29 2162696 29 1114116 29 1114116 65557 65553 65557 65541 65557
2162696 2162698 #(65557 65541 65557 65541 65557 65541 13 14 13 14) 65542
1114116 29 1114116 29 1114117 1114118 1114117 65541 65553 65541 1114116 29
1114117 29 1114117 29 65557 65541 65557 29 65557 65553 29 1114116 29
1114116 29 1114116 #(29 1114118) 1114117 #(1114118 1114117) 29
#(1114117 65541 1114118 65541) 29 2162696 65553 1114116 1114118 1114117 29
1245184 29 1114116 #(65553 1114115) 29 1114116 29 1114116 29 1114116 29
1114116 29 1114116 1114117 29 2162696 1114116 65555 2162698
#(65546 2162698 65557) 29 1114117 #(1114118 29) 1114116 29 1114116 29
1114116 29 1114116 29 1114116 29 1114116 29 1114116 29 #(65541 29) 1114118
1114117 29 1114117 29 1114117 65541 29 1114116 #(29 1114116) 29 2162696
1114117 1114116 29 1114117 #(1114118 29) 1114116 29 1114116 29 1114116 29
1114116 29 1114116 29 1114116 29 #(65541 1114116) 1114118 1114117 29
1114117 #(1114118 29) 1114118 65541 29 1114116 29 1114116 1114117 29
2162696 #(29 65555) 29 1114117 1114118 29 1114116 29 1114116 29 1114116 29
1114116 29 1114116 29 1114116 29 #(65541 1114116 1114118 1114117 1114118)
1114117 29 1114118 29 1114118 65541 29 #(1114117 1114118) 29 1114116 29
1114116 29 2162696 #(65557 1114116) 29 #(1114117 1114116 29) 1114116 29
1114116 29 1114116 29 1114116 #(29 1114116 29) 1114116 29 1114116 29
1114116 29 1114116 29 1114116 29 1114116 #(29 1114116 29) 1114116 29
1114116 29 1114116 29 1114116 29 1114116 29 #(1114117 65557) 65553 2162698
29 1114116 65557 29 1114116 29 1114116 65553 1114116 29 4194326 1114116
#(13 14) 29 1114116 65553 3211273 29 1114116 29 1114116 1114117 65541 29
1114116 1114117 65541 65553 29 1114116 1114117 29 1114116 29 1114116 29
1114117 29 1114116 26 1114118 1114117 1114118 1114117 1114118 65541 65553
1114115 65553 #(65555 1114116 65541) 29 2162696 29 2162698 29 65553 65548
65553 65541 #(4194326 29) 2162696 29 1114116 1114115 1114116 29 1114116
1114117 29 1114116 29 1114117 1114118 1114117 1114118 29 1114118 1114117
1114118 65541 29 65557 29 65553 2162696 1114116 29 1114116 29 1114116 29
1114118 1114116 1114118 29 2162696 29 65553 65557 1114116 1114117 1114118
29 65553 29 1114117 1114118 1114116 #(65541 1114118) 1114117
#(1114118 1114117) 1114118 #(1114117 1114118 65542) 1114116 29 2162696
65553 65557 65541 65557 29 1376257 1376259 1376257 1376259 1376257 1376259
65541 29 65541
1114116 29 1114116 29 1114118 1114117 1114118 29 1114118 29 1114118 65541
29 1114118 29 2162696 2162698 65557 #(65555 65557) 29 1114118 29 1114116 29
1114116 29 1114116 29 1114116 29 1114116 29 1114117 1114118 29 1114117 29
1114117 65541 29 1114117 29 1114116 29 2162696 29 1114118 29 1114116 29
1114116 29 1114116 29 1114116 29 1114116 29
#(65541 1114116 1114118 1114117) 1114118 #(29 1114117) 1114118 29 1114118
#(1114117 65541) 29 1114118 29 #(1114116 29) 1114116 1114117 29 2162696 29
65557 29 1114118 29 1114116 29 1114116 29 1114116 29 1114116 29 1114118
1114117 29 1114118 29 1114118 65541 29 1114118 29 1114116 29 2162696 29
1114118 29 1114116 29 1114116 29 1114116 #(29 1114116) 29 1114116 29 65541
29 1114118 1114117 #(29 1114117 29) 1114118 29 1114118 65553 29 1114116
1114117 1114116 1114117 29 65555 1114116 1114115 65541
#(1114117 65541 65553) 2162696 65553 29 1114116 #(29 1114116) 29 1114116
#(29 1114116) 29 1114116 29 1114116 29 1114116 29 1114116
#(29 1114116 29 1114116) 29 1114116 29 1114116 1114117 1114116 1114117 29
1114117 1114116 29 1114116 #(29 1114115 29) 65541 1114117 29 2162696 29
1114116 29 1114116 65557 65553 65557 65541 65557 2162696 2162698
#(65557 65541 65557 65541 65557 65541 13 14 13 14) 65542 1114116 29 1114116
29 1114117 1114118 1114117 65541 65553 65541 1114116 29 1114117 29 1114117
29 65557 65541 65557 29 65557 65553 29 1114116 29 1114116 29 1114116
#(29 1114118) 1114117 #(1114118 1114117) 29 #(1114117 65541 1114118 65541)
29 2162696 65553 1114116 1114118 1114117 29 1245184 29 1114116
#(65553 1114115) 29 1114116 29 1114116 29 1114116 29 1114116 29 1114116 29
1114116 #(29 1114116 29) 1114116 29 1114116 29 1114116 29 1114116 29
1114116 29 1114116 #(29 1114116 29) 1114116 29 1114116 29 1114116 29
1114116 29 1114116 29 #(1114117 65557) 65553 2162698 29 1114116 65557 29
1114116 29 1114116 65553 1114116 29 4194326 1114116 #(13 14) 29 1114116
65553 3211273 29 1114116 29 1114116 1114117 65541 29 1114116 1114117 65541
65553 29 1114116 1114117 29 1114116 29 1114116 29 1114117 29 1114116 26
1114118 1114117 1114118 1114117 1114118 65541 65553 1114115 65553
#(65555 1114116 65541) 29 2162696 29 2162698 29 65553 65548 65553 65541
#(4194326 29) 2162696 29 1114116 1114115 1114116 29 1114116 1114117 29
1114116 29 1114117 1114118 1114117 1114118 29 1114118 1114117 1114118 65541
29 65557 29 65553 2162696 1114116 29 1114116 29 1114116 29 1114118 1114116
1114118 29 2162696 29 65553 65557 1114116 1114117 1114118 29 65553 29
1114117 1114118 1114116 #(65541 1114118) 1114117 #(1114118 1114117) 1114118
#(1114117 1114118 65542) 1114116 29 2162696 65553 65557 65541 65557 29
1376257 1376259 1376257 1376259 1376257 1376259 65541 29 65541
#(1245184 1376257 1245184 1376257 1245184 1376257 1245184 1376257 1245184
1376257 1245184 1376257 1245184 1376257 1245184 1376257 1245184 1376257
1245184 1376257 1245184 1376257 1245184 1376257 1245184 1376257 1245184
@ -354,18 +355,18 @@
29 #(1114116 29) 1114116 29 1114116 29 1114116 29 1114116 29 1114116
2162698 29 65553 29 1114116 1114117 29 1114117 29 1114117 1114116 29
1114116 29 1114116 29 65541 29 65541 2162698 29 65553 29 1114116 29 3211273
29 65553 29 65557 29 65557 29 65557 65542 65541 65557 65542 26 65541 65557
65541 65557 65541 65557 29 65557 65541 65557 29 65557 29 2162698 29 1245184
1376257 1245184 1376257 29 1376257 1245184 1376257 #(1245184 29) 1245184 29
1245184 29 1245184 29 1245184 29 1245184 1376257 #(29 1376257 29) 1376257
29 1376257 1245184 1376257 1245184 29 1245184 29 1245184 29 1245184 29
1376257 1245184 29 1245184 29 1245184 #(29 1245184) 29 1245184 29 1376257
1245184 1376257 1245184 1376257 1245184 1376257 1245184 1376257 1245184
1376257 1245184 1376257 29 1245184 65554 1376257 65554 1376257 1245184
65554 1376257 65554 1376257 1245184 65554 1376257 65554 1376257 1245184
65554 1376257 65554 1376257 1245184 65554 1376257 65554 1376257
#(1245184 1376257) 29 2162696 29 1114116 29 1114116 29 1114116 29 26 29 26
29 65541 29 65564 29 65564 29 65564 29 65564 29))
1114121 3211273 1114121 3211273 29 65553 29 65557 29 65557 29 65557 65542
65541 65557 65542 26 65541 65557 65541 65557 65541 65557 29 65557 65541
65557 29 65557 29 2162698 29 1245184 1376257 1245184 1376257 29 1376257
1245184 1376257 #(1245184 29) 1245184 29 1245184 29 1245184 29 1245184 29
1245184 1376257 #(29 1376257 29) 1376257 29 1376257 1245184 1376257 1245184
29 1245184 29 1245184 29 1245184 29 1376257 1245184 29 1245184 29 1245184
#(29 1245184) 29 1245184 29 1376257 1245184 1376257 1245184 1376257 1245184
1376257 1245184 1376257 1245184 1376257 1245184 1376257 29 1245184 65554
1376257 65554 1376257 1245184 65554 1376257 65554 1376257 1245184 65554
1376257 65554 1376257 1245184 65554 1376257 65554 1376257 1245184 65554
1376257 65554 1376257 #(1245184 1376257) 29 2162696 29 1114116 29 1114116
29 1114116 29 26 29 26 29 65541 29 65564 29 65564 29 65564 29 65564 29))
(define unicode-categories-name-vector
'#(Lu Ll Lt Lm Lo Mn Mc Me Nd Nl No Pc Pd Ps Pe Pi Pf Po Sm Sc Sk So Zs Zl Zp
Cc Cf Cs Co Cn))

View File

@ -21,7 +21,7 @@
[(or (fx= i n) (memv (string-ref str i) '(#\; #\#))) i]
[else (find-semi/hash str (+ i 1) n)]))
(define (cleanup str)
(define (cleanup^ str)
(let ([lo
(let f ([i 0] [n (string-length str)])
(cond
@ -35,11 +35,19 @@
[(< i 0) i]
[(char=? #\space (string-ref str i))
(f (sub1 i))]
[else i]))])
(if (> hi lo)
(substring str lo (+ hi 1))
[else (+ i 1)]))])
(if (> hi lo)
(substring str lo hi)
"")))
(define (cleanup str)
(let ([s (cleanup^ str)])
(when
(and (= (string-length str) 1)
(not (= (string-length s) 1)))
(error 'cleanup "duuh ~s ~s" s str))
s))
(define (split str)
(let f ([i 0] [n (string-length str)])
(cond