-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.html
More file actions
executable file
·4039 lines (3101 loc) · 170 KB
/
Overview.html
File metadata and controls
executable file
·4039 lines (3101 loc) · 170 KB
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 (CSS3 Syntax)</title>
<!--
<link href="http://purl.org/dc/terms/" rel="schema.dcterms">
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="dcterms.rights">
-->
<meta content="CSS Syntax Module Level 3 (CSS3 Syntax)" name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2012-10-16 name=dcterms.issued>
<meta content="http://dev.w3.org/csswg/css3-syntax/" name=dcterms.creator>
<meta content=W3C name=dcterms.publisher>
<meta content="http://www.w3.org/TR/2012/ED-css3-syntax-20121016/"
name=dcterms.identifier>
<link href="#contents" rel=contents>
<link href="#index" rel=index>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<style type="text/css">
/* delete this block when you've cleared out all the .replaceme elements */
.replaceme {
border: solid red;
padding: 0 0.5em;
margin: 0 0.1em;
background: yellow;
color: green;
}
.replaceme:before {
content: "FIXME(";
color: black;
}
.replaceme:after {
content: ")";
color: black;
}
</style>
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Syntax Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 16 October
2012</h2>
<dl>
<dt>This version:
<dd> <a
href="http://dev.w3.org/csswg/css3-syntax/">http://dev.w3.org/csswg/css3-syntax/</a>
<!--
<dt>Latest version:
<dd>
<a href="http://www.w3.org/TR/css3-syntax/">http://www.w3.org/TR/css3-syntax/</a>
-->
<dt>Editor's draft:
<dd> <a
href="http://dev.w3.org/csswg/css3-syntax/">http://dev.w3.org/csswg/css3-syntax/</a>
<dt>Previous version:
<dd> <a
href="http://www.w3.org/TR/2003/WD-css3-syntax-20030813/">http://www.w3.org/TR/2003/WD-css3-syntax-20030813/</a>
<dt>Issue Tracking:
<dd> <a
href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Syntax">W3C
Bugzilla</a>
<dt>Feedback:
<dd> <a
href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
with subject line “<kbd>[css3-syntax] <var>… message topic
…</var></kbd>”
<dt>Editors:
<dd class="h-card vcard"> <a class="p-name fn u-url url"
href="http://www.xanthir.com/" rel=author>Tab Atkins Jr.</a> (<span
class="p-org org">Google, Inc.</span>), <span
class="u-email email">jackalmage@gmail.com</span>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2012 <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>), 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>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<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. 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.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-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=%5Bcss3-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
“css3-syntax” in the subject, preferably like this:
“[<!---->css3-syntax<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/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="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<p>The following features are at risk: …
<h2 class="no-num no-toc" id=contents> Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1. </span> Introduction</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span> Module
interactions</a>
</ul>
<li><a href="#syntax-description"><span class=secno>2. </span> Description
of CSS's Syntax</a>
<li><a href="#tokenizing-and-parsing-css"><span class=secno>3. </span>
Tokenizing and Parsing CSS</a>
<ul class=toc>
<li><a href="#overview-of-the-parsing-model"><span class=secno>3.1.
</span> Overview of the Parsing Model</a>
<li><a href="#the-input-byte-stream"><span
107F3
class=secno>3.2. </span> The
input byte stream</a>
<ul class=toc>
<li><a href="#determining-the-character-encoding"><span
class=secno>3.2.1. </span> Determining the character encoding</a>
<li><a href="#preprocessing-the-input-stream"><span class=secno>3.2.2.
</span> Preprocessing the input stream</a>
</ul>
<li><a href="#parse-state"><span class=secno>3.3. </span> Parse
State</a>
<li><a href="#tokenization"><span class=secno>3.4. </span>
Tokenization</a>
<ul class=toc>
<li><a href="#token-diagrams"><span class=secno>3.4.1. </span> Token
Railroad Diagrams</a>
<li><a href="#tokenizer-flags"><span class=secno>3.4.2. </span>
Tokenizer Flags</a>
<li><a href="#definitions"><span class=secno>3.4.3. </span>
Definitions</a>
<li><a href="#data-state"><span class=secno>3.4.4. </span> Data
state</a>
<li><a href="#double-quote-string-state"><span class=secno>3.4.5.
</span> Double-quote-string state</a>
<li><a href="#single-quote-string-state"><span class=secno>3.4.6.
</span> Single-quote-string state</a>
<li><a href="#hash-state"><span class=secno>3.4.7. </span> Hash
state</a>
<li><a href="#hash-rest-state"><span class=secno>3.4.8. </span>
Hash-rest state</a>
<li><a href="#comment-state"><span class=secno>3.4.9. </span> Comment
state</a>
<li><a href="#at-keyword-state"><span class=secno>3.4.10. </span>
At-keyword state</a>
<li><a href="#at-keyword-rest-state"><span class=secno>3.4.11. </span>
At-keyword-rest state</a>
<li><a href="#ident-state"><span class=secno>3.4.12. </span> Ident
state</a>
<li><a href="#ident-rest-state"><span class=secno>3.4.13. </span>
Ident-rest state</a>
<li><a href="#transform-function-whitespace-state"><span
class=secno>3.4.14. </span> Transform-function-whitespace state</a>
<li><a href="#number-state"><span class=secno>3.4.15. </span> Number
state</a>
<li><a href="#number-rest-state"><span class=secno>3.4.16. </span>
Number-rest state</a>
<li><a href="#number-fraction-state"><span class=secno>3.4.17. </span>
Number-fraction state</a>
<li><a href="#dimension-state"><span class=secno>3.4.18. </span>
Dimension state</a>
<li><a href="#sci-notation-state"><span class=secno>3.4.19. </span>
Sci-notation state</a>
<li><a href="#url-state"><span class=secno>3.4.20. </span> URL
state</a>
<li><a href="#url-double-quote-state"><span class=secno>3.4.21.
</span> URL-double-quote state</a>
<li><a href="#url-single-quote-state"><span class=secno>3.4.22.
</span> URL-single-quote state</a>
<li><a href="#url-end-state"><span class=secno>3.4.23. </span> URL-end
state</a>
<li><a href="#url-unquoted-state"><span class=secno>3.4.24. </span>
URL-unquoted state</a>
<li><a href="#bad-url-state"><span class=secno>3.4.25. </span> Bad-URL
state</a>
<li><a href="#unicode-range-state"><span class=secno>3.4.26. </span>
Unicode-range state</a>
<li><a href="#consume-an-escaped-character"><span class=secno>3.4.27.
</span> Consume an escaped character</a>
<li><a href="#set-the-unicode-range-tokens-range"><span
class=secno>3.4.28. </span> Set the unicode-range token's range</a>
</ul>
<li><a href="#changes-from-css-2.1-tokenizer"><span class=secno>3.5.
</span> Changes from CSS 2.1 Tokenizer</a>
<li><a href="#tree-construction"><span class=secno>3.6. </span> Tree
Construction</a>
<ul class=toc>
<li><a href="#definitions0"><span class=secno>3.6.1. </span>
Definitions</a>
<li><a href="#top-level-mode"><span class=secno>3.6.2. </span>
Top-level mode</a>
<li><a href="#at-rule-prelude-mode"><span class=secno>3.6.3. </span>
At-rule-prelude mode</a>
<li><a href="#rule-block-mode"><span class=secno>3.6.4. </span>
Rule-block mode</a>
<li><a href="#selector-mode"><span class=secno>3.6.5. </span> Selector
mode</a>
<li><a href="#declaration-block-mode"><span class=secno>3.6.6. </span>
Declaration-block mode</a>
<li><a href="#after-declaration-name-mode"><span class=secno>3.6.7.
</span> After-declaration-name mode</a>
<li><a href="#declaration-value-mode"><span class=secno>3.6.8. </span>
Declaration-value mode</a>
<li><a href="#declaration-important-mode"><span class=secno>3.6.9.
</span> Declaration-important mode</a>
<li><a href="#declaration-end-mode"><span class=secno>3.6.10. </span>
Declaration-end mode</a>
<li><a href="#next-block-error-mode"><span class=secno>3.6.11. </span>
Next-block error mode</a>
<li><a href="#next-declaration-error-mode"><span class=secno>3.6.12.
</span> Next-declaration error mode</a>
<li><a href="#next-block-or-statement-error-mode"><span
class=secno>3.6.13. </span> Next-block-or-statement error mode</a>
<li><a href="#consume-a-primitive"><span class=secno>3.6.14. </span>
Consume a primitive</a>
<li><a href="#consume-a-primitive-with-the-hashless-co"><span
class=secno>3.6.15. </span> Consume a primitive with the hashless
color quirk</a>
<li><a href="#consume-a-primitive-with-the-unitless-le"><span
class=secno>3.6.16. </span> Consume a primitive with the unitless
length quirk</a>
<li><a href="#consume-a-simple-block"><span class=secno>3.6.17.
</span> Consume a simple block</a>
<li><a href="#consume-a-function"><span class=secno>3.6.18. </span>
Consume a function</a>
<li><a href="#switch-to-the-current-rules-content-mode"><span
class=secno>3.6.19. </span> Switch to the current rule's content
mode</a>
<li><a href="#pop-the-current-rule"><span class=secno>3.6.20. </span>
Pop the current rule</a>
<li><a href="#discard-the-current-rule"><span class=secno>3.6.21.
</span> Discard the current rule</a>
<li><a href="#finish-parsing"><span class=secno>3.6.22. </span> Finish
parsing</a>
</ul>
<li><a href="#changes-from-css-2.1-core-grammar"><span class=secno>3.7.
</span> Changes from CSS 2.1 Core Grammar</a>
</ul>
<li><a href="#conformance"><span class=secno>4. </span> Conformance</a>
<ul class=toc>
<li><a href="#conventions"><span class=secno>4.1. </span> Document
conventions</a>
<li><a href="#conformance-classes"><span class=secno>4.2. </span>
Conformance classes</a>
</ul>
<li class=no-num><a href="#acknowledgments"> Acknowledgments</a>
<li class=no-num><a href="#references"> References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references"> Normative
references</a>
<li class=no-num><a href="#other-references"> Other references</a>
</ul>
<li class=no-num><a href="#index"> Index</a>
<li class=no-num><a href="#property-index"> Property index</a>
</ul>
<!--end-toc-->
<h2 id=intro><span class=secno>1. </span> Introduction</h2>
<p><em>This section is not normative.</em>
<p><var class=replaceme>Provide background, motivation, etc.</var>
<h3 id=placement><span class=secno>1.1. </span> Module interactions</h3>
<p> This module defines the syntax and parsing of CSS stylesheets. It
supersedes the lexical scanner and grammar defined in CSS 2.1.
<h2 id=syntax-description><span class=secno>2. </span> Description of CSS's
Syntax</h2>
<p><em>This section is not normative.</em>
<p> A CSS document is a series of <a href="#rule"><i>rules</i></a>, which
apply CSS properties to elements in the source document, and <a
href="#at-rules"><i>at-rules</i></a>, which define special processing
rules or values for the CSS document.
<p> A <dfn id=rule>rule</dfn> starts with a selector (defined by the <a
href="http://www.w3.org/TR/selectors/">Selectors specification</a>), then
has a {}-wrapped block containing a sequence of declarations. The selector
specifies which elements the declarations will apply to. Each declaration
has a property name, followed by a colon and the property value, and
finished with a semicolon.
<div class=example>
<p> A typical rule might look something like this:
<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> "<code>color: blue;</code>" is a declaration specifying that, for the
elements that match the selector, their ‘<code
class=property>color</code>’ property should have the value ‘<code
class=css>blue</code>’. Similiarly, their ‘<code
class=property>text-decoration</code>’ property should have the value
‘<code class=css>underline</code>’.
</div>
<p> <dfn id=at-rules title=at-rule>At-rules</dfn> are all different, but
they have a basic structure in common. They start with an "@" character
followed by their name. Some <a href="#at-rules"><i>at-rules</i></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 href="#rule"><i>rule</i></a>. Even the contents of
these blocks are specific to the given <a
href="#at-rules"><i>at-rule</i></a>: sometimes they contain a sequence of
declarations, like a <a href="#rule"><i>rule</i></a>; other times, they
may contain additional blocks, or at-rules, or other structures
altogether.
<div class=example>
<p> Here are several examples of <a href="#at-rules"><i>at-rules</i></a>
that illustrate the varied syntax they may contain.
<pre>@import "my-styles.css";</pre>
<p> The ‘<code class=css>@import</code>’ <a
href="#at-rules"><i>at-rule</i></a> is a simple statement. After its
name, it takes a single string or ‘<code class=css>url()</code>’
function to indicate the stylesheet that it should import.
<pre>
@page :left {
margin-left: 4cm;
margin-right: 3cm;
}</pre>
<p> The ‘<code class=css>@page</code>’ <a
href="#at-rules"><i>at-rule</i></a> consists of an optional page selector
(the ":left" pseudoclass), followed by a block of properties that apply
to the page when printed. In this way, it's very similar to a normal <a
href="#rule"><i>rule</i></a>, except that its properties don't apply to
any "element", but rather the page itself.
<pre>
@media print {
body { font-size: 10pt }
}</pre>
<p> The ‘<code class=css>@media</code>’ <a
href="#at-rules"><i>at-rule</i></a> begins with a media type and a list
of optional media queries. Its block contains entire rules, which are
only applied when the ‘<code class=css>@media</code>’s conditions are
fulfilled.
</div>
<p> Property names and <a href="#at-rules"><i>at-rule</i></a> names are
always <b>idents</b>, 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 character at all, even ones that CSS uses
in its syntax, by escaping it with a backslash (\) or by using a
hexadecimal escape.
<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 href="#at-rules"><i>at-rules</i></a> can
be found in the specs that define them.
<h2 id=tokenizing-and-parsing-css><span class=secno>3. </span> Tokenizing
and Parsing CSS</h2>
<p> User agents must use the parsing rules described in this section to
generate the CSSOM trees from text/css resources. Together, these rules
define what is referred to as the CSS parser.
<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 parse errors. 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> 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.
<h3 id=overview-of-the-parsing-model><span class=secno>3.1. </span>
Overview of the Parsing Model</h3>
<p> The input to the CSS parsing process consists of a stream of Unicode
code points, which is passed through a tokenization stage followed by a
tree construction stage. The output is a CSSStyleSheet object.
<p class=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.
<h3 id=the-input-byte-stream><span class=secno>3.2. </span> The input byte
stream</h3>
<p> The stream of Unicode code points that comprises the input to the
tokenization stage will be initially seen by the user agent as a stream of
bytes (typically coming over the network or from the local file system).
The bytes encode the actual characters according to a particular character
encoding, which the user agent must use to decode the bytes into
characters.
<p> The <i>encoding sniffing algorithm</i> defined below is used to
determine the character encoding.
<p> Given an encoding, the bytes in the input byte stream must be converted
to Unicode code points for the tokenizer's input stream, as described by
the rules for that encoding, except that the leading U+FEFF BYTE ORDER
MARK character, if any, must not be stripped by the encoding layer (it is
stripped by the rule below).
<p> Bytes or sequences of bytes in the original byte stream that could not
be converted to Unicode code points must be converted to U+FFFD
REPLACEMENT CHARACTERs. Specifically, if the encoding is UTF-8, the bytes
must be decoded with the error handling defined in this specification.
<p class=note> Bytes or sequences of bytes in the original byte stream that
did not conform to the encoding specification (e.g. invalid UTF-8 byte
sequences in a UTF-8 input byte stream) are errors that conformance
checkers are expected to report.
<h4 id=determining-the-character-encoding><span class=secno>3.2.1. </span>
Determining the character encoding</h4>
<div class=issue>
<p> General algorithm:
<ol>
<li> If the stylesheet is embedded, the charset is the charset of the
outer document.
<li> If the resource carried a Charset header, and the value of the
header is a valid charset, that's the charset of the stylesheet.
<li> If the document contains an @charset rule at the very top (specify
how to parse this in the presence of arbitrary charsets) and it
specifies a valid charset, that's the charset of the stylesheet.
<li> The charset is UTF-8.
</ol>
</div>
<h4 id=preprocessing-the-input-stream><span class=secno>3.2.2. </span>
Preprocessing the input stream</h4>
<p> The input stream consists of the characters pushed into it as the input
byte stream is decoded.
<p> One leading U+FEFF BYTE ORDER MARK character must be ignored if any are
present in the input stream.
<p class=note> The requirement to strip a U+FEFF BYTE ORDER MARK character
regardless of whether that character was used to determine the byte order
is a willful violation of Unicode, motivated by a desire to increase the
resilience of user agents in the face of naïve transcoders.
<p> U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF)
characters are treated specially. All CR characters must be converted to
LF characters, and any LF characters that immediately follow a CR
character must be ignored. Thus, newlines in CSS stylesheets are
represented by LF characters, and there are never any CR characters in the
input to the tokenization stage.
<p> The <dfn id=next-input-character>next input character</dfn> is the
first character in the input stream that has not yet been consumed or
explicitly ignored by the requirements in this section. Initially, the <a
href="#next-input-character"><i>next input character</i></a> is the first
character in the input. The <dfn id=current-input-character>current input
character</dfn> is the last character to have been consumed.
<p> The "EOF" character in the tables below is a conceptual character
representing the end of the input stream.
<h3 id=parse-state><span class=secno>3.3. </span> Parse State</h3>
<p> ...
<h3 id=tokenization><span class=secno>3.4. </span> Tokenization</h3>
<p> Implementations must act as if they used the following state machine to
tokenize CSS. The state machine must start in the <a
href="#data-state0"><i>data state</i></a>. Most states consume a single
character, which may have various side-effects, and either switches the
state machine to a new state to reconsume the same character, or switches
it to a new state to consume the next character, or stays in the same
state to consume the next character. Some states have more complicated
behavior and can consume several characters before switching to another
state.
<p> The output of the tokenization step is a series of zero or more of the
following tokens: ident, function, at-keyword, hash, string, bad-string,
url, bad-url, delim, number, percentage, dimension, unicode-range,
whitespace, comment, cdo, cdc, colon, semicolon, [, ], (, ), {, }.
<p> ident, function, at-keyword, hash, string, and url tokens have a value
composed of zero or more characters. Delim tokens have a value composed of
a single character. Number, percentage, and dimension tokens have a
representation composed of 1 or more character, a numeric value, and a
type flag set to either "integer" or "number". The type flag defaults to
"integer" if not otherwise set. Dimension tokens additionally have a unit
composed of one or more characters. Unicode-range tokens have a range of
characters.
<p> The tokenizer state machine consists of the states defined in the
following subsections.
<h4 id=token-diagrams><span class=secno>3.4.1. </span> Token Railroad
Diagrams</h4>
<p> <em>This section is non-normative.</em>
<p> This section presents an informative view of the token parser, in the
form of railroad diagrams. Railroad diagrams are more compact than a
state-machine, but often easier to read than a regular expression.
<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.
<dl>
<dt id=ident-diagram>IDENT
<dd> <!--<script>
Diagram(
Choice(0, Skip(), Terminal('-')),
Choice(0, NonTerminal('a-z A-Z _ or non-ASCII'), NonTerminal('escape')),
ZeroOrMore(
Choice(0, NonTerminal('a-z A-Z 0-9 _ - or non-ASCII'), NonTerminal('escape')))).addTo();
</script>-->
<svg class=diagram height=110 width=831>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><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 41h0h.5"></path><path d="M110 41h0h.5"></path><path
d="M40 41h20h.5"></path><g><path d="M60 41h30h.5"></path></g><path
d="M90 41h20h.5"></path><path
d="M40 41a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><g><path
d
8463
="M60 61h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=60
y=50></rect><text x=75 y=65>-</text></g><path
d="M90 61a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path></g><g><path
d="M110 41h0h.5"></path><path d="M390 41h0h.5"></path><path
d="M110 41h20h.5"></path><g><path d="M130 41h240h.5"></path><rect
height=22 width=240 x=130 y=30></rect><text x=250 y=45>a-z A-Z _ or
non-ASCII</text></g><path d="M370 41h20h.5"></path><path
d="M110 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M130 71h240h.5"></path><rect height=22 width=80 x=210
y=60></rect><text x=250 y=75>escape</text></g><path
d="M370 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><g><path
d="M390 41h0h.5"></path><path d="M790 41h0h.5"></path><path
d="M390 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M410 21h360h.5"></path></g><path
d="M770 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M390 41h20h.5"></path><g><path d="M410 41h0h.5"></path><path
d="M770 41h0h.5"></path><path d="M410 41h10h.5"></path><g><path
d="M420 41h0h.5"></path><path d="M760 41h0h.5"></path><path
d="M420 41h20h.5"></path><g><path d="M440 41h300h.5"></path><rect
height=22 width=300 x=440 y=30></rect><text x=590 y=45>a-z A-Z 0-9 _ - or
non-ASCII</text></g><path d="M740 41h20h.5"></path><path
d="M420 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M440 71h300h.5"></path><rect height=22 width=80 x=550
y=60></rect><text x=590 y=75>escape</text></g><path
d="M740 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><path
d="M760 41h10h.5"></path><path
d="M420 41a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10h.5"></path><g><path
d="M420 90h340h.5"></path></g><path
d="M760 90a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10h.5"></path></g><path
d="M770 41h20h.5"></path></g><path
d="M 790 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
<dt id=function-diagram>FUNCTION
<dd> <!--<script>
Diagram(NonTerminal('IDENT'), Terminal('(')).addTo();
</script>-->
<svg class=diagram height=62 width=221>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><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 31h10h.5"></path><g><path d="M50 31h70h.5"></path><rect height=22
width=70 x=50 y=20></rect><text x=85 y=35>IDENT</text></g><path
d="M120 31h10h.5"></path><path d="M130 31h10h.5"></path><g><path
d="M140 31h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=140
y=20></rect><text x=155 y=35>(</text></g><path
d="M170 31h10h.5"></path><path
d="M 180 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
<dt id=at-keyword-diagram>AT-KEYWORD
<dd> <!--<script>
Diagram(Terminal('@'), NonTerminal('IDENT')).addTo();
</script>-->
<svg class=diagram height=62 width=221>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><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 31h10h.5"></path><g><path d="M50 31h30h.5"></path><rect height=22
rx=10 ry=10 width=30 x=50 y=20></rect><text x=65 y=35>@</text></g><path
d="M80 31h10h.5"></path><path d="M90 31h10h.5"></path><g><path
d="M100 31h70h.5"></path><rect height=22 width=70 x=100 y=20></rect><text
x=135 y=35>IDENT</text></g><path d="M170 31h10h.5"></path><path
d="M 180 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
<dt id=hash-diagram>HASH
<dd> <!--<script>
Diagram(Terminal('#'), OneOrMore(NonTerminal('a-z A-Z 0-9 _ - or non-ASCII'))).addTo();
</script>-->
<svg class=diagram height=71 width=471>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><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 31h10h.5"></path><g><path d="M50 31h30h.5"></path><rect height=22
rx=10 ry=10 width=30 x=50 y=20></rect><text x=65 y=35>#</text></g><path
d="M80 31h10h.5"></path><path d="M90 31h10h.5"></path><g><path
d="M100 31h0h.5"></path><path d="M420 31h0h.5"></path><path
d="M100 31h10h.5"></path><g><path d="M110 31h300h.5"></path><rect
height=22 width=300 x=110 y=20></rect><text x=260 y=35>a-z A-Z 0-9 _ - or
non-ASCII</text></g><path d="M410 31h10h.5"></path><path
d="M110 31a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10h.5"></path><g><path
d="M110 51h300h.5"></path></g><path
d="M410 51a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10h.5"></path></g><path
d="M420 31h10h.5"></path><path
d="M 430 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
<dt id=string-diagram>STRING
<dd> <!--<script>
Diagram(
Choice(0,
Sequence(
Terminal('"'),
ZeroOrMore(
Choice(0,
NonTerminal('not " or \\'),
NonTerminal('escape'))),
Terminal('"')),
Sequence(
Terminal('\''),
ZeroOrMore(
Choice(0,
NonTerminal("not \' or \\"),
NonTerminal('escape'))),
Terminal('\'')))).addTo();
</script>-->
<svg class=diagram height=188 width=441>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><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 41h0h.5"></path><path d="M400 41h0h.5"></path><path
d=&quo
7B3D
t;M40 41h20h.5"></path><g><path d="M60 41h0h.5"></path><path
d="M60 41h10h.5"></path><g><path d="M70 41h30h.5"></path><rect height=22
rx=10 ry=10 width=30 x=70 y=30></rect><text x=85 y=45>"</text></g><path
d="M100 41h10h.5"></path><g><path d="M110 41h0h.5"></path><path
d="M330 41h0h.5"></path><path
d="M110 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M130 21h180h.5"></path></g><path
d="M310 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M110 41h20h.5"></path><g><path d="M130 41h0h.5"></path><path
d="M310 41h0h.5"></path><path d="M130 41h10h.5"></path><g><path
d="M140 41h0h.5"></path><path d="M300 41h0h.5"></path><path
d="M140 41h20h.5"></path><g><path d="M160 41h120h.5"></path><rect
height=22 width=120 x=160 y=30></rect><text x=220 y=45>not " or
\</text></g><path d="M280 41h20h.5"></path><path
d="M140 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M160 71h120h.5"></path><rect height=22 width=80 x=180
y=60></rect><text x=220 y=75>escape</text></g><path
d="M280 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><path
d="M300 41h10h.5"></path><path
d="M140 41a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10h.5"></path><g><path
d="M140 90h160h.5"></path></g><path
d="M300 90a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10h.5"></path></g><path
d="M310 41h20h.5"></path></g><path d="M330 41h10h.5"></path><g><path
d="M340 41h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=340
y=30></rect><text x=355 y=45>"</text></g><path
d="M370 41h10h.5"></path><path d="M380 41h0h.5"></path></g><path
d="M380 41h20h.5"></path><path
d="M40 41a10 10 0 0 1 10 10v58a10 10 0 0 0 10 10h.5"></path><g><path
d="M60 119h0h.5"></path><path d="M60 119h10h.5"></path><g><path
d="M70 119h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=70
y=108></rect><text x=85 y=123>'</text></g><path
d="M100 119h10h.5"></path><g><path d="M110 119h0h.5"></path><path
d="M330 119h0h.5"></path><path
d="M110 119a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M130 99h180h.5"></path></g><path
d="M310 99a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M110 119h20h.5"></path><g><path d="M130 119h0h.5"></path><path
d="M310 119h0h.5"></path><path d="M130 119h10h.5"></path><g><path
d="M140 119h0h.5"></path><path d="M300 119h0h.5"></path><path
d="M140 119h20h.5"></path><g><path d="M160 119h120h.5"></path><rect
height=22 width=120 x=160 y=108></rect><text x=220 y=123>not ' or
\</text></g><path d="M280 119h20h.5"></path><path
d="M140 119a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M160 149h120h.5"></path><rect height=22 width=80 x=180
y=138></rect><text x=220 y=153>escape</text></g><path
d="M280 149a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><path
d="M300 119h10h.5"></path><path
d="M140 119a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10h.5"></path><g><path
d="M140 168h160h.5"></path></g><path
d="M300 168a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10h.5"></path></g><path
d="M310 119h20h.5"></path></g><path d="M330 119h10h.5"></path><g><path
d="M340 119h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=340
y=108></rect><text x=355 y=123>'</text></g><path
d="M370 119h10h.5"></path><path d="M380 119h0h.5"></path></g><path
d="M380 119a10 10 0 0 0 10 -10v-58a10 10 0 0 1 10 -10h.5"></path></g><path
d="M 400 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
<dt id=url-diagram>URL
<dd> <!--<script>
Diagram(
Choice(0, Terminal('u'), Terminal('U')),
Choice(0, Terminal('r'), Terminal('R')),
Choice(0, Terminal('l'), Terminal('L')),
Terminal('('),
Choice(1,
Optional(NonTerminal('WS')),
Sequence(
Optional(NonTerminal('WS')),
NonTerminal('STRING'),
Optional(NonTerminal('WS'))),
Sequence(
Optional(NonTerminal('WS')),
OneOrMore(
Choice(0,
NonTerminal('not " \' ( ) WS or NPC'),
NonTerminal('escape'))),
Optional(NonTerminal('WS')))),
Terminal(')')).addTo();
</script>-->
<svg class=diagram height=190 width=901>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><g
transform="translate(.5 .5)"><path
d="M 20 71 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
d="M40 81h0h.5"></path><path d="M110 81h0h.5"></path><path
d="M40 81h20h.5"></path><g><path d="M60 81h30h.5"></path><rect height=22
rx=10 ry=10 width=30 x=60 y=70></rect><text x=75 y=85>u</text></g><path
d="M90 81h20h.5"></path><path
d="M40 81a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M60 111h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=60
y=100></rect><text x=75 y=115>U</text></g><path
d="M90 111a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><g><path
d="M110 81h0h.5"></path><path d="M180 81h0h.5"></path><path
d="M110 81h20h.5"></path><g><path d="M130 81h30h.5"></path><rect
height=22 rx=10 ry=10 width=30 x=130 y=70></rect><text x=145
y=85>r</text></g><path d="M160 81h20h.5"></path><path
d="M110 81a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M130 111h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=130
y=100></rect><text x=145 y=115>R</text></g><path
d="M160 111a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><g><path
d="M180 81h0h.5"></path><path d="M250 81h0h.5"></path><path
d="M180 81h20h.5"></path><g><path d="M200 81h30h.5"></path><rect
height=22 rx=10 ry=10 width=30 x=200 y=70></rect><text x=215
y=85>l</text></g><path d="M230 81h20h.5"></path><path
d="M180 81a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M200 111h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=200
y=100></rect><text x=215 y=115>L</text></g><path
d="M230 111a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><path
d="M250 81h10h.5"></path><g><path d="M260 81h30h.5"></path><rect
height=22 rx=10 ry=10 width=30 x=260 y=70></rect><text x=275
y=85>(</text></g><path d="M290 81h10h.5"></path><g><path
d="M300 81h0h.5"></path><path d="M810 81h0h.5"></path><path
d="M300 81a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10h.5"></path><g><path
d="M320 41h195h.5"></path><path d="M595 41h195h.5"></path><path
d="M515 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M535 21h40h.5"></path></g><path
d="M575 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M515 41h20h.5"></path><g><path d="M535 41h40h.5"></path><rect
height=22 width=40 x=535 y=30></rect><text x=555 y=45>WS</text></g><path
d="M575 41h20h.5"></path></g><path
d="M790 41a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10h.5"></path><path
d="M300 81h20h.5"></path><g><path d="M320 81h105h.5"></path><g><path
d="M425 81h0h.5"></path><path d="M505 81h0h.5"></path><path
d="M425 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M445 61h40h.5"></path></g><path
d="M485 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M425 81h20h.5"></path><g><path d="M445 81h40h.5"></path><rect
height=22 width=40 x=445 y=70></rect><text x=465 y=85>WS</text></g><path
d="M485 81h20h.5"></path></g><path d="M505 81h10h.5"></path><g><path
d="M515 81h80h.5"></path><rect height=22 width=80 x=515 y=70></rect><text
x=555 y=85>STRING</text></g><path d="M595 81h10h.5"></path><g><path
d="M605 81h0h.5"></path><path d="M685 81h0h.5"></path><path
d="M605 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M625 61h40h.5"></path></g><path
d="M665 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M605 81h20h.5"></path><g><path d="M625 81h40h.5"></path><rect
height=22 width=40 x=625 y=70></rect><text x=645 y=85>WS</text></g><path
d="M665 81h20h.5"></path></g><path d="M685 81h105h.5"></path></g><path
d="M790 81h20h.5"></path><path
d="M300 81a10 10 0 0 1 10 10v20a10 10 0 0 0 10 10h.5"></path><g><path
d="M320 121h0h.5"></path><g><path d="M320 121h0h.5"></path><path
d="M400 121h0h.5"></path><path
d="M320 121a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M340 101h40h.5"></path></g><path
d="M380 101a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M320 121h20h.5"></path><g><path d="M340 121h40h.5"></path><rect
height=22 width=40 x=340 y=110></rect><text x=360
y=125>WS</text></g><path d="M380 121h20h.5"></path></g><path
d="M400 121h10h.5"></path><g><path d="M410 121h0h.5"></path><path
d="M700 121h0h.5"></path><path d="M410 121h10h.5"></path><g><path
d="M420 121h0h.5"></path><path d="M690 121h0h.5"></path><path
d="M420 121h20h.5"></path><g><path d="M440 121h230h.5"></path><rect
height=22 width=230 x=440 y=110></rect><text x=555 y=125>not " ' ( )
WS or NPC</text></g><path d="M670 121h20h.5"></path><path
d="M420 121a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h.5"></path><g><path
d="M440 151h230h.5"></path><rect height=22 width=80 x=515
y=140></rect><text x=555 y=155>escape</text></g><path
d="M670 151a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10h.5"></path></g><path
d="M690 121h10h.5"></path><path
d="M420 121a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10h.5"></path><g><path
d="M420 170h270h.5"></path></g><path
d="M690 170a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10h.5"></path></g><path
d="M700 121h10h.5"></path><g><path d="M710 121h0h.5"></path><path
d="M790 121h0h.5"></path><path
d="M710 121a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M730 101h40h.5"></path></g><path
d="M770 101a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M710 121h20h.5"></path><g><path d="M730 121h40h.5"></path><rect
height=22 width=40 x=730 y=110></rect><text x=750
y=125>WS</text></g><path d="M770 121h20h.5"></path></g><path
d="M790 121h0h.5"></path></g><path
d="M790 121a10 10 0 0 0 10 -10v-20a10 10 0 0 1 10 -10h.5"></path></g><path
d="M810 81h10h.5"></path><g><path d="M820 81h30h.5"></path><rect
height=22 rx=10 ry=10 width=30 x=820 y=70></rect><text x=835
y=85>)</text></g><path d="M850 81h10h.5"></path><path
d="M 860 81 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg>
<dt id=number-diagram>NUMBER
<dd> <!--<script>
Diagram(
Choice(1, Terminal('+'), Skip(), Terminal('-')),
Choice(0,
Sequence(
OneOrMore(NonTerminal('digit')),
Terminal('.'),
OneOrMore(NonTerminal('digit'))),
OneOrMore(NonTerminal('digit')),
Sequence(
Terminal('.'),
OneOrMore(NonTerminal('digit')))),
Choice(0,
Skip(),
Sequence(
Choice(0, Terminal('e'), Terminal('E')),
Choice(1, Terminal('+'), Skip(), Terminal('-')),
OneOrMore(NonTerminal('digit'))))).addTo();
</script>-->
<svg class=diagram height=179 width=751>
<style>.diagram{background-color:hsl(30,20%,95%);} .diagram path{stroke-width:3;stroke:black;fill:rgba(0,0,0,0);} .diagram text{font:bold 14px monospace;text-anchor:middle;} .diagram text.label{text-anchor:start;} .diagram text.comment{font:italic 12px monospace;} .diagram rect{stroke-width:3;stroke:black;fill:hsl(120,100%,90%);}</style><g
transform="translate(.5 .5)"><path
d="M 20 50 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><g><path
d="M40 60h0h.5"></path><path d="M110 60h0h.5"></path><path
d="M40 60a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path><g><path
d="M60 40h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=60
y=29></rect><text x=75 y=44>+</text></g><path
d="M90 40a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><path
d="M40 60h20h.5"></path><g><path d="M60 60h30h.5"></path></g><path
d="M90 60h20h.5"></path><path
d="M40 60a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10h.5"></path><g><path
d="M60 80h30h.5"></path><rect height=22 rx=10 ry=10 width=30 x=60
y=69></rect><text x=75 y=84>-</text></g><path
d="M90 80a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10h.5"></path></g><g><path
d="M110 60h0h.5"></path><path d="M420 60h0h.5"></path><path