-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
5124 lines (4371 loc) · 304 KB
/
Overview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html><html lang=en><head>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Syntax Module Level 3</title>
<link href=../default.css rel=stylesheet type=text/css>
<link href=../csslogo.ico rel="shortcut icon" type=image/x-icon>
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><style>
#serialization-tables th { font-size: 80%; line-height: normal }
</style>
</head>
<body class=h-entry>
<div class=head>
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
<img alt=W3C height=48 src=https://www.w3.org/Icons/w3c_home width=72>
</a>
</p>
<h1 class="p-name no-ref" id=title>CSS Syntax Module Level 3</h1>
<h2 class="no-num no-toc no-ref heading settled" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20141014>14 October 2014</span></span></span></h2>
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-syntax-3/>http://www.w3.org/TR/css-syntax-3/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/ rel=previous>http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/</a><dt>Feedback:<dd><span><a href="mailto:www-style@w3.org?subject=[css-syntax] feedback">www-style@w3.org</a> with subject line “<kbd>[css-syntax] <var>… message topic …</var></kbd>” (<a href=http://lists.w3.org/Archives/Public/www-style/ rel=discussion>archives</a>)</span><dt>Editors:<dd><div class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://xanthir.com/contact/>Tab Atkins Jr.</a> (<span class="p-org org">Google</span>)</div><dd><div class="p-author h-card vcard"><a class="p-name fn u-url url" href=http://exyr.org/about/>Simon Sapin</a> (<span class="p-org org">Mozilla</span>)</div></dl></div>
<div data-fill-with=warning></div>
<p class=copyright data-fill-with=copyright><a href=http://www.w3.org/Consortium/Legal/ipr-notice#Copyright>Copyright</a> © 2014 <a href=http://www.w3.org/><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href=http://www.csail.mit.edu/><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href=http://www.ercim.eu/><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href=http://www.keio.ac.jp/>Keio</a>, <a href=http://ev.buaa.edu.cn/>Beihang</a>), All Rights Reserved. W3C <a href=http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer>liability</a>, <a href=http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks>trademark</a> and <a href=http://www.w3.org/Consortium/Legal/copyright-documents>document use</a> rules apply.
</p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id=abstract><span class=content>Abstract</span></h2>
<div class=p-summary data-fill-with=abstract><p>This module describes, in general terms, the basic structure and syntax of CSS stylesheets. It defines, in detail, the syntax and parsing of CSS - how to turn a stream of bytes into a meaningful stylesheet.</p>
<a href=http://www.w3.org/TR/CSS/>CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.</div>
<h2 class="no-num no-toc no-ref heading settled" id=status><span class=content>Status of this document</span></h2>
<div data-fill-with=status><p>
This is a public copy of the editors’ draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress.
<p>
The (<a href=http://lists.w3.org/Archives/Public/www-style/>archived</a>) public mailing list
<a href="mailto:www-style@w3.org?Subject=%5Bcss-syntax%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>
(see <a href=http://www.w3.org/Mail/Request>instructions</a>)
is preferred for discussion of this specification.
When sending e-mail,
please put the text “css-syntax” in the subject,
preferably like this:
“[css-syntax] <em>…summary of comment…</em>”
<p>
This document was produced by the <a href=http://www.w3.org/Style/CSS/members>CSS Working Group</a>
(part of the <a href=http://www.w3.org/Style/>Style Activity</a>).
<p>
This document was produced by a group operating under
the <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/>5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href=http://www.w3.org/2004/01/pp-impl/32061/status rel=disclosure>public list of any patent disclosures</a>
made in connection with the deliverables of the group;
that page also includes instructions for disclosing a patent.
An individual who has actual knowledge of a patent which the individual believes contains <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential>Essential Claim(s)</a>
must disclose the information in accordance with <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure>section 6 of the W3C Patent Policy</a>.
<p>
This document is governed by the <a href=http://www.w3.org/2014/Process-20140801/>1 August 2014 W3C Process Document</a>.
</div>
<div data-fill-with=at-risk></div>
<h2 class="no-num no-toc no-ref heading settled" id=contents><span class=content>Table of Contents</span></h2>
<div data-fill-with=table-of-contents><ul class=toc><li><a href=#intro><span class=secno>1</span> <span class=content>
Introduction</span></a><ul class=toc><li><a href=#placement><span class=secno>1.1</span> <span class=content>
Module interactions</span></a></ul><li><a href=#syntax-description><span class=secno>2</span> <span class=content>
Description of CSS’s Syntax</span></a><ul class=toc><li><a href=#escaping><span class=secno>2.1</span> <span class=content>
Escaping</span></a><li><a href=#error-handling><span class=secno>2.2</span> <span class=content>
Error Handling</span></a></ul><li><a href=#tokenizing-and-parsing><span class=secno>3</span> <span class=content>
Tokenizing and Parsing CSS</span></a><ul class=toc><li><a href=#parsing-overview><span class=secno>3.1</span> <span class=content>
Overview of the Parsing Model</span></a><li><a href=#input-byte-stream><span class=secno>3.2</span> <span class=content>
The input byte stream</span></a><li><a href=#input-preprocessing><span class=secno>3.3</span> <span class=content>
Preprocessing the input stream</span></a></ul><li><a href=#tokenization><span class=secno>4</span> <span class=content>
Tokenization</span></a><ul class=toc><li><a href=#token-diagrams><span class=secno>4.1</span> <span class=content>
Token Railroad Diagrams</span></a><li><a href=#tokenizer-definitions><span class=secno>4.2</span> <span class=content>
Definitions</span></a><li><a href=#tokenizer-algorithms><span class=secno>4.3</span> <span class=content>
Tokenizer Algorithms</span></a><ul class=toc><li><a href=#consume-a-token><span class=secno>4.3.1</span> <span class=content>
Consume a token</span></a><li><a href=#consume-comments><span class=secno>4.3.2</span> <span class=content>
Consume comments</span></a><li><a href=#consume-a-numeric-token><span class=secno>4.3.3</span> <span class=content>
Consume a numeric token</span></a><li><a href=#consume-an-ident-like-token><span class=secno>4.3.4</span> <span class=content>
Consume an ident-like token</span></a><li><a href=#consume-a-string-token><span class=secno>4.3.5</span> <span class=content>
Consume a string token</span></a><li><a href=#consume-a-url-token><span class=secno>4.3.6</span> <span class=content>
Consume a url token</span></a><li><a href=#consume-a-unicode-range-token><span class=secno>4.3.7</span> <span class=content>
Consume a unicode-range token</span></a><li><a href=#consume-an-escaped-code-point><span class=secno>4.3.8</span> <span class=content>
Consume an escaped code point</span></a><li><a href=#starts-with-a-valid-escape><span class=secno>4.3.9</span> <span class=content>
Check if two code points are a valid escape</span></a><li><a href=#would-start-an-identifier><span class=secno>4.3.10</span> <span class=content>
Check if three code points would start an identifier</span></a><li><a href=#starts-with-a-number><span class=secno>4.3.11</span> <span class=content>
Check if three code points would start a number</span></a><li><a href=#consume-a-name><span class=secno>4.3.12</span> <span class=content>
Consume a name</span></a><li><a href=#consume-a-number><span class=secno>4.3.13</span> <span class=content>
Consume a number</span></a><li><a href=#convert-a-string-to-a-number><span class=secno>4.3.14</span> <span class=content>
Convert a string to a number</span></a><li><a href=#consume-the-remnants-of-a-bad-url><span class=secno>4.3.15</span> <span class=content>
Consume the remnants of a bad url</span></a></ul></ul><li><a href=#parsing><span class=secno>5</span> <span class=content>
Parsing</span></a><ul class=toc><li><a href=#parser-diagrams><span class=secno>5.1</span> <span class=content>
Parser Railroad Diagrams</span></a><li><a href=#parser-definitions><span class=secno>5.2</span> <span class=content>
Definitions</span></a><li><a href=#parser-entry-points><span class=secno>5.3</span> <span class=content>
Parser Entry Points</span></a><ul class=toc><li><a href=#parse-grammar><span class=secno>5.3.1</span> <span class=content>
Parse something according to a CSS grammar</span></a><li><a href=#parse-a-stylesheet><span class=secno>5.3.2</span> <span class=content>
Parse a stylesheet</span></a><li><a href=#parse-a-list-of-rules><span class=secno>5.3.3</span> <span class=content>
Parse a list of rules</span></a><li><a href=#parse-a-rule><span class=secno>5.3.4</span> <span class=content>
Parse a rule</span></a><li><a href=#parse-a-declaration><span class=secno>5.3.5</span> <span class=content>
Parse a declaration</span></a><li><a href=#parse-a-list-of-declarations><span class=secno>5.3.6</span> <span class=content>
Parse a list of declarations</span></a><li><a href=#parse-a-component-value><span class=secno>5.3.7</span> <span class=content>
Parse a component value</span></a><li><a href=#parse-a-list-of-component-values><span class=secno>5.3.8</span> <span class=content>
Parse a list of component values</span></a><li><a href=#parse-a-comma-separated-list-of-component-values><span class=secno>5.3.9</span> <span class=content>
Parse a comma-separated list of component values</span></a></ul><li><a href=#parser-algorithms><span class=secno>5.4</span> <span class=content>
Parser Algorithms</span></a><ul class=toc><li><a href=#consume-a-list-of-rules><span class=secno>5.4.1</span> <span class=content>
Consume a list of rules</span></a><li><a href=#consume-an-at-rule><span class=secno>5.4.2</span> <span class=content>
Consume an at-rule</span></a><li><a href=#consume-a-qualified-rule><span class=secno>5.4.3</span> <span class=content>
Consume a qualified rule</span></a><li><a href=#consume-a-list-of-declarations><span class=secno>5.4.4</span> <span class=content>
Consume a list of declarations</span></a><li><a href=#consume-a-declaration><span class=secno>5.4.5</span> <span class=content>
Consume a declaration</span></a><li><a href=#consume-a-component-value><span class=secno>5.4.6</span> <span class=content>
Consume a component value</span></a><li><a href=#consume-a-simple-block><span class=secno>5.4.7</span> <span class=content>
Consume a simple block</span></a><li><a href=#consume-a-function><span class=secno>5.4.8</span> <span class=content>
Consume a function</span></a></ul></ul><li><a href=#anb><span class=secno>6</span> <span class=content>
The <var>An+B</var> microsyntax</span></a><ul class=toc><li><a href=#anb-syntax><span class=secno>6.1</span> <span class=content>
Informal Syntax Description</span></a><li><a href=#the-anb-type><span class=secno>6.2</span> <span class=content>
The <code><an+b></code> type</span></a></ul><li><a href=#rule-defs><span class=secno>7</span> <span class=content>
Defining Grammars for Rules and Other Values</span></a><ul class=toc><li><a href=#declaration-rule-list><span class=secno>7.1</span> <span class=content>
Defining Block Contents: the <span class=production data-link-type=type title="<declaration-list>"><declaration-list></span>, <span class=production data-link-type=type title="<rule-list>"><rule-list></span>, and <span class=production data-link-type=type title="<stylesheet>"><stylesheet></span> productions</span></a></ul><li><a href=#css-stylesheets><span class=secno>8</span> <span class=content>
CSS stylesheets</span></a><ul class=toc><li><a href=#style-rules><span class=secno>8.1</span> <span class=content>
Style rules</span></a><li><a href=#charset-rule><span class=secno>8.2</span> <span class=content>
The <span class=css data-link-type=maybe title=@charset>@charset</span> Rule</span></a></ul><li><a href=#serialization><span class=secno>9</span> <span class=content>
Serialization</span></a><ul class=toc><li><a href=#serializing-anb><span class=secno>9.1</span> <span class=content>
Serializing <var><an+b></var></span></a></ul><li><a href=#changes><span class=secno>10</span> <span class=content>
Changes</span></a><ul class=toc><li><a href=#changes-CR-20140220><span class=secno>10.1</span> <span class=content>
Changes from the 20 February 2014 Candidate Recommendation</span></a><li><a href=#changes-WD-20131105><span class=secno>10.2</span> <span class=content>
Changes from the 5 November 2013 Last Call Working Draft</span></a><li><a href=#changes-WD-20130919><span class=secno>10.3</span> <span class=content>
Changes from the 19 September 2013 Working Draft</span></a><li><a href=#changes-css21><span class=secno>10.4</span> <span class=content>
Changes from CSS 2.1 and Selectors Level 3</span></a></ul><li><a href=#acknowledgments><span class=secno></span> <span class=content>
Acknowledgments</span></a><li><a href=#conformance><span class=secno></span> <span class=content>
Conformance</span></a><ul class=toc><li><a href=#conventions><span class=secno></span> <span class=content>
Document conventions</span></a><li><a href=#conformance-classes><span class=secno></span> <span class=content>
Conformance classes</span></a><li><a href=#partial><span class=secno></span> <span class=content>
Partial implementations</span></a><li><a href=#experimental><span class=secno></span> <span class=content>
Experimental implementations</span></a><li><a href=#testing><span class=secno></span> <span class=content>
Non-experimental implementations</span></a></ul><li><a href=#references><span class=secno></span> <span class=content>References</span></a><ul class=toc><li><a href=#normative><span class=secno></span> <span class=content>Normative References</span></a><li><a href=#informative><span class=secno></span> <span class=content>Informative References</span></a></ul><li><a href=#index><span class=secno></span> <span class=content>Index</span></a></ul></div>
<h2 class="heading settled" data-level=1 id=intro><span class=secno>1. </span><span class=content>
Introduction</span><a class=self-link href=#intro></a></h2>
<p><em>This section is not normative.</em></p>
<p>This module defines the abstract syntax and parsing of CSS stylesheets
and other things which use CSS syntax
(such as the HTML <code>style</code> attribute).</p>
<p>It defines algorithms for converting a stream of Unicode <a data-link-type=dfn href=#code-point title="code points">code points</a>
(in other words, text)
into a stream of CSS tokens,
and then further into CSS objects
such as stylesheets, rules, and declarations.</p>
<h3 class="heading settled" data-level=1.1 id=placement><span class=secno>1.1. </span><span class=content>
Module interactions</span><a class=self-link href=#placement></a></h3>
<p>This module defines the syntax and parsing of CSS stylesheets.
It supersedes the lexical scanner and grammar defined in CSS 2.1.</p>
<h2 class="heading settled" data-level=2 id=syntax-description><span class=secno>2. </span><span class=content>
Description of CSS’s Syntax</span><a class=self-link href=#syntax-description></a></h2>
<p><em>This section is not normative.</em></p>
<p>A CSS document is a series of <a data-link-type=dfn href=#qualified-rule title="qualified rules">qualified rules</a>,
which are usually style rules that apply CSS properties to elements,
and <a data-link-type=dfn href=#at-rule title=at-rules>at-rules</a>,
which define special processing rules or values for the CSS document.</p>
<p>A qualified rule starts with a prelude
then has a {}-wrapped block containing a sequence of declarations.
The meaning of the prelude varies based on the context that the rule appears in -
for style rules, it’s a selector which specifies what elements the declarations will apply to.
Each declaration has a name,
followed by a colon and the declaration value.
Declarations are separated by semicolons.</p>
<div class=example>
<p>A typical rule might look something like this:</p>
<pre>p > a {
color: blue;
text-decoration: underline;
}
</pre>
<p>In the above rule, "<code>p > a</code>" is the selector,
which, if the source document is HTML,
selects any <code><a></code> elements that are children of a <code><p></code> element.</p>
<p>"<code>color: blue</code>" is a declaration specifying that,
for the elements that match the selector,
their <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-color-3/#color0 title=color>color</a> property should have the value <span class=css>blue</span>.
Similarly, their <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-text-decor-3/#propdef-text-decoration title=text-decoration>text-decoration</a> property should have the value <span class=css>underline</span>.</p>
</div>
<p>At-rules are all different, but they have a basic structure in common.
They start with an "@" <a data-link-type=dfn href=#code-point title="code point">code point</a> followed by their name.
Some <a data-link-type=dfn href=#at-rule title=at-rules>at-rules</a> are simple statements,
with their name followed by more CSS values to specify their behavior,
and finally ended by a semicolon.
Others are blocks;
they can have CSS values following their name,
but they end with a {}-wrapped block,
similar to a <a data-link-type=dfn href=#qualified-rule title="qualified rule">qualified rule</a>.
Even the contents of these blocks are specific to the given <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a>:
sometimes they contain a sequence of declarations, like a <a data-link-type=dfn href=#qualified-rule title="qualified rule">qualified rule</a>;
other times, they may contain additional blocks, or at-rules, or other structures altogether.</p>
<div class=example>
<p>Here are several examples of <a data-link-type=dfn href=#at-rule title=at-rules>at-rules</a> that illustrate the varied syntax they may contain.</p>
<pre>@import "my-styles.css";</pre>
<p>The <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-cascade-3/#at-ruledef-import title=@import>@import</a> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> is a simple statement.
After its name, it takes a single string or <span class=css>url()</span> function to indicate the stylesheet that it should import.</p>
<pre>@page :left {
margin-left: 4cm;
margin-right: 3cm;
}
</pre>
<p>The <span class=css>@page</span> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> consists of an optional page selector (the <span class=css>:left</span> pseudoclass),
followed by a block of properties that apply to the page when printed.
In this way, it’s very similar to a normal style rule,
except that its properties don’t apply to any "element",
but rather the page itself.</p>
<pre>@media print {
body { font-size: 10pt }
}
</pre>
<p>The <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-conditional-3/#at-ruledef-media title=@media>@media</a> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> begins with a media type
and a list of optional media queries.
Its block contains entire rules,
which are only applied when the <a class=css data-link-type=maybe href=http://dev.w3.org/csswg/css-conditional-3/#at-ruledef-media title=@media>@media</a>s conditions are fulfilled.</p>
</div>
<p>Property names and <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> names are always <a data-link-type=dfn href=#identifier title=identifiers>identifiers</a>,
which have to start with a letter or a hyphen followed by a letter,
and then can contain letters, numbers, hyphens, or underscores.
You can include any <a data-link-type=dfn href=#code-point title="code point">code point</a> at all,
even ones that CSS uses in its syntax,
by <a data-link-type=dfn href=#escaping0 title=escaping>escaping</a> it.</p>
<p>The syntax of selectors is defined in the <a href=http://www.w3.org/TR/selectors/>Selectors spec</a>.
Similarly, the syntax of the wide variety of CSS values is defined in the <a href=http://www.w3.org/TR/css3-values/>Values & Units spec</a>.
The special syntaxes of individual <a data-link-type=dfn href=#at-rule title=at-rules>at-rules</a> can be found in the specs that define them.</p>
<h3 class="heading settled" data-level=2.1 id=escaping><span class=secno>2.1. </span><span class=content>
Escaping</span><a class=self-link href=#escaping></a></h3>
<p><em>This section is not normative.</em></p>
<p>Any Unicode <a data-link-type=dfn href=#code-point title="code point">code point</a> can be included in an <a data-link-type=dfn href=#identifier title=identifier>identifier</a> or quoted string
by <dfn data-dfn-type=dfn data-noexport="" id=escaping0>escaping<a class=self-link href=#escaping0></a></dfn> it.
CSS escape sequences start with a backslash (\), and continue with:</p>
<ul>
<li>
Any Unicode <a data-link-type=dfn href=#code-point title="code point">code point</a> that is not a <a data-link-type=dfn href=#hex-digit title="hex digits">hex digits</a> or a <a data-link-type=dfn href=#newline title=newline>newline</a>.
The escape sequence is replaced by that <a data-link-type=dfn href=#code-point title="code point">code point</a>.
<li>
Or one to six <a data-link-type=dfn href=#hex-digit title="hex digits">hex digits</a>, followed by an optional <a data-link-type=dfn href=#whitespace title=whitespace>whitespace</a>.
The escape sequence is replaced by the Unicode <a data-link-type=dfn href=#code-point title="code point">code point</a>
whose value is given by the hexadecimal digits.
This optional whitespace allow hexadecimal escape sequences
to be followed by "real" hex digits.
<p class=example>
An <a data-link-type=dfn href=#identifier title=identifier>identifier</a> with the value "&B"
could be written as <span class=css>\26 B</span> or <span class=css>\000026B</span>.
<p class=note>
A "real" space after the escape sequence must be doubled.
</ul>
<h3 class="heading settled" data-level=2.2 id=error-handling><span class=secno>2.2. </span><span class=content>
Error Handling</span><a class=self-link href=#error-handling></a></h3>
<p><em>This section is not normative.</em></p>
<p>When errors occur in CSS,
the parser attempts to recover gracefully,
throwing away only the minimum amount of content
before returning to parsing as normal.
This is because errors aren’t always mistakes -
new syntax looks like an error to an old parser,
and it’s useful to be able to add new syntax to the language
without worrying about stylesheets that include it being completely broken in older UAs.</p>
<p>The precise error-recovery behavior is detailed in the parser itself,
but it’s simple enough that a short description is fairly accurate:</p>
<ul>
<li>
At the "top level" of a stylesheet,
an <a class="production css" data-link-type=type href=#typedef-at-keyword-token title="<at-keyword-token>"><at-keyword-token></a> starts an at-rule.
Anything else starts a qualified rule,
and is included in the rule’s prelude.
This may produce an invalid selector,
but that’s not the concern of the CSS parser —
at worst, it means the selector will match nothing.
<li>
Once an at-rule starts,
nothing is invalid from the parser’s standpoint;
it’s all part of the at-rule’s prelude.
Encountering a <a class="production css" data-link-type=type href=#typedef-semicolon-token title="<semicolon-token>"><semicolon-token></a> ends the at-rule immediately,
while encountering an opening curly-brace <a href=#tokendef-open-curly><{-token></a> starts the at-rule’s body.
The at-rule seeks forward, matching blocks (content surrounded by (), {}, or [])
until it finds a closing curly-brace <a href=#tokendef-close-curly><}-token></a> that isn’t matched by anything else
or inside of another block.
The contents of the at-rule are then interpreted according to the at-rule’s own grammar.
<li>
Qualified rules work similarly,
except that semicolons don’t end them;
instead, they are just taken in as part of the rule’s prelude.
When the first {} block is found,
the contents are always interpreted as a list of declarations.
<li>
When interpreting a list of declarations,
unknown syntax at any point causes the parser to throw away whatever declaration it’s currently building,
and seek forward until it finds a semicolon (or the end of the block).
It then starts fresh, trying to parse a declaration again.
<li>
If the stylesheet ends while any rule, declaration, function, string, etc. are still open,
everything is automatically closed.
This doesn’t make them invalid,
though they may be incomplete
and thus thrown away when they are verified against their grammar.
</ul>
<h2 class="heading settled" data-level=3 id=tokenizing-and-parsing><span class=secno>3. </span><span class=content>
Tokenizing and Parsing CSS</span><a class=self-link href=#tokenizing-and-parsing></a></h2>
<p>User agents must use the parsing rules described in this specification
to generate the CSSOM trees from text/css resources.
Together, these rules define what is referred to as the CSS parser.</p>
<p>This specification defines the parsing rules for CSS documents,
whether they are syntactically correct or not.
Certain points in the parsing algorithm are said to be a <dfn data-dfn-type=dfn data-noexport="" id=parse-error title="parse error">parse errors<a class=self-link href=#parse-error></a></dfn>.
The error handling for parse errors is well-defined:
user agents must either act as described below when encountering such problems,
or must abort processing at the first error that they encounter for which they do not wish to apply the rules described below.</p>
<p>Conformance checkers must report at least one parse error condition to the user
if one or more parse error conditions exist in the document
and must not report parse error conditions
if none exist in the document.
Conformance checkers may report more than one parse error condition if more than one parse error condition exists in the document.
Conformance checkers are not required to recover from parse errors,
but if they do,
they must recover in the same way as user agents.</p>
<h3 class="heading settled" data-level=3.1 id=parsing-overview><span class=secno>3.1. </span><span class=content>
Overview of the Parsing Model</span><a class=self-link href=#parsing-overview></a></h3>
<p>The input to the CSS parsing process consists of a stream of Unicode <a data-link-type=dfn href=#code-point title="code points">code points</a>,
which is passed through a tokenization stage followed by a tree construction stage.
The output is a CSSStyleSheet object.</p>
<p class=note>Note: Implementations that do not support scripting do not have to actually create a CSSOM CSSStyleSheet object,
but the CSSOM tree in such cases is still used as the model for the rest of the specification.</p>
<h3 class="heading settled" data-level=3.2 id=input-byte-stream><span class=secno>3.2. </span><span class=content>
The input byte stream</span><a class=self-link href=#input-byte-stream></a></h3>
<p>When parsing a stylesheet,
the stream of Unicode <a data-link-type=dfn href=#code-point title="code points">code points</a> that comprises the input to the tokenization stage
might be initially seen by the user agent as a stream of bytes
(typically coming over the network or from the local file system).
If so, the user agent must decode these bytes into <a data-link-type=dfn href=#code-point title="code points">code points</a> according to a particular character encoding.</p>
<p>To decode the stream of bytes into a stream of <a data-link-type=dfn href=#code-point title="code points">code points</a>,
UAs must use the <dfn data-dfn-type=dfn data-noexport="" id=decode><a href=http://encoding.spec.whatwg.org/#decode>decode</a><a class=self-link href=#decode></a></dfn> algorithm
defined in <a data-biblio-type=normative data-link-type=biblio href=#biblio-encoding title=ENCODING>[ENCODING]</a>,
with the fallback encoding determined as follows.</p>
<p class=note>Note: The <a data-link-type=dfn href=#decode title=decode>decode</a> algorithm
gives precedence to a byte order mark (BOM),
and only uses the fallback when none is found.</p>
<p>To <dfn data-dfn-type=dfn data-noexport="" id=determine-the-fallback-encoding>determine the fallback encoding<a class=self-link href=#determine-the-fallback-encoding></a></dfn>:</p>
<ol>
<li>
If HTTP or equivalent protocol defines an encoding (e.g. via the charset parameter of the Content-Type header),
<dfn data-dfn-type=dfn data-export="" id=get-an-encoding><a href=http://encoding.spec.whatwg.org/#concept-encoding-get>get an encoding</a><a class=self-link href=#get-an-encoding></a></dfn> <a data-biblio-type=normative data-link-type=biblio href=#biblio-encoding title=ENCODING>[ENCODING]</a>
for the specified value.
If that does not return failure,
use the return value as the fallback encoding.
<li>
Otherwise, check the byte stream.
If the first 1024 bytes of the stream begin with the hex sequence
<pre>40 63 68 61 72 73 65 74 20 22 XX* 22 3B</pre>
<p>where each <code>XX</code> byte is a value between 0<sub>16</sub> and 21<sub>16</sub> inclusive
or a value between 23<sub>16</sub> and 7F<sub>16</sub> inclusive,
then <a data-link-type=dfn href=#get-an-encoding title="get an encoding">get an encoding</a>
for the sequence of <code>XX</code> bytes,
interpreted as <code>ASCII</code>.</p>
<details class=why>
<summary>What does that byte sequence mean?</summary>
<p>The byte sequence above,
when decoded as ASCII,
is the string "<code>@charset "…";</code>",
where the "…" is the sequence of bytes corresponding to the encoding’s label.</p>
</details>
<p>If the return value was <code>utf-16be</code> or <code>utf-16le</code>,
use <code>utf-8</code> as the fallback encoding;
if it was anything else except failure,
use the return value as the fallback encoding.</p>
<details class=why>
<summary>Why use utf-8 when the declaration says utf-16?</summary>
<p>The bytes of the encoding declaration spell out “<code>@charset "…";</code>” in ASCII,
but UTF-16 is not ASCII-compatible.
Either you’ve typed in complete gibberish (like <code>䁣桡牳整•utf-16be∻</code>) to get the right bytes in the document,
which we don’t want to encourage,
or your document is actually in an ASCII-compatible encoding
and your encoding declaration is lying.</p>
<p>Either way, defaulting to UTF-8 is a decent answer.</p>
<p>As well, this mimics the behavior of HTML’s <code><meta charset></code> attribute.</p>
</details>
<p class=note>Note: Note that the syntax of an encoding declaration <em>looks like</em> the syntax of an <a class=css data-link-type=at-rule href=#at-ruledef-charset title=@charset>@charset</a> rule,
but it’s actually much more restrictive.
A number of things you can do in CSS that would produce a valid <a class=css data-link-type=at-rule href=#at-ruledef-charset title=@charset>@charset</a> rule,
such as using multiple spaces, comments, or single quotes,
will cause the encoding declaration to not be recognized.
This behavior keeps the encoding declaration as simple as possible,
and thus maximizes the likelihood of it being implemented correctly.</p>
<li>
Otherwise, if an <a data-link-type=dfn href=#environment-encoding title="environment encoding">environment encoding</a> is provided by the referring document,
use that as the fallback encoding.
<li>
Otherwise, use <code>utf-8</code> as the fallback encoding.
</ol>
<div class=note>
<p>Though UTF-8 is the default encoding for the web,
and many newer web-based file formats assume or require UTF-8 encoding,
CSS was created before it was clear which encoding would win,
and thus can’t automatically assume the stylesheet is UTF-8.</p>
<p>Stylesheet authors <em>should</em> author their stylesheets in UTF-8,
and ensure that either an HTTP header (or equivalent method) declares the encoding of the stylesheet to be UTF-8,
or that the referring document declares its encoding to be UTF-8.
(In HTML, this is done by adding a <code><meta charset=utf-8></code> element to the head of the document.)</p>
<p>If neither of these options are available,
authors should begin the stylesheet with a UTF-8 BOM
or the exact characters</p>
<pre>@charset "utf-8";</pre>
</div>
<p>Document languages that refer to CSS stylesheets that are decoded from bytes
may define an <dfn data-dfn-type=dfn data-export="" id=environment-encoding>environment encoding<a class=self-link href=#environment-encoding></a></dfn> for each such stylesheet,
which is used as a fallback when other encoding hints are not available or can not be used.</p>
<p>The concept of <a data-link-type=dfn href=#environment-encoding title="environment encoding">environment encoding</a> only exists for compatibility with legacy content.
New formats and new linking mechanisms <b>should not</b> provide an <a data-link-type=dfn href=#environment-encoding title="environment encoding">environment encoding</a>,
so the stylesheet defaults to UTF-8 instead in the absence of more explicit information.</p>
<p class=note>Note: <a data-biblio-type=informative data-link-type=biblio href=#biblio-html title=HTML>[HTML]</a> defines <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-stylesheet>the environment encoding for <code><link rel=stylesheet></code></a>.</p>
<p class=note>Note: <a data-biblio-type=informative data-link-type=biblio href=#biblio-cssom title=CSSOM>[CSSOM]</a> defines <a href=http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction>the environment encoding for <code><xml-stylesheet?></code></a>.</p>
<p class=note>Note: <a data-biblio-type=informative data-link-type=biblio href=#biblio-css3cascade title=CSS3CASCADE>[CSS3CASCADE]</a> defines <a href=http://dev.w3.org/csswg/css-cascade/#at-ruledef-import>the environment encoding for <code>@import</code></a>.</p>
<h3 class="heading settled" data-level=3.3 id=input-preprocessing><span class=secno>3.3. </span><span class=content>
Preprocessing the input stream</span><a class=self-link href=#input-preprocessing></a></h3>
<p>The input stream consists of the <a data-link-type=dfn href=#code-point title="code points">code points</a>
pushed into it as the input byte stream is decoded.</p>
<p>Before sending the input stream to the tokenizer,
implementations must make the following <a data-link-type=dfn href=#code-point title="code point">code point</a> substitutions:</p>
<ul>
<li>
Replace any U+000D CARRIAGE RETURN (CR) <a data-link-type=dfn href=#code-point title="code points">code points</a>,
U+000C FORM FEED (FF) <a data-link-type=dfn href=#code-point title="code points">code points</a>,
or pairs of U+000D CARRIAGE RETURN (CR) followed by U+000A LINE FEED (LF),
by a single U+000A LINE FEED (LF) <a data-link-type=dfn href=#code-point title="code point">code point</a>.
<li>
Replace any U+0000 NULL <a data-link-type=dfn href=#code-point title="code point">code point</a> with U+FFFD REPLACEMENT CHARACTER (�).
</ul>
<h2 class="heading settled" data-level=4 id=tokenization><span class=secno>4. </span><span class=content>
Tokenization</span><a class=self-link href=#tokenization></a></h2>
<p>Implementations must act as if they used the following algorithms to tokenize CSS.
To transform a stream of <a data-link-type=dfn href=#code-point title="code points">code points</a> into a stream of tokens,
repeatedly <a data-link-type=dfn href=#consume-a-token0 title="consume a token">consume a token</a>
until an <a class="production css" data-link-type=type href=#typedef-eof-token title="<EOF-token>"><EOF-token></a> is reached,
collecting the returned tokens into a stream.
Each call to the <a data-link-type=dfn href=#consume-a-token0 title="consume a token">consume a token</a> algorithm
returns a single token,
so it can also be used "on-demand" to tokenize a stream of <a data-link-type=dfn href=#code-point title="code points">code points</a> <em>during</em> parsing,
if so desired.</p>
<p>The output of the tokenization step is a stream of zero or more of the following tokens:
<dfn class=css data-dfn-type=type data-export="" id=typedef-ident-token><ident-token><a class=self-link href=#typedef-ident-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-function-token><function-token><a class=self-link href=#typedef-function-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-at-keyword-token><at-keyword-token><a class=self-link href=#typedef-at-keyword-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-hash-token><hash-token><a class=self-link href=#typedef-hash-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-string-token><string-token><a class=self-link href=#typedef-string-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-bad-string-token><bad-string-token><a class=self-link href=#typedef-bad-string-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-url-token><url-token><a class=self-link href=#typedef-url-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-bad-url-token><bad-url-token><a class=self-link href=#typedef-bad-url-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-delim-token><delim-token><a class=self-link href=#typedef-delim-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-number-token><number-token><a class=self-link href=#typedef-number-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-percentage-token><percentage-token><a class=self-link href=#typedef-percentage-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-dimension-token><dimension-token><a class=self-link href=#typedef-dimension-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-unicode-range-token><unicode-range-token><a class=self-link href=#typedef-unicode-range-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-include-match-token><include-match-token><a class=self-link href=#typedef-include-match-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-dash-match-token><dash-match-token><a class=self-link href=#typedef-dash-match-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-prefix-match-token><prefix-match-token><a class=self-link href=#typedef-prefix-match-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-suffix-match-token><suffix-match-token><a class=self-link href=#typedef-suffix-match-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-substring-match-token><substring-match-token><a class=self-link href=#typedef-substring-match-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-column-token><column-token><a class=self-link href=#typedef-column-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-whitespace-token><whitespace-token><a class=self-link href=#typedef-whitespace-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-cdo-token><CDO-token><a class=self-link href=#typedef-cdo-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-cdc-token><CDC-token><a class=self-link href=#typedef-cdc-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-colon-token><colon-token><a class=self-link href=#typedef-colon-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-semicolon-token><semicolon-token><a class=self-link href=#typedef-semicolon-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=typedef-comma-token><comma-token><a class=self-link href=#typedef-comma-token></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=tokendef-open-square><[-token><a class=self-link href=#tokendef-open-square></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=tokendef-close-square><]-token><a class=self-link href=#tokendef-close-square></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=tokendef-open-paren><(-token><a class=self-link href=#tokendef-open-paren></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=tokendef-close-paren><)-token><a class=self-link href=#tokendef-close-paren></a></dfn>,
<dfn class=css data-dfn-type=type data-export="" id=tokendef-open-curly><{-token><a class=self-link href=#tokendef-open-curly></a></dfn>,
and <dfn class=css data-dfn-type=type data-export="" id=tokendef-close-curly><}-token><a class=self-link href=#tokendef-close-curly></a></dfn>.</p>
<ul>
<li>
<a class="production css" data-link-type=type href=#typedef-ident-token title="<ident-token>"><ident-token></a>, <a class="production css" data-link-type=type href=#typedef-function-token title="<function-token>"><function-token></a>, <a class="production css" data-link-type=type href=#typedef-at-keyword-token title="<at-keyword-token>"><at-keyword-token></a>, <a class="production css" data-link-type=type href=#typedef-hash-token title="<hash-token>"><hash-token></a>, <a class="production css" data-link-type=type href=#typedef-string-token title="<string-token>"><string-token></a>, and <a class="production css" data-link-type=type href=#typedef-url-token title="<url-token>"><url-token></a> have a value composed of zero or more <a data-link-type=dfn href=#code-point title="code points">code points</a>.
Additionally, hash tokens have a type flag set to either "id" or "unrestricted". The type flag defaults to "unrestricted" if not otherwise set.
<li>
<a class="production css" data-link-type=type href=#typedef-delim-token title="<delim-token>"><delim-token></a> has a value composed of a single <a data-link-type=dfn href=#code-point title="code point">code point</a>.
<li>
<a class="production css" data-link-type=type href=#typedef-number-token title="<number-token>"><number-token></a>, <a class="production css" data-link-type=type href=#typedef-percentage-token title="<percentage-token>"><percentage-token></a>, and <a class="production css" data-link-type=type href=#typedef-dimension-token title="<dimension-token>"><dimension-token></a> have a representation composed of one or more <a data-link-type=dfn href=#code-point title="code points">code points</a>, and a numeric value.
<a class="production css" data-link-type=type href=#typedef-number-token title="<number-token>"><number-token></a> and <a class="production css" data-link-type=type href=#typedef-dimension-token title="<dimension-token>"><dimension-token></a> additionally have a type flag set to either "integer" or "number". The type flag defaults to "integer" if not otherwise set.
<a class="production css" data-link-type=type href=#typedef-dimension-token title="<dimension-token>"><dimension-token></a> additionally have a unit composed of one or more <a data-link-type=dfn href=#code-point title="code points">code points</a>.
<li>
<a class="production css" data-link-type=type href=#typedef-unicode-range-token title="<unicode-range-token>"><unicode-range-token></a> has
a <dfn data-dfn-type=dfn data-noexport="" id=unicode-range-start title="start of the range">start<a class=self-link href=#unicode-range-start></a></dfn>
and an <dfn data-dfn-type=dfn data-noexport="" id=unicode-range-end title="end of the range">end<a class=self-link href=#unicode-range-end></a></dfn>,
a pair of integers.
</ul>
<p class=note>Note: The type flag of hash tokens is used in the Selectors syntax <a data-biblio-type=informative data-link-type=biblio href=#biblio-select title=SELECT>[SELECT]</a>.
Only hash tokens with the "id" type are valid <a href=http://www.w3.org/TR/selectors/#id-selectors>ID selectors</a>.</p>
<p class=note>Note: As a technical note,
the tokenizer defined here requires only three <a data-link-type=dfn href=#code-point title="code points">code points</a> of look-ahead.
The tokens it produces are designed to allow Selectors to be parsed with one token of look-ahead,
and additional tokens may be added in the future to maintain this invariant.</p>
<h3 class="heading settled" data-level=4.1 id=token-diagrams><span class=secno>4.1. </span><span class=content>
Token Railroad Diagrams</span><a class=self-link href=#token-diagrams></a></h3>
<p><em>This section is non-normative.</em></p>
<p>This section presents an informative view of the tokenizer,
in the form of railroad diagrams.
Railroad diagrams are more compact than an explicit parser,
but often easier to read than an regular expression.</p>
<p>These diagrams are <em>informative</em> and <em>incomplete</em>;
they describe the grammar of "correct" tokens,
but do not describe error-handling at all.
They are provided solely to make it easier to get an intuitive grasp of the syntax of each token.</p>
<p>Diagrams with names such as <em><foo-token></em> represent tokens.
The rest are productions referred to by other diagrams.</p>
<dl>
<dt id=comment-diagram><a class=self-link href=#comment-diagram></a>comment
<dd>
<div class=railroad><svg class=railroad-diagram height=81 viewBox="0 0 497 81" width=497>
<g transform="translate(.5 .5)">
<path d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><path d="M40 41h10">
</path><g>
<path d="M50 41h0.0">
</path><path d="M86.0 41h0.0">
</path><rect height=22 rx=10 ry=10 width=36 x=50.0 y=30>
</rect><text x=68.0 y=45>
/*</text></g><path d="M86 41h10">
</path><g>
<path d="M96 41h0.0">
</path><path d="M400.0 41h0.0">
</path><path d="M96.0 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10">
</path><g>
<path d="M116.0 21h264">
</path></g><path d="M380.0 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10">
</path><path d="M96.0 41h20">
</path><g>
<path d="M116.0 41h0.0">
</path><path d="M380.0 41h0.0">
</path><path d="M116.0 41h10">
</path><g>
<path d="M126.0 41h0.0">
</path><path d="M370.0 41h0.0">
</path><rect height=22 width=244 x=126.0 y=30>
</rect><text x=248.0 y=45>
anything but * followed by /</text></g><path d="M370.0 41h10">
</path><path d="M126.0 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10">
</path><g>
<path d="M126.0 61h244">
</path></g><path d="M370.0 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10">
</path></g><path d="M380.0 41h20">
</path></g><path d="M400 41h10">
</path><g>
<path d="M410 41h0.0">
</path><path d="M446.0 41h0.0">
</path><rect height=22 rx=10 ry=10 width=36 x=410.0 y=30>
</rect><text x=428.0 y=45>
*/</text></g><path d="M446 41h10">
</path><path d="M 456 41 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=newline-diagram><a class=self-link href=#newline-diagram></a>newline
<dd>
<div class=railroad><svg class=railroad-diagram height=152 viewBox="0 0 173 152" width=173>
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><g>
<path d="M40 31h0.0">
</path><path d="M132.0 31h0.0">
</path><path d="M40.0 31h20">
</path><g>
<path d="M60.0 31h8.0">
</path><path d="M104.0 31h8.0">
</path><rect height=22 rx=10 ry=10 width=36 x=68.0 y=20>
</rect><text x=86.0 y=35>
\n</text></g><path d="M112.0 31h20">
</path><path d="M40.0 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10">
</path><g>
<path d="M60.0 61h0.0">
</path><path d="M112.0 61h0.0">
</path><rect height=22 rx=10 ry=10 width=52 x=60.0 y=50>
</rect><text x=86.0 y=65>
\r\n</text></g><path d="M112.0 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10">
</path><path d="M40.0 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10">
</path><g>
<path d="M60.0 91h8.0">
</path><path d="M104.0 91h8.0">
</path><rect height=22 rx=10 ry=10 width=36 x=68.0 y=80>
</rect><text x=86.0 y=95>
\r</text></g><path d="M112.0 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10">
</path><path d="M40.0 31a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10">
</path><g>
<path d="M60.0 121h8.0">
</path><path d="M104.0 121h8.0">
</path><rect height=22 rx=10 ry=10 width=36 x=68.0 y=110>
</rect><text x=86.0 y=125>
\f</text></g><path d="M112.0 121a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10">
</path></g><path d="M 132 31 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=whitespace-diagram><a class=self-link href=#whitespace-diagram></a>whitespace
<dd>
<div class=railroad><svg class=railroad-diagram height=122 viewBox="0 0 197 122" width=197>
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><g>
<path d="M40 31h0.0">
</path><path d="M156.0 31h0.0">
</path><path d="M40.0 31h20">
</path><g>
<path d="M60.0 31h8.0">
</path><path d="M128.0 31h8.0">
</path><rect height=22 rx=10 ry=10 width=60 x=68.0 y=20>
</rect><text x=98.0 y=35>
space</text></g><path d="M136.0 31h20">
</path><path d="M40.0 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10">
</path><g>
<path d="M60.0 61h20.0">
</path><path d="M116.0 61h20.0">
</path><rect height=22 rx=10 ry=10 width=36 x=80.0 y=50>
</rect><text x=98.0 y=65>
\t</text></g><path d="M136.0 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10">
</path><path d="M40.0 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10">
</path><g>
<path d="M60.0 91h0.0">
</path><path d="M136.0 91h0.0">
</path><rect height=22 width=76 x=60.0 y=80>
</rect><text x=98.0 y=95>
newline</text></g><path d="M136.0 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10">
</path></g><path d="M 156 31 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=hex-digit-diagram><a class=self-link href=#hex-digit-diagram></a>hex digit
<dd>
<div class=railroad><svg class=railroad-diagram height=62 viewBox="0 0 233 62" width=233>
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><path d="M40 31h10">
</path><g>
<path d="M50 31h0.0">
</path><path d="M182.0 31h0.0">
</path><rect height=22 width=132 x=50.0 y=20>
</rect><text x=116.0 y=35>
0-9 a-f or A-F</text></g><path d="M182 31h10">
</path><path d="M 192 31 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=escape-diagram><a class=self-link href=#escape-diagram></a>escape
<dd>
<div class=railroad><svg class=railroad-diagram height=122 viewBox="0 0 441 122" width=441>
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><path d="M40 31h10">
</path><g>
<path d="M50 31h0.0">
</path><path d="M78.0 31h0.0">
</path><rect height=22 rx=10 ry=10 width=28 x=50.0 y=20>
</rect><text x=64.0 y=35>
\</text></g><path d="M78 31h10">
</path><g>
<path d="M88 31h0.0">
</path><path d="M400.0 31h0.0">
</path><path d="M88.0 31h20">
</path><g>
<path d="M108.0 31h30.0">
</path><path d="M350.0 31h30.0">
</path><rect height=22 width=212 x=138.0 y=20>
</rect><text x=244.0 y=35>
not newline or hex digit</text></g><path d="M380.0 31h20">
</path><path d="M88.0 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10">
</path><g>
<path d="M108.0 61h0.0">
</path><path d="M380.0 61h0.0">
</path><path d="M108.0 61h10">
</path><g>
<path d="M118.0 61h0.0">
</path><path d="M230.0 61h0.0">
</path><path d="M118.0 61h10">
</path><g>
<path d="M128.0 61h0.0">
</path><path d="M220.0 61h0.0">
</path><rect height=22 width=92 x=128.0 y=50>
</rect><text x=174.0 y=65>
hex digit</text></g><path d="M220.0 61h10">
</path><path d="M128.0 61a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10">
</path><g>
<path d="M128.0 91h9.5">
</path><path d="M210.5 91h9.5">
</path><text class=comment x=174.0 y=96>
1-6 times</text></g><path d="M220.0 91a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10">
</path></g><path d="M230.0 61h10">
</path><g>
<path d="M240.0 61h0.0">
</path><path d="M380.0 61h0.0">
</path><path d="M240.0 61h20">
</path><g>
<path d="M260.0 61h100">
</path></g><path d="M360.0 61h20">
</path><path d="M240.0 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10">
</path><g>
<path d="M260.0 81h0.0">
</path><path d="M360.0 81h0.0">
</path><rect height=22 width=100 x=260.0 y=70>
</rect><text x=310.0 y=85>
whitespace</text></g><path d="M360.0 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10">
</path></g></g><path d="M380.0 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10">
</path></g><path d="M 400 31 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=whitespace-token-diagram><a class=self-link href=#whitespace-token-diagram></a><a class="production css" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>"><whitespace-token></a>
<dd>
<div class=railroad><svg class=railroad-diagram height=71 viewBox="0 0 221 71" width=221>
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><path d="M40 31h10">
</path><g>
<path d="M50 31h0.0">
</path><path d="M170.0 31h0.0">
</path><path d="M50.0 31h10">
</path><g>
<path d="M60.0 31h0.0">
</path><path d="M160.0 31h0.0">
</path><rect height=22 width=100 x=60.0 y=20>
</rect><text x=110.0 y=35>
whitespace</text></g><path d="M160.0 31h10">
</path><path d="M60.0 31a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10">
</path><g>
<path d="M60.0 51h100">
</path></g><path d="M160.0 51a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10">
</path></g><path d="M170 31h10">
</path><path d="M 180 31 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=ws*-diagram><a class=self-link href=#ws%2A-diagram></a>ws*
<dd>
<div class=railroad><svg class=railroad-diagram height=81 viewBox="0 0 305 81" width=305>
<g transform="translate(.5 .5)">
<path d="M 20 31 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><g>
<path d="M40 41h0.0">
</path><path d="M264.0 41h0.0">
</path><path d="M40.0 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10">
</path><g>
<path d="M60.0 21h184">
</path></g><path d="M244.0 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10">
</path><path d="M40.0 41h20">
</path><g>
<path d="M60.0 41h0.0">
</path><path d="M244.0 41h0.0">
</path><path d="M60.0 41h10">
</path><g>
<path d="M70.0 41h0.0">
</path><path d="M234.0 41h0.0">
</path><rect height=22 width=164 x=70.0 y=30>
</rect><text x=152.0 y=45>
<whitespace-token></text></g><path d="M234.0 41h10">
</path><path d="M70.0 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10">
</path><g>
<path d="M70.0 61h164">
</path></g><path d="M234.0 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10">
</path></g><path d="M244.0 41h20">
</path></g><path d="M 264 41 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=ident-token-diagram><a class=self-link href=#ident-token-diagram></a><a class="production css" data-link-type=type href=#typedef-ident-token title="<ident-token>"><ident-token></a>
<dd>
<div class=railroad><svg class=railroad-diagram height=130 viewBox="0 0 769 130" width=769>
<g transform="translate(.5 .5)">
<path d="M 20 51 v 20 m 10 -20 v 20 m -10 -10 h 20.5">
</path><g>
<path d="M40 61h0.0">
</path><path d="M384.0 61h0.0">
</path><path d="M40.0 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10">
</path><g>
<path d="M60.0 31h134.0">
</path><path d="M230.0 31h134.0">
</path><rect height=22 rx=10 ry=10 width=36 x=194.0 y=20>
</rect><text x=212.0 y=35>
--</text></g><path d="M364.0 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10">
</path><path d="M40.0 61h20">
</path><g>
<path d="M60.0 61h0.0">
</path><path d="M364.0 61h0.0">
</path><g>
<path d="M60.0 61h0.0">
</path><path d="M128.0 61h0.0">
</path><path d="M60.0 61h20">
</path><g>
<path d="M80.0 61h28">
</path></g><path d="M108.0 61h20">
</path><path d="M60.0 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10">
</path><g>
<path d="M80.0 81h0.0">
</path><path d="M108.0 81h0.0">
</path><rect height=22 rx=10 ry=10 width=28 x=80.0 y=70>
</rect><text x=94.0 y=85>
-</text></g><path d="M108.0 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10">
</path></g><g>
<path d="M128.0 61h0.0">
</path><path d="M364.0 61h0.0">
</path><path d="M128.0 61h20">
</path><g>
<path d="M148.0 61h0.0">
</path><path d="M344.0 61h0.0">
</path><rect height=22 width=196 x=148.0 y=50>
</rect><text x=246.0 y=65>
a-z A-Z _ or non-ASCII</text></g><path d="M344.0 61h20">
</path><path d="M128.0 61a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10">
</path><g>
<path d="M148.0 91h64.0">
</path><path d="M280.0 91h64.0">
</path><rect height=22 width=68 x=212.0 y=80>
</rect><text x=246.0 y=95>
escape</text></g><path d="M344.0 91a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10">
</path></g></g><path d="M364.0 61h20">
</path></g><g>
<path d="M384 61h0.0">
</path><path d="M728.0 61h0.0">
</path><path d="M384.0 61a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10">
</path><g>
<path d="M404.0 41h304">
</path></g><path d="M708.0 41a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10">
</path><path d="M384.0 61h20">
</path><g>
<path d="M404.0 61h0.0">
</path><path d="M708.0 61h0.0">
</path><path d="M404.0 61h10">
</path><g>
<path d="M414.0 61h0.0">
</path><path d="M698.0 61h0.0">
</path><path d="M414.0 61h20">
</path><g>
<path d="M434.0 61h0.0">
</path><path d="M678.0 61h0.0">
</path><rect height=22 width=244 x=434.0 y=50>
</rect><text x=556.0 y=65>
a-z A-Z 0-9 _ - or non-ASCII</text></g><path d="M678.0 61h20">
</path><path d="M414.0 61a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10">
</path><g>
<path d="M434.0 91h88.0">
</path><path d="M590.0 91h88.0">
</path><rect height=22 width=68 x=522.0 y=80>
</rect><text x=556.0 y=95>
escape</text></g><path d="M678.0 91a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10">
</path></g><path d="M698.0 61h10">
</path><path d="M414.0 61a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10">
</path><g>
<path d="M414.0 110h284">
</path></g><path d="M698.0 110a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10">
</path></g><path d="M708.0 61h20">
</path></g><path d="M 728 61 h 20 m -10 -10 v 20 m 10 -20 v 20">
</path></g></svg></div>
<dt id=function-token-diagram><a class=self-link href=#function-token-diagram></a><a class="production css" data-link-type=type href=#typedef-function-token title="<function-token>"><function-token></a>
<dd>
<div class=railroad><svg class=railroad-diagram height=62 viewBox="0 0 273 62" width=273>
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5">