clucumber 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +4 -9
- data/lib/clucumber/clucumber-bootstrap.lisp +32 -0
- data/lib/clucumber/vendor/cl-interpol/alias.lisp +55 -0
- data/lib/clucumber/vendor/cl-interpol/cl-interpol.asd +56 -0
- data/lib/clucumber/vendor/cl-interpol/load.lisp +53 -0
- data/lib/clucumber/vendor/cl-interpol/packages.lisp +40 -0
- data/lib/clucumber/vendor/cl-interpol/read.lisp +716 -0
- data/lib/clucumber/vendor/cl-interpol/specials.lisp +113 -0
- data/lib/clucumber/vendor/cl-interpol/test/packages.lisp +34 -0
- data/lib/clucumber/vendor/cl-interpol/test/tests.lisp +128 -0
- data/lib/clucumber/vendor/cl-interpol/test.lisp +177 -0
- data/lib/clucumber/vendor/cl-interpol/test2.lisp +6254 -0
- data/lib/clucumber/vendor/cl-interpol/unicode.lisp +13912 -0
- data/lib/clucumber/vendor/cl-interpol/util.lisp +122 -0
- data/lib/clucumber/vendor/cl-ppcre/api.lisp +1262 -0
- data/lib/clucumber/vendor/cl-ppcre/charmap.lisp +152 -0
- data/lib/clucumber/vendor/cl-ppcre/charset.lisp +242 -0
- data/lib/clucumber/vendor/cl-ppcre/chartest.lisp +98 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-test.asd +34 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/packages.lisp +38 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/resolver.lisp +61 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode.asd +58 -0
- data/lib/clucumber/vendor/cl-ppcre/cl-ppcre.asd +79 -0
- data/lib/clucumber/vendor/cl-ppcre/closures.lisp +471 -0
- data/lib/clucumber/vendor/cl-ppcre/convert.lisp +875 -0
- data/lib/clucumber/vendor/cl-ppcre/errors.lisp +84 -0
- data/lib/clucumber/vendor/cl-ppcre/lexer.lisp +737 -0
- data/lib/clucumber/vendor/cl-ppcre/lispworks-defsystem.lisp +57 -0
- data/lib/clucumber/vendor/cl-ppcre/load.lisp +67 -0
- data/lib/clucumber/vendor/cl-ppcre/optimize.lisp +578 -0
- data/lib/clucumber/vendor/cl-ppcre/packages.lisp +68 -0
- data/lib/clucumber/vendor/cl-ppcre/parser.lisp +319 -0
- data/lib/clucumber/vendor/cl-ppcre/ppcre-tests.lisp +269 -0
- data/lib/clucumber/vendor/cl-ppcre/regex-class-util.lisp +555 -0
- data/lib/clucumber/vendor/cl-ppcre/regex-class.lisp +259 -0
- data/lib/clucumber/vendor/cl-ppcre/repetition-closures.lisp +833 -0
- data/lib/clucumber/vendor/cl-ppcre/scanner.lisp +506 -0
- data/lib/clucumber/vendor/cl-ppcre/specials.lisp +172 -0
- data/lib/clucumber/vendor/cl-ppcre/test/packages.lisp +37 -0
- data/lib/clucumber/vendor/cl-ppcre/test/perl-tests.lisp +150 -0
- data/lib/clucumber/vendor/cl-ppcre/test/tests.lisp +159 -0
- data/lib/clucumber/vendor/cl-ppcre/test/unicode-tests.lisp +80 -0
- data/lib/clucumber/vendor/cl-ppcre/util.lisp +201 -0
- data/lib/clucumber/vendor/cl-unicode/alias.lisp +135 -0
- data/lib/clucumber/vendor/cl-unicode/api.lisp +412 -0
- data/lib/clucumber/vendor/cl-unicode/build/char-info.lisp +133 -0
- data/lib/clucumber/vendor/cl-unicode/build/dump.lisp +239 -0
- data/lib/clucumber/vendor/cl-unicode/build/read.lisp +280 -0
- data/lib/clucumber/vendor/cl-unicode/build/util.lisp +182 -0
- data/lib/clucumber/vendor/cl-unicode/cl-unicode.asd +90 -0
- data/lib/clucumber/vendor/cl-unicode/conditions.lisp +54 -0
- data/lib/clucumber/vendor/cl-unicode/derived.lisp +120 -0
- data/lib/clucumber/vendor/cl-unicode/hash-tables.lisp +20 -0
- data/lib/clucumber/vendor/cl-unicode/lists.lisp +10 -0
- data/lib/clucumber/vendor/cl-unicode/methods.lisp +15 -0
- data/lib/clucumber/vendor/cl-unicode/packages.lisp +76 -0
- data/lib/clucumber/vendor/cl-unicode/specials.lisp +135 -0
- data/lib/clucumber/vendor/cl-unicode/test/packages.lisp +34 -0
- data/lib/clucumber/vendor/cl-unicode/test/tests.lisp +150 -0
- data/lib/clucumber/vendor/cl-unicode/test-functions.lisp +94 -0
- data/lib/clucumber/vendor/cl-unicode/util.lisp +274 -0
- data/lib/clucumber/vendor/lift/compare/fiveam-tests.lisp +14 -0
- data/lib/clucumber/vendor/lift/compare/lift-tests.lisp +13 -0
- data/lib/clucumber/vendor/lift/compare/rt-tests.lisp +16 -0
- data/lib/clucumber/vendor/lift/compare/xlunit-tests.lisp +15 -0
- data/lib/clucumber/vendor/lift/dev/changes.lisp +61 -0
- data/lib/clucumber/vendor/lift/dev/config.lisp +354 -0
- data/lib/clucumber/vendor/lift/dev/copy-file.lisp +117 -0
- data/lib/clucumber/vendor/lift/dev/introspection.lisp +232 -0
- data/lib/clucumber/vendor/lift/dev/lift-interface.lisp +56 -0
- data/lib/clucumber/vendor/lift/dev/lift-notes.lisp +202 -0
- data/lib/clucumber/vendor/lift/dev/lift-randomized.lisp +45 -0
- data/lib/clucumber/vendor/lift/dev/lift.lisp +2383 -0
- data/lib/clucumber/vendor/lift/dev/macros.lisp +229 -0
- data/lib/clucumber/vendor/lift/dev/measuring.lisp +156 -0
- data/lib/clucumber/vendor/lift/dev/packages.lisp +161 -0
- data/lib/clucumber/vendor/lift/dev/port.lisp +151 -0
- data/lib/clucumber/vendor/lift/dev/prototypes.lisp +282 -0
- data/lib/clucumber/vendor/lift/dev/random-testing.lisp +124 -0
- data/lib/clucumber/vendor/lift/dev/report-locations.lisp +13 -0
- data/lib/clucumber/vendor/lift/dev/reports.lisp +916 -0
- data/lib/clucumber/vendor/lift/dev/utilities.lisp +242 -0
- data/lib/clucumber/vendor/lift/docs/package.lisp +6 -0
- data/lib/clucumber/vendor/lift/docs/setup.lisp +17 -0
- data/lib/clucumber/vendor/lift/examples/basic-examples.lisp +289 -0
- data/lib/clucumber/vendor/lift/examples/random-testing.lisp +32 -0
- data/lib/clucumber/vendor/lift/lift-documentation.asd +28 -0
- data/lib/clucumber/vendor/lift/lift-test.asd +35 -0
- data/lib/clucumber/vendor/lift/lift.asd +77 -0
- data/lib/clucumber/vendor/lift/test/equality-tests.lisp +40 -0
- data/lib/clucumber/vendor/lift/test/finding-tests.lisp +32 -0
- data/lib/clucumber/vendor/lift/test/lift-test.lisp +783 -0
- data/lib/clucumber/vendor/lift/test/order-of-operations.lisp +54 -0
- data/lib/clucumber/vendor/lift/test/packages.lisp +17 -0
- data/lib/clucumber/vendor/lift/test/test-config-files.lisp +20 -0
- data/lib/clucumber/vendor/lift/test/test-dynamic-variables.lisp +57 -0
- data/lib/clucumber/vendor/lift/test/test-maximum-problems.lisp +74 -0
- data/lib/clucumber/vendor/lift/test/test-prototypes.lisp +278 -0
- data/lib/clucumber/vendor/lift/test/test-timeout.lisp +37 -0
- data/lib/clucumber/vendor/lift/test/tests-in-progress.lisp +62 -0
- data/lib/clucumber/vendor/lift/test/testsuite-expects.lisp +60 -0
- data/lib/clucumber/vendor/lift/timeout/package.lisp +13 -0
- data/lib/clucumber/vendor/lift/timeout/with-timeout.lisp +123 -0
- data/lib/clucumber/vendor/lift/website/stuff/Temp.lisp +34 -0
- data/lib/clucumber/vendor/st-json/st-json.asd +3 -0
- data/lib/clucumber/vendor/st-json/st-json.lisp +310 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/backtrace.lisp +127 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/fallback.lisp +10 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/map-backtrace.lisp +103 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/mucking.lisp +75 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/packages.lisp +13 -0
- data/lib/clucumber/vendor/trivial-backtrace/dev/utilities.lisp +104 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/packages.lisp +5 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/test-setup.lisp +4 -0
- data/lib/clucumber/vendor/trivial-backtrace/test/tests.lisp +16 -0
- data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace-test.asd +22 -0
- data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace.asd +35 -0
- data/lib/clucumber/vendor/usocket/backend/allegro.lisp +199 -0
- data/lib/clucumber/vendor/usocket/backend/armedbear.lisp +491 -0
- data/lib/clucumber/vendor/usocket/backend/clisp.lisp +260 -0
- data/lib/clucumber/vendor/usocket/backend/cmucl.lisp +266 -0
- data/lib/clucumber/vendor/usocket/backend/lispworks.lisp +741 -0
- data/lib/clucumber/vendor/usocket/backend/mcl.lisp +369 -0
- data/lib/clucumber/vendor/usocket/backend/openmcl.lisp +206 -0
- data/lib/clucumber/vendor/usocket/backend/sbcl.lisp +424 -0
- data/lib/clucumber/vendor/usocket/backend/scl.lisp +261 -0
- data/lib/clucumber/vendor/usocket/condition.lisp +227 -0
- data/lib/clucumber/vendor/usocket/package.lisp +82 -0
- data/lib/clucumber/vendor/usocket/server.lisp +45 -0
- data/lib/clucumber/vendor/usocket/test/package.lisp +13 -0
- data/lib/clucumber/vendor/usocket/test/test-usocket.lisp +166 -0
- data/lib/clucumber/vendor/usocket/usocket-test.asd +26 -0
- data/lib/clucumber/vendor/usocket/usocket.asd +37 -0
- data/lib/clucumber/vendor/usocket/usocket.lisp +542 -0
- data/lib/clucumber/vendor/usocket/vendor/kqueue.lisp +1 -0
- data/lib/clucumber/vendor/usocket/vendor/split-sequence.lisp +245 -0
- data/lib/clucumber.rb +29 -7
- metadata +151 -5
@@ -0,0 +1,152 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-ppcre/charmap.lisp,v 1.19 2009/09/17 19:17:30 edi Exp $
|
3
|
+
|
4
|
+
;;; An optimized representation of sets of characters.
|
5
|
+
|
6
|
+
;;; Copyright (c) 2008-2009, Dr. Edmund Weitz. All rights reserved.
|
7
|
+
|
8
|
+
;;; Redistribution and use in source and binary forms, with or without
|
9
|
+
;;; modification, are permitted provided that the following conditions
|
10
|
+
;;; are met:
|
11
|
+
|
12
|
+
;;; * Redistributions of source code must retain the above copyright
|
13
|
+
;;; notice, this list of conditions and the following disclaimer.
|
14
|
+
|
15
|
+
;;; * Redistributions in binary form must reproduce the above
|
16
|
+
;;; copyright notice, this list of conditions and the following
|
17
|
+
;;; disclaimer in the documentation and/or other materials
|
18
|
+
;;; provided with the distribution.
|
19
|
+
|
20
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
21
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
24
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
26
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
|
32
|
+
(in-package :cl-ppcre)
|
33
|
+
|
34
|
+
(defstruct (charmap (:constructor make-charmap%))
|
35
|
+
;; a bit vector mapping char codes to "booleans" (1 for set members,
|
36
|
+
;; 0 for others)
|
37
|
+
(vector #*0 :type simple-bit-vector)
|
38
|
+
;; the smallest character code of all characters in the set
|
39
|
+
(start 0 :type fixnum)
|
40
|
+
;; the upper (exclusive) bound of all character codes in the set
|
41
|
+
(end 0 :type fixnum)
|
42
|
+
;; the number of characters in the set, or NIL if this is unknown
|
43
|
+
(count nil :type (or fixnum null))
|
44
|
+
;; whether the charmap actually represents the complement of the set
|
45
|
+
(complementp nil :type boolean))
|
46
|
+
|
47
|
+
;; seems to be necessary for some Lisps like ClozureCL
|
48
|
+
(defmethod make-load-form ((map charmap) &optional environment)
|
49
|
+
(make-load-form-saving-slots map :environment environment))
|
50
|
+
|
51
|
+
(declaim (inline in-charmap-p))
|
52
|
+
(defun in-charmap-p (char charmap)
|
53
|
+
"Tests whether the character CHAR belongs to the set represented by CHARMAP."
|
54
|
+
(declare #.*standard-optimize-settings*)
|
55
|
+
(declare (character char) (charmap charmap))
|
56
|
+
(let* ((char-code (char-code char))
|
57
|
+
(char-in-vector-p
|
58
|
+
(let ((charmap-start (charmap-start charmap)))
|
59
|
+
(declare (fixnum charmap-start))
|
60
|
+
(and (<= charmap-start char-code)
|
61
|
+
(< char-code (the fixnum (charmap-end charmap)))
|
62
|
+
(= 1 (sbit (the simple-bit-vector (charmap-vector charmap))
|
63
|
+
(- char-code charmap-start)))))))
|
64
|
+
(cond ((charmap-complementp charmap) (not char-in-vector-p))
|
65
|
+
(t char-in-vector-p))))
|
66
|
+
|
67
|
+
(defun charmap-contents (charmap)
|
68
|
+
"Returns a list of all characters belonging to a character map.
|
69
|
+
Only works for non-complement charmaps."
|
70
|
+
(declare #.*standard-optimize-settings*)
|
71
|
+
(declare (charmap charmap))
|
72
|
+
(and (not (charmap-complementp charmap))
|
73
|
+
(loop for code of-type fixnum from (charmap-start charmap) to (charmap-end charmap)
|
74
|
+
for i across (the simple-bit-vector (charmap-vector charmap))
|
75
|
+
when (= i 1)
|
76
|
+
collect (code-char code))))
|
77
|
+
|
78
|
+
(defun make-charmap (start end test-function &optional complementp)
|
79
|
+
"Creates and returns a charmap representing all characters with
|
80
|
+
character codes in the interval [start end) that satisfy
|
81
|
+
TEST-FUNCTION. The COMPLEMENTP slot of the charmap is set to the
|
82
|
+
value of the optional argument, but this argument doesn't have an
|
83
|
+
effect on how TEST-FUNCTION is used."
|
84
|
+
(declare #.*standard-optimize-settings*)
|
85
|
+
(declare (fixnum start end))
|
86
|
+
(let ((vector (make-array (- end start) :element-type 'bit))
|
87
|
+
(count 0))
|
88
|
+
(declare (fixnum count))
|
89
|
+
(loop for code from start below end
|
90
|
+
for char = (code-char code)
|
91
|
+
for index from 0
|
92
|
+
when char do
|
93
|
+
(incf count)
|
94
|
+
(setf (sbit vector index) (if (funcall test-function char) 1 0)))
|
95
|
+
(make-charmap% :vector vector
|
96
|
+
:start start
|
97
|
+
:end end
|
98
|
+
;; we don't know for sure if COMPLEMENTP is true as
|
99
|
+
;; there isn't a necessary a character for each
|
100
|
+
;; integer below *REGEX-CHAR-CODE-LIMIT*
|
101
|
+
:count (and (not complementp) count)
|
102
|
+
;; make sure it's boolean
|
103
|
+
:complementp (not (not complementp)))))
|
104
|
+
|
105
|
+
(defun create-charmap-from-test-function (test-function start end)
|
106
|
+
"Creates and returns a charmap representing all characters with
|
107
|
+
character codes between START and END which satisfy TEST-FUNCTION.
|
108
|
+
Tries to find the smallest interval which is necessary to represent
|
109
|
+
the character set and uses the complement representation if that
|
110
|
+
helps."
|
111
|
+
(declare #.*standard-optimize-settings*)
|
112
|
+
(let (start-in end-in start-out end-out)
|
113
|
+
;; determine the smallest intervals containing the set and its
|
114
|
+
;; complement, [start-in, end-in) and [start-out, end-out) - first
|
115
|
+
;; the lower bound
|
116
|
+
(loop for code from start below end
|
117
|
+
for char = (code-char code)
|
118
|
+
until (and start-in start-out)
|
119
|
+
when (and char
|
120
|
+
(not start-in)
|
121
|
+
(funcall test-function char))
|
122
|
+
do (setq start-in code)
|
123
|
+
when (and char
|
124
|
+
(not start-out)
|
125
|
+
(not (funcall test-function char)))
|
126
|
+
do (setq start-out code))
|
127
|
+
(unless start-in
|
128
|
+
;; no character satisfied the test, so return a "pseudo" charmap
|
129
|
+
;; where IN-CHARMAP-P is always false
|
130
|
+
(return-from create-charmap-from-test-function
|
131
|
+
(make-charmap% :count 0)))
|
132
|
+
(unless start-out
|
133
|
+
;; no character failed the test, so return a "pseudo" charmap
|
134
|
+
;; where IN-CHARMAP-P is always true
|
135
|
+
(return-from create-charmap-from-test-function
|
136
|
+
(make-charmap% :complementp t)))
|
137
|
+
;; now determine upper bound
|
138
|
+
(loop for code from (1- end) downto start
|
139
|
+
for char = (code-char code)
|
140
|
+
until (and end-in end-out)
|
141
|
+
when (and char
|
142
|
+
(not end-in)
|
143
|
+
(funcall test-function char))
|
144
|
+
do (setq end-in (1+ code))
|
145
|
+
when (and char
|
146
|
+
(not end-out)
|
147
|
+
(not (funcall test-function char)))
|
148
|
+
do (setq end-out (1+ code)))
|
149
|
+
;; use the smaller interval
|
150
|
+
(cond ((<= (- end-in start-in) (- end-out start-out))
|
151
|
+
(make-charmap start-in end-in test-function))
|
152
|
+
(t (make-charmap start-out end-out (complement* test-function) t)))))
|
@@ -0,0 +1,242 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-ppcre/charset.lisp,v 1.10 2009/09/17 19:17:30 edi Exp $
|
3
|
+
|
4
|
+
;;; A specialized set implementation for characters by Nikodemus Siivola.
|
5
|
+
|
6
|
+
;;; Copyright (c) 2008, Nikodemus Siivola. All rights reserved.
|
7
|
+
;;; Copyright (c) 2008-2009, Dr. Edmund Weitz. All rights reserved.
|
8
|
+
|
9
|
+
;;; Redistribution and use in source and binary forms, with or without
|
10
|
+
;;; modification, are permitted provided that the following conditions
|
11
|
+
;;; are met:
|
12
|
+
|
13
|
+
;;; * Redistributions of source code must retain the above copyright
|
14
|
+
;;; notice, this list of conditions and the following disclaimer.
|
15
|
+
|
16
|
+
;;; * Redistributions in binary form must reproduce the above
|
17
|
+
;;; copyright notice, this list of conditions and the following
|
18
|
+
;;; disclaimer in the documentation and/or other materials
|
19
|
+
;;; provided with the distribution.
|
20
|
+
|
21
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
22
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
23
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
24
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
25
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
26
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
27
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
29
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
|
33
|
+
(in-package :cl-ppcre)
|
34
|
+
|
35
|
+
(defconstant +probe-depth+ 3
|
36
|
+
"Maximum number of collisions \(for any element) we accept before we
|
37
|
+
allocate more storage. This is now fixed, but could be made to vary
|
38
|
+
depending on the size of the storage vector \(e.g. in the range of
|
39
|
+
1-4). Larger probe-depths mean more collisions are tolerated before
|
40
|
+
the table grows, but increase the constant factor.")
|
41
|
+
|
42
|
+
(defun make-char-vector (size)
|
43
|
+
"Returns a vector of size SIZE to hold characters. All elements are
|
44
|
+
initialized to #\Null except for the first one which is initialized to
|
45
|
+
#\?."
|
46
|
+
(declare #.*standard-optimize-settings*)
|
47
|
+
(declare (type (integer 2 #.(1- array-total-size-limit)) size))
|
48
|
+
;; since #\Null always hashes to 0, store something else there
|
49
|
+
;; initially, and #\Null everywhere else
|
50
|
+
(let ((result (make-array size
|
51
|
+
:element-type #-:lispworks 'character #+:lispworks 'lw:simple-char
|
52
|
+
:initial-element (code-char 0))))
|
53
|
+
(setf (char result 0) #\?)
|
54
|
+
result))
|
55
|
+
|
56
|
+
(defstruct (charset (:constructor make-charset ()))
|
57
|
+
;; this is set to 0 when we stop hashing and just use a CHAR-CODE
|
58
|
+
;; indexed vector
|
59
|
+
(depth +probe-depth+ :type fixnum)
|
60
|
+
;; the number of characters in this set
|
61
|
+
(count 0 :type fixnum)
|
62
|
+
;; the storage vector
|
63
|
+
(vector (make-char-vector 12) :type (simple-array character (*))))
|
64
|
+
|
65
|
+
;; seems to be necessary for some Lisps like ClozureCL
|
66
|
+
(defmethod make-load-form ((set charset) &optional environment)
|
67
|
+
(make-load-form-saving-slots set :environment environment))
|
68
|
+
|
69
|
+
(declaim (inline mix))
|
70
|
+
(defun mix (code hash)
|
71
|
+
"Given a character code CODE and a hash code HASH, computes and
|
72
|
+
returns the \"next\" hash code. See comments below."
|
73
|
+
(declare #.*standard-optimize-settings*)
|
74
|
+
;; mixing the CHAR-CODE back in at each step makes sure that if two
|
75
|
+
;; characters collide (their hashes end up pointing in the same
|
76
|
+
;; storage vector index) on one round, they should (hopefully!) not
|
77
|
+
;; collide on the next
|
78
|
+
(sxhash (logand most-positive-fixnum (+ code hash))))
|
79
|
+
|
80
|
+
(declaim (inline compute-index))
|
81
|
+
(defun compute-index (hash vector)
|
82
|
+
"Computes and returns the index into the vector VECTOR corresponding
|
83
|
+
to the hash code HASH."
|
84
|
+
(declare #.*standard-optimize-settings*)
|
85
|
+
(1+ (mod hash (1- (length vector)))))
|
86
|
+
|
87
|
+
(defun in-charset-p (char set)
|
88
|
+
"Checks whether the character CHAR is in the charset SET."
|
89
|
+
(declare #.*standard-optimize-settings*)
|
90
|
+
(declare (character char) (charset set))
|
91
|
+
(let ((vector (charset-vector set))
|
92
|
+
(depth (charset-depth set))
|
93
|
+
(code (char-code char)))
|
94
|
+
(declare (fixnum depth))
|
95
|
+
;; as long as the set remains reasonably small, we use non-linear
|
96
|
+
;; hashing - the first hash of any character is its CHAR-CODE, and
|
97
|
+
;; subsequent hashes are computed by MIX above
|
98
|
+
(cond ((or
|
99
|
+
;; depth 0 is special - each char maps only to its code,
|
100
|
+
;; nothing else
|
101
|
+
(zerop depth)
|
102
|
+
;; index 0 is special - only #\Null maps to it, no matter
|
103
|
+
;; what the depth is
|
104
|
+
(zerop code))
|
105
|
+
(eq char (char vector code)))
|
106
|
+
(t
|
107
|
+
;; otherwise hash starts out as the character code, but
|
108
|
+
;; maps to indexes 1-N
|
109
|
+
(let ((hash code))
|
110
|
+
(tagbody
|
111
|
+
:retry
|
112
|
+
(let* ((index (compute-index hash vector))
|
113
|
+
(x (char vector index)))
|
114
|
+
(cond ((eq x (code-char 0))
|
115
|
+
;; empty, no need to probe further
|
116
|
+
(return-from in-charset-p nil))
|
117
|
+
((eq x char)
|
118
|
+
;; got it
|
119
|
+
(return-from in-charset-p t))
|
120
|
+
((zerop (decf depth))
|
121
|
+
;; max probe depth reached, nothing found
|
122
|
+
(return-from in-charset-p nil))
|
123
|
+
(t
|
124
|
+
;; nothing yet, try next place
|
125
|
+
(setf hash (mix code hash))
|
126
|
+
(go :retry))))))))))
|
127
|
+
|
128
|
+
(defun add-to-charset (char set)
|
129
|
+
"Adds the character CHAR to the charset SET, extending SET if
|
130
|
+
necessary. Returns CHAR."
|
131
|
+
(declare #.*standard-optimize-settings*)
|
132
|
+
(or (%add-to-charset char set t)
|
133
|
+
(%add-to-charset/expand char set)
|
134
|
+
(error "Oops, this should not happen..."))
|
135
|
+
char)
|
136
|
+
|
137
|
+
(defun %add-to-charset (char set count)
|
138
|
+
"Tries to add the character CHAR to the charset SET without
|
139
|
+
extending it. Returns NIL if this fails. Counts CHAR as new
|
140
|
+
if COUNT is true and it is added to SET."
|
141
|
+
(declare #.*standard-optimize-settings*)
|
142
|
+
(declare (character char) (charset set))
|
143
|
+
(let ((vector (charset-vector set))
|
144
|
+
(depth (charset-depth set))
|
145
|
+
(code (char-code char)))
|
146
|
+
(declare (fixnum depth))
|
147
|
+
;; see comments in IN-CHARSET-P for algorithm
|
148
|
+
(cond ((or (zerop depth) (zerop code))
|
149
|
+
(unless (eq char (char vector code))
|
150
|
+
(setf (char vector code) char)
|
151
|
+
(when count
|
152
|
+
(incf (charset-count set))))
|
153
|
+
char)
|
154
|
+
(t
|
155
|
+
(let ((hash code))
|
156
|
+
(tagbody
|
157
|
+
:retry
|
158
|
+
(let* ((index (compute-index hash vector))
|
159
|
+
(x (char vector index)))
|
160
|
+
(cond ((eq x (code-char 0))
|
161
|
+
(setf (char vector index) char)
|
162
|
+
(when count
|
163
|
+
(incf (charset-count set)))
|
164
|
+
(return-from %add-to-charset char))
|
165
|
+
((eq x char)
|
166
|
+
(return-from %add-to-charset char))
|
167
|
+
((zerop (decf depth))
|
168
|
+
;; need to expand the table
|
169
|
+
(return-from %add-to-charset nil))
|
170
|
+
(t
|
171
|
+
(setf hash (mix code hash))
|
172
|
+
(go :retry))))))))))
|
173
|
+
|
174
|
+
(defun %add-to-charset/expand (char set)
|
175
|
+
"Extends the charset SET and then adds the character CHAR to it."
|
176
|
+
(declare #.*standard-optimize-settings*)
|
177
|
+
(declare (character char) (charset set))
|
178
|
+
(let* ((old-vector (charset-vector set))
|
179
|
+
(new-size (* 2 (length old-vector))))
|
180
|
+
(tagbody
|
181
|
+
:retry
|
182
|
+
;; when the table grows large (currently over 1/3 of
|
183
|
+
;; CHAR-CODE-LIMIT), we dispense with hashing and just allocate a
|
184
|
+
;; storage vector with space for all characters, so that each
|
185
|
+
;; character always uses only the CHAR-CODE
|
186
|
+
(multiple-value-bind (new-depth new-vector)
|
187
|
+
(if (>= new-size #.(truncate char-code-limit 3))
|
188
|
+
(values 0 (make-char-vector char-code-limit))
|
189
|
+
(values +probe-depth+ (make-char-vector new-size)))
|
190
|
+
(setf (charset-depth set) new-depth
|
191
|
+
(charset-vector set) new-vector)
|
192
|
+
(flet ((try-add (x)
|
193
|
+
;; don't count - old characters are already accounted
|
194
|
+
;; for, and might count the new one multiple times as
|
195
|
+
;; well
|
196
|
+
(unless (%add-to-charset x set nil)
|
197
|
+
(assert (not (zerop new-depth)))
|
198
|
+
(setf new-size (* 2 new-size))
|
199
|
+
(go :retry))))
|
200
|
+
(try-add char)
|
201
|
+
(dotimes (i (length old-vector))
|
202
|
+
(let ((x (char old-vector i)))
|
203
|
+
(if (eq x (code-char 0))
|
204
|
+
(when (zerop i)
|
205
|
+
(try-add x))
|
206
|
+
(unless (zerop i)
|
207
|
+
(try-add x))))))))
|
208
|
+
;; added and expanded, /now/ count the new character.
|
209
|
+
(incf (charset-count set))
|
210
|
+
t))
|
211
|
+
|
212
|
+
(defun map-charset (function charset)
|
213
|
+
"Calls FUNCTION with all characters in SET. Returns NIL."
|
214
|
+
(declare #.*standard-optimize-settings*)
|
215
|
+
(declare (function function))
|
216
|
+
(let* ((n (charset-count charset))
|
217
|
+
(vector (charset-vector charset))
|
218
|
+
(size (length vector)))
|
219
|
+
;; see comments in IN-CHARSET-P for algorithm
|
220
|
+
(when (eq (code-char 0) (char vector 0))
|
221
|
+
(funcall function (code-char 0))
|
222
|
+
(decf n))
|
223
|
+
(loop for i from 1 below size
|
224
|
+
for char = (char vector i)
|
225
|
+
unless (eq (code-char 0) char) do
|
226
|
+
(funcall function char)
|
227
|
+
;; this early termination test should be worth it when
|
228
|
+
;; mapping across depth 0 charsets.
|
229
|
+
(when (zerop (decf n))
|
230
|
+
(return-from map-charset nil))))
|
231
|
+
nil)
|
232
|
+
|
233
|
+
(defun create-charset-from-test-function (test-function start end)
|
234
|
+
"Creates and returns a charset representing all characters with
|
235
|
+
character codes between START and END which satisfy TEST-FUNCTION."
|
236
|
+
(declare #.*standard-optimize-settings*)
|
237
|
+
(loop with charset = (make-charset)
|
238
|
+
for code from start below end
|
239
|
+
for char = (code-char code)
|
240
|
+
when (and char (funcall test-function char))
|
241
|
+
do (add-to-charset char charset)
|
242
|
+
finally (return charset)))
|
@@ -0,0 +1,98 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-ppcre/chartest.lisp,v 1.5 2009/09/17 19:17:30 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2008-2009, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package :cl-ppcre)
|
31
|
+
|
32
|
+
(defun create-hash-table-from-test-function (test-function start end)
|
33
|
+
"Creates and returns a hash table representing all characters with
|
34
|
+
character codes between START and END which satisfy TEST-FUNCTION."
|
35
|
+
(declare #.*standard-optimize-settings*)
|
36
|
+
(loop with hash-table = (make-hash-table)
|
37
|
+
for code from start below end
|
38
|
+
for char = (code-char code)
|
39
|
+
when (and char (funcall test-function char))
|
40
|
+
do (setf (gethash char hash-table) t)
|
41
|
+
finally (return hash-table)))
|
42
|
+
|
43
|
+
(defun create-optimized-test-function (test-function &key
|
44
|
+
(start 0)
|
45
|
+
(end *regex-char-code-limit*)
|
46
|
+
(kind *optimize-char-classes*))
|
47
|
+
"Given a unary test function which is applicable to characters
|
48
|
+
returns a function which yields the same boolean results for all
|
49
|
+
characters with character codes from START to \(excluding) END. If
|
50
|
+
KIND is NIL, TEST-FUNCTION will simply be returned. Otherwise, KIND
|
51
|
+
should be one of:
|
52
|
+
|
53
|
+
* :HASH-TABLE - builds a hash table representing all characters which
|
54
|
+
satisfy the test and returns a closure which checks if
|
55
|
+
a character is in that hash table
|
56
|
+
|
57
|
+
* :CHARSET - instead of a hash table uses a \"charset\" which is a
|
58
|
+
data structure using non-linear hashing and optimized to
|
59
|
+
represent \(sparse) sets of characters in a fast and
|
60
|
+
space-efficient way \(contributed by Nikodemus Siivola)
|
61
|
+
|
62
|
+
* :CHARMAP - instead of a hash table uses a bit vector to represent
|
63
|
+
the set of characters
|
64
|
+
|
65
|
+
You can also use :HASH-TABLE* or :CHARSET* which are like :HASH-TABLE
|
66
|
+
and :CHARSET but use the complement of the set if the set contains
|
67
|
+
more than half of all characters between START and END. This saves
|
68
|
+
space but needs an additional pass across all characters to create the
|
69
|
+
data structure. There is no corresponding :CHARMAP* kind as the bit
|
70
|
+
vectors are already created to cover the smallest possible interval
|
71
|
+
which contains either the set or its complement."
|
72
|
+
(declare #.*standard-optimize-settings*)
|
73
|
+
(ecase kind
|
74
|
+
((nil) test-function)
|
75
|
+
(:charmap
|
76
|
+
(let ((charmap (create-charmap-from-test-function test-function start end)))
|
77
|
+
(lambda (char)
|
78
|
+
(in-charmap-p char charmap))))
|
79
|
+
((:charset :charset*)
|
80
|
+
(let ((charset (create-charset-from-test-function test-function start end)))
|
81
|
+
(cond ((or (eq kind :charset)
|
82
|
+
(<= (charset-count charset) (ceiling (- end start) 2)))
|
83
|
+
(lambda (char)
|
84
|
+
(in-charset-p char charset)))
|
85
|
+
(t (setq charset (create-charset-from-test-function (complement* test-function)
|
86
|
+
start end))
|
87
|
+
(lambda (char)
|
88
|
+
(not (in-charset-p char charset)))))))
|
89
|
+
((:hash-table :hash-table*)
|
90
|
+
(let ((hash-table (create-hash-table-from-test-function test-function start end)))
|
91
|
+
(cond ((or (eq kind :hash-table)
|
92
|
+
(<= (hash-table-count hash-table) (ceiling (- end start) 2)))
|
93
|
+
(lambda (char)
|
94
|
+
(gethash char hash-table)))
|
95
|
+
(t (setq hash-table (create-hash-table-from-test-function (complement* test-function)
|
96
|
+
start end))
|
97
|
+
(lambda (char)
|
98
|
+
(not (gethash char hash-table)))))))))
|
@@ -0,0 +1,34 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-ppcre/cl-ppcre-test.asd,v 1.14 2008/06/25 14:04:27 edi Exp $
|
3
|
+
|
4
|
+
;;; This ASDF system definition was kindly provided by Marco Baringer.
|
5
|
+
|
6
|
+
;;; Copyright (c) 2002-2008, Dr. Edmund Weitz. All rights reserved.
|
7
|
+
|
8
|
+
;;; Redistribution and use in source and binary forms, with or without
|
9
|
+
;;; modification, are permitted provided that the following conditions
|
10
|
+
;;; are met:
|
11
|
+
|
12
|
+
;;; * Redistributions of source code must retain the above copyright
|
13
|
+
;;; notice, this list of conditions and the following disclaimer.
|
14
|
+
|
15
|
+
;;; * Redistributions in binary form must reproduce the above
|
16
|
+
;;; copyright notice, this list of conditions and the following
|
17
|
+
;;; disclaimer in the documentation and/or other materials
|
18
|
+
;;; provided with the distribution.
|
19
|
+
|
20
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
21
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
24
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
26
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
|
32
|
+
(asdf:defsystem :cl-ppcre-test
|
33
|
+
:depends-on (:cl-ppcre)
|
34
|
+
:components ((:file "ppcre-tests")))
|
@@ -0,0 +1,38 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-ppcre/cl-ppcre-unicode/packages.lisp,v 1.3 2009/09/17 19:17:34 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2002-2009, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package :cl-user)
|
31
|
+
|
32
|
+
(defpackage :cl-ppcre-unicode
|
33
|
+
#+:genera
|
34
|
+
(:shadowing-import-from :common-lisp :lambda :string)
|
35
|
+
(:use #-:genera :cl #+:genera :future-common-lisp
|
36
|
+
:cl-ppcre :cl-unicode)
|
37
|
+
(:import-from :cl-ppcre :signal-syntax-error)
|
38
|
+
(:export :unicode-property-resolver))
|
@@ -0,0 +1,61 @@
|
|
1
|
+
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-PPCRE; Base: 10 -*-
|
2
|
+
;;; $Header: /usr/local/cvsrep/cl-ppcre/cl-ppcre-unicode/resolver.lisp,v 1.5 2008/07/23 02:14:08 edi Exp $
|
3
|
+
|
4
|
+
;;; Copyright (c) 2008, Dr. Edmund Weitz. All rights reserved.
|
5
|
+
|
6
|
+
;;; Redistribution and use in source and binary forms, with or without
|
7
|
+
;;; modification, are permitted provided that the following conditions
|
8
|
+
;;; are met:
|
9
|
+
|
10
|
+
;;; * Redistributions of source code must retain the above copyright
|
11
|
+
;;; notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
;;; * Redistributions in binary form must reproduce the above
|
14
|
+
;;; copyright notice, this list of conditions and the following
|
15
|
+
;;; disclaimer in the documentation and/or other materials
|
16
|
+
;;; provided with the distribution.
|
17
|
+
|
18
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
|
19
|
+
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
22
|
+
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
24
|
+
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
26
|
+
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
27
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
28
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
|
30
|
+
(in-package :cl-ppcre-unicode)
|
31
|
+
|
32
|
+
(defun unicode-property-resolver (property-name)
|
33
|
+
"A property resolver which understands Unicode properties using
|
34
|
+
CL-UNICODE's PROPERTY-TEST function. This resolver is automatically
|
35
|
+
installed in *PROPERTY-RESOLVER* when the CL-PPCRE-UNICODE system is
|
36
|
+
loaded."
|
37
|
+
(or (property-test property-name :errorp nil)
|
38
|
+
(signal-syntax-error "There is no property named ~S." property-name)))
|
39
|
+
|
40
|
+
(setq *property-resolver* 'unicode-property-resolver)
|
41
|
+
|
42
|
+
(pushnew :cl-ppcre-unicode *features*)
|
43
|
+
|
44
|
+
;; stuff for Nikodemus Siivola's HYPERDOC
|
45
|
+
;; see <http://common-lisp.net/project/hyperdoc/>
|
46
|
+
;; and <http://www.cliki.net/hyperdoc>
|
47
|
+
;; also used by LW-ADD-ONS
|
48
|
+
|
49
|
+
(defvar *hyperdoc-base-uri* "http://weitz.de/cl-ppcre/")
|
50
|
+
|
51
|
+
(let ((exported-symbols-alist
|
52
|
+
(loop for symbol being the external-symbols of :cl-ppcre-unicode
|
53
|
+
collect (cons symbol
|
54
|
+
(concatenate 'string
|
55
|
+
"#"
|
56
|
+
(string-downcase symbol))))))
|
57
|
+
(defun hyperdoc-lookup (symbol type)
|
58
|
+
(declare (ignore type))
|
59
|
+
(cdr (assoc symbol
|
60
|
+
exported-symbols-alist
|
61
|
+
:test #'eq))))
|