Coverage report: /home/ellis/comp/core/lib/dat/html/const.lisp

KindCoveredAll%
expression7349 2.0
branch02 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 (in-package :dat/html)
2
 
3
 ;;; Constants
4
 (defglobal +namespaces+
5
   '(("html" . "http://www.w3.org/1999/xhtml")
6
     ("mathml" ."http://www.w3.org/1998/Math/MathML")
7
     ("svg" . "http://www.w3.org/2000/svg")
8
     ("xlink" . "http://www.w3.org/1999/xlink")
9
     ("xml" . "http://www.w3.org/XML/1998/namespace")
10
     ("xmlns" . "http://www.w3.org/2000/xmlns/")))
11
 
12
 (eval-always 
13
   (defun find-namespace (prefix)
14
     (cdr (assoc prefix +namespaces+ :test #'string=))))
15
 
16
 (defun find-prefix (namespace)
17
   (car (find namespace +namespaces+ :test #'string= :key #'cdr)))
18
 
19
 (defglobal +scoping-elements+
20
   `((,(find-namespace "html") . "applet")
21
     (,(find-namespace "html") . "caption")
22
     (,(find-namespace "html") . "html")
23
     (,(find-namespace "html") . "marquee")
24
     (,(find-namespace "html") . "object")
25
     (,(find-namespace "html") . "table")
26
     (,(find-namespace "html") . "td")
27
     (,(find-namespace "html") . "th")
28
     (,(find-namespace "mathml") . "mi")
29
     (,(find-namespace "mathml") . "mo")
30
     (,(find-namespace "mathml") . "mn")
31
     (,(find-namespace "mathml") . "ms")
32
     (,(find-namespace "mathml") . "mtext")
33
     (,(find-namespace "mathml") . "annotation-xml")
34
     (,(find-namespace "svg") . "foreignObject")
35
     (,(find-namespace "svg") . "desc")
36
     (,(find-namespace "svg") . "title")))
37
 
38
 
39
 (defglobal +formatting-elements+
40
   `((,(find-namespace "html") . "a")
41
     (,(find-namespace "html") . "b")
42
     (,(find-namespace "html") . "big")
43
     (,(find-namespace "html") . "code")
44
     (,(find-namespace "html") . "em")
45
     (,(find-namespace "html") . "font")
46
     (,(find-namespace "html") . "i")
47
     (,(find-namespace "html") . "nobr")
48
     (,(find-namespace "html") . "s")
49
     (,(find-namespace "html") . "small")
50
     (,(find-namespace "html") . "strike")
51
     (,(find-namespace "html") . "strong")
52
     (,(find-namespace "html") . "tt")
53
     (,(find-namespace "html") . "u")))
54
 
55
 (defglobal +special-elements+
56
   `((,(find-namespace "html") . "address")
57
     (,(find-namespace "html") . "applet")
58
     (,(find-namespace "html") . "area")
59
     (,(find-namespace "html") . "article")
60
     (,(find-namespace "html") . "aside")
61
     (,(find-namespace "html") . "base")
62
     (,(find-namespace "html") . "basefont")
63
     (,(find-namespace "html") . "bgsound")
64
     (,(find-namespace "html") . "blockquote")
65
     (,(find-namespace "html") . "body")
66
     (,(find-namespace "html") . "br")
67
     (,(find-namespace "html") . "button")
68
     (,(find-namespace "html") . "caption")
69
     (,(find-namespace "html") . "center")
70
     (,(find-namespace "html") . "col")
71
     (,(find-namespace "html") . "colgroup")
72
     (,(find-namespace "html") . "command")
73
     (,(find-namespace "html") . "dd")
74
     (,(find-namespace "html") . "details")
75
     (,(find-namespace "html") . "dir")
76
     (,(find-namespace "html") . "div")
77
     (,(find-namespace "html") . "dl")
78
     (,(find-namespace "html") . "dt")
79
     (,(find-namespace "html") . "embed")
80
     (,(find-namespace "html") . "fieldset")
81
     (,(find-namespace "html") . "figure")
82
     (,(find-namespace "html") . "footer")
83
     (,(find-namespace "html") . "form")
84
     (,(find-namespace "html") . "frame")
85
     (,(find-namespace "html") . "frameset")
86
     (,(find-namespace "html") . "h1")
87
     (,(find-namespace "html") . "h2")
88
     (,(find-namespace "html") . "h3")
89
     (,(find-namespace "html") . "h4")
90
     (,(find-namespace "html") . "h5")
91
     (,(find-namespace "html") . "h6")
92
     (,(find-namespace "html") . "head")
93
     (,(find-namespace "html") . "header")
94
     (,(find-namespace "html") . "hr")
95
     (,(find-namespace "html") . "html")
96
     (,(find-namespace "html") . "iframe")
97
     ;; Note that image is commented out in the spec as "this isn't an
98
     ;; element that can end up on the stack, so it doesn't matter,"
99
     (,(find-namespace "html") . "image")
100
     (,(find-namespace "html") . "img")
101
     (,(find-namespace "html") . "input")
102
     (,(find-namespace "html") . "isindex")
103
     (,(find-namespace "html") . "li")
104
     (,(find-namespace "html") . "link")
105
     (,(find-namespace "html") . "listing")
106
     (,(find-namespace "html") . "marquee")
107
     (,(find-namespace "html") . "menu")
108
     (,(find-namespace "html") . "meta")
109
     (,(find-namespace "html") . "nav")
110
     (,(find-namespace "html") . "noembed")
111
     (,(find-namespace "html") . "noframes")
112
     (,(find-namespace "html") . "noscript")
113
     (,(find-namespace "html") . "object")
114
     (,(find-namespace "html") . "ol")
115
     (,(find-namespace "html") . "p")
116
     (,(find-namespace "html") . "param")
117
     (,(find-namespace "html") . "plaintext")
118
     (,(find-namespace "html") . "pre")
119
     (,(find-namespace "html") . "script")
120
     (,(find-namespace "html") . "section")
121
     (,(find-namespace "html") . "select")
122
     (,(find-namespace "html") . "style")
123
     (,(find-namespace "html") . "table")
124
     (,(find-namespace "html") . "tbody")
125
     (,(find-namespace "html") . "td")
126
     (,(find-namespace "html") . "textarea")
127
     (,(find-namespace "html") . "tfoot")
128
     (,(find-namespace "html") . "th")
129
     (,(find-namespace "html") . "thead")
130
     (,(find-namespace "html") . "title")
131
     (,(find-namespace "html") . "tr")
132
     (,(find-namespace "html") . "ul")
133
     (,(find-namespace "html") . "wbr")
134
     (,(find-namespace "html") . "xmp")
135
     (,(find-namespace "svg") . "foreignObject")))
136
 
137
 (defglobal +html-integration-point-elements+
138
   `((,(find-namespace "mathml") . "annotation-xml")
139
     (,(find-namespace "svg") . "foreignObject")
140
     (,(find-namespace "svg") . "desc")
141
     (,(find-namespace "svg") . "title")))
142
 
143
 (defglobal +mathml-text-integration-point-elements+
144
   `((,(find-namespace "mathml") . "mi")
145
     (,(find-namespace "mathml") . "mo")
146
     (,(find-namespace "mathml") . "mn")
147
     (,(find-namespace "mathml") . "ms")
148
     (,(find-namespace "mathml") . "mtext")))
149
 
150
 (defconstant +eof+ '+eof+)
151
 
152
 (defglobal +token-types+
153
   '(:doctype 0
154
     :characters 1
155
     :space-characters 2
156
     :star-ttag 3
157
     :end-tag 4
158
     :empty-tag 5
159
     :comment 6
160
     :parse-error 7))
161
 
162
 (defglobal +tag-token-types+
163
   '(:start-tag :end-tag :empty-tag))
164
 
165
 (defglobal +space-characters+
166
   '(#\Tab
167
     #\Newline
168
     #\u000C
169
     #\Space
170
     #\Return))
171
 
172
 (defglobal +table-insert-mode-elements+
173
   '("table"
174
     "tbody"
175
     "tfoot"
176
     "thead"
177
     "tr"))
178
 
179
 (defglobal +ascii-lowercase+ "abcdefghijklmnopqrstuvwxyz")
180
 (defglobal +ascii-uppercase+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
181
 (defglobal +ascii-letters+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
182
 (defglobal +digits+ "0123456789")
183
 (defglobal +hex-digits+ "0123456789abcdefABCDEF")
184
 
185
 (defun ascii-letter-p (c)
186
   (when (characterp c)
187
     (let ((code (char-code c)))
188
       (or (<= #.(char-code #\a) code #.(char-code #\z))
189
           (<= #.(char-code #\A) code #.(char-code #\Z))))))
190
 
191
 (defun ascii-upper-2-lower (string)
192
   (let ((out (copy-seq string)))
193
     (dotimes (i (length string))
194
       (let ((p (position (char out i) +ascii-uppercase+)))
195
         (when p
196
           (setf (char out i) (char +ascii-lowercase+ p)))))
197
     out))
198
 
199
 
200
 (defglobal +replacement-characters+
201
   '(#x0 #\uFFFD
202
     #x0d #\u000D
203
     #x80 #\u20AC
204
     #x81 #\u0081
205
     #x81 #\u0081
206
     #x82 #\u201A
207
     #x83 #\u0192
208
     #x84 #\u201E
209
     #x85 #\u2026
210
     #x86 #\u2020
211
     #x87 #\u2021
212
     #x88 #\u02C6
213
     #x89 #\u2030
214
     #x8A #\u0160
215
     #x8B #\u2039
216
     #x8C #\u0152
217
     #x8D #\u008D
218
     #x8E #\u017D
219
     #x8F #\u008F
220
     #x90 #\u0090
221
     #x91 #\u2018
222
     #x92 #\u2019
223
     #x93 #\u201C
224
     #x94 #\u201D
225
     #x95 #\u2022
226
     #x96 #\u2013
227
     #x97 #\u2014
228
     #x98 #\u02DC
229
     #x99 #\u2122
230
     #x9A #\u0161
231
     #x9B #\u203A
232
     #x9C #\u0153
233
     #x9D #\u009D
234
     #x9E #\u017E
235
     #x9F #\u0178))
236
 
237
 
238
 (defglobal +cdata-elements+
239
   '("title"
240
     "textarea"))
241
 
242
 (defglobal +rcdata-elements+
243
   '("style"
244
     "script"
245
     "xmp"
246
     "iframe"
247
     "noembed"
248
     "noframes"
249
     "noscript"))
250
 
251
 (defglobal +html-integration-point-elements+
252
   `((,(find-namespace "mathml") . "annotation-xml")
253
     (,(find-namespace "svg") . "foreignObject")
254
     (,(find-namespace "svg") . "desc")
255
     (,(find-namespace "svg") . "title")))
256
 
257
 (defglobal +mathml-text-integration-point-elements+
258
   `((,(find-namespace "mathml") . "mi")
259
     (,(find-namespace "mathml") . "mo")
260
     (,(find-namespace "mathml") . "mn")
261
     (,(find-namespace "mathml") . "ms")
262
     (,(find-namespace "mathml") . "mtext")))
263
 
264
 (defun make-hash-lookup (replacements)
265
   (let ((rhash (make-hash-table :test #'equalp)))
266
     (loop for (from to) in replacements
267
        do (setf (gethash from rhash) to))))
268
 
269
 
270
 (defglobal +quirks-mode-doctypes-regexp+
271
   (cl-ppcre:create-scanner
272
    '(:sequence :start-anchor
273
      (:alternation
274
       "+//silmaril//dtd html pro v0r11 19970101//"
275
       "-//advasoft ltd//dtd html 3.0 aswedit + extensions//"
276
       "-//as//dtd html 3.0 aswedit + extensions//"
277
       "-//ietf//dtd html 2.0 level 1//"
278
       "-//ietf//dtd html 2.0 level 2//"
279
       "-//ietf//dtd html 2.0 strict level 1//"
280
       "-//ietf//dtd html 2.0 strict level 2//"
281
       "-//ietf//dtd html 2.0 strict//"
282
       "-//ietf//dtd html 2.0//"
283
       "-//ietf//dtd html 2.1e//"
284
       "-//ietf//dtd html 3.0//"
285
       "-//ietf//dtd html 3.2 final//"
286
       "-//ietf//dtd html 3.2//"
287
       "-//ietf//dtd html 3//"
288
       "-//ietf//dtd html level 0//"
289
       "-//ietf//dtd html level 1//"
290
       "-//ietf//dtd html level 2//"
291
       "-//ietf//dtd html level 3//"
292
       "-//ietf//dtd html strict level 0//"
293
       "-//ietf//dtd html strict level 1//"
294
       "-//ietf//dtd html strict level 2//"
295
       "-//ietf//dtd html strict level 3//"
296
       "-//ietf//dtd html strict//"
297
       "-//ietf//dtd html//"
298
       "-//metrius//dtd metrius presentational//"
299
       "-//microsoft//dtd internet explorer 2.0 html strict//"
300
       "-//microsoft//dtd internet explorer 2.0 html//"
301
       "-//microsoft//dtd internet explorer 2.0 tables//"
302
       "-//microsoft//dtd internet explorer 3.0 html strict//"
303
       "-//microsoft//dtd internet explorer 3.0 html//"
304
       "-//microsoft//dtd internet explorer 3.0 tables//"
305
       "-//netscape comm. corp.//dtd html//"
306
       "-//netscape comm. corp.//dtd strict html//"
307
       "-//o'reilly and associates//dtd html 2.0//"
308
       "-//o'reilly and associates//dtd html extended 1.0//"
309
       "-//o'reilly and associates//dtd html extended relaxed 1.0//"
310
       "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//"
311
       "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//"
312
       "-//spyglass//dtd html 2.0 extended//"
313
       "-//sq//dtd html 2.0 hotmetal + extensions//"
314
       "-//sun microsystems corp.//dtd hotjava html//"
315
       "-//sun microsystems corp.//dtd hotjava strict html//"
316
       "-//w3c//dtd html 3 1995-03-24//"
317
       "-//w3c//dtd html 3.2 draft//"
318
       "-//w3c//dtd html 3.2 final//"
319
       "-//w3c//dtd html 3.2//"
320
       "-//w3c//dtd html 3.2s draft//"
321
       "-//w3c//dtd html 4.0 frameset//"
322
       "-//w3c//dtd html 4.0 transitional//"
323
       "-//w3c//dtd html experimental 19960712//"
324
       "-//w3c//dtd html experimental 970421//"
325
       "-//w3c//dtd w3 html//"
326
       "-//w3o//dtd w3 html 3.0//"
327
       "-//webtechs//dtd mozilla html 2.0//"
328
       "-//webtechs//dtd mozilla html//"))))
329
 
330
 (defglobal +heading-elements+
331
   '("h1"
332
     "h2"
333
     "h3"
334
     "h4"
335
     "h5"
336
     "h6"))