css3-syntax/Overview.src.html

Wed, 13 Feb 2013 18:35:14 -0800

author
Tab Atkins Jr. <jackalmage@gmail.com>
date
Wed, 13 Feb 2013 18:35:14 -0800
changeset 7465
550ce5a48ffb
parent 7464
a1add5340f0f
child 7466
b15ae85d44af
permissions
-rwxr-xr-x

[css3-syntax] Rewrite the charset determining step to be a little clearer, and closer to my normal language.

     1 <!DOCTYPE html>
     2 <html lang="en">
     3 <head>
     4 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     5 	<title>CSS Syntax Module Level 3 (CSS3 Syntax)</title>
     6 	<link rel=contents href="#contents">
     7 	<link rel=index href="#index">
     8 	<link rel="stylesheet" type="text/css" href="../default.css">
     9 	<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
    10 	<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
    11 	<link rel="stylesheet" type="text/css" href="railroad-diagrams.css">
    12 </head>
    14 <div class="head">
    15 <!--logo-->
    17 <h1>CSS Syntax Module Level 3</h1>
    19 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
    20 <dl>
    21 	<dt>This version:
    22 	<dd>
    23 		<a href="http://dev.w3.org/csswg/css3-syntax/">http://dev.w3.org/csswg/css3-syntax/</a>
    24 <!--
    25 	<dt>Latest version:
    26 	<dd>
    27 		<a href="http://www.w3.org/TR/css3-syntax/">http://www.w3.org/TR/css3-syntax/</a>
    28 -->
    29 	<dt>Editor's draft:
    30 	<dd>
    31 		<a href="http://dev.w3.org/csswg/css3-syntax/">http://dev.w3.org/csswg/css3-syntax/</a>
    33 	<dt>Previous version:
    34 	<dd>
    35 		<a href="http://www.w3.org/TR/2003/WD-css3-syntax-20030813/">http://www.w3.org/TR/2003/WD-css3-syntax-20030813/</a>
    37 	<dt>Issue Tracking:
    38 	<dd>
    39 		<a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Syntax">W3C Bugzilla</a>
    41 	<dt>Feedback:
    42 	<dd>
    43 		<a href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a>
    44 		with subject line &ldquo;<kbd>[css3-syntax] <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
    46 	<dt>Editors:
    47 	<dd class="h-card vcard">
    48 			<a class="p-name fn u-url url" rel="author"
    49 				 href="http://www.xanthir.com/">Tab Atkins Jr.</a>
    50 			(<span class="p-org org">Google, Inc.</span>),
    51 			<span class="u-email email">jackalmage@gmail.com</span>
    52 </dl>
    54 <!--copyright-->
    56 <hr title="Separator for header">
    57 </div>
    59 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    61 	<p>
    62 		<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.
    63 		This module describes, in general terms, the basic structure and syntax of CSS stylesheets.
    64 		It defines, in detail, the syntax and parsing of CSS - how to turn a stream of bytes into a meaningful stylesheet.
    66 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    68 <!--status-->
    70 <p>The following features are at risk: &hellip;
    72 <h2 class="no-num no-toc" id="contents">
    73 Table of contents</h2>
    75 <!--toc-->
    77 <h2 id="intro">
    78 Introduction</h2>
    80 	<p><em>This section is not normative.</em>
    82 	<p>
    83 		This module defines the abstract syntax and parsing of CSS stylesheets
    84 		and other things which use CSS syntax
    85 		(such as the HTML <code>style</code> attribute).
    87 	<p>
    88 		It defines algorithms for converting a stream of codepoints
    89 		(in other words, text)
    90 		into a stream of CSS tokens,
    91 		and then further into CSS objects
    92 		such as stylesheets, rules, and declarations.
    94 <h3 id="placement">
    95 Module interactions</h3>
    97 	<p>
    98 		This module defines the syntax and parsing of CSS stylesheets.
    99 		It supersedes the lexical scanner and grammar defined in CSS 2.1.
   101 <h2 id='syntax-description'>
   102 Description of CSS's Syntax</h2>
   104 	<p><em>This section is not normative.</em>
   106 	<p>
   107 		A CSS document is a series of <i>style rules</i>,
   108 		which apply CSS properties to elements in the source document,
   109 		and <i>at-rules</i>,
   110 		which define special processing rules or values for the CSS document.
   112 	<p>
   113 		A <dfn>style rule</dfn> starts with a selector
   114 		(defined by the <a href="http://www.w3.org/TR/selectors/">Selectors specification</a>),
   115 		then has a {}-wrapped block containing a sequence of declarations.
   116 		The selector specifies which elements the declarations will apply to.
   117 		Each declaration has a property name,
   118 		followed by a colon and the property value,
   119 		and finished with a semicolon.
   121 	<div class='example'>
   122 		<p>
   123 			A typical rule might look something like this:
   125 		<pre>
   126 p > a {
   127 	color: blue;
   128 	text-decoration: underline;
   129 }</pre>
   131 		<p>
   132 			In the above rule, "<code>p > a</code>" is the selector,
   133 			which, if the source document is HTML,
   134 			selects any <code>&lt;a></code> elements that are children of a <code>&lt;p></code> element.
   136 		<p>
   137 			"<code>color: blue;</code>" is a declaration specifying that,
   138 			for the elements that match the selector,
   139 			their 'color' property should have the value ''blue''.
   140 			Similiarly, their 'text-decoration' property should have the value ''underline''.
   141 	</div>
   143 	<p>
   144 		<dfn title="at-rule">At-rules</dfn> are all different, but they have a basic structure in common.
   145 		They start with an "@" character followed by their name.
   146 		Some <i>at-rules</i> are simple statements,
   147 		with their name followed by more CSS values to specify their behavior,
   148 		and finally ended by a semicolon.
   149 		Others are blocks;
   150 		they can have CSS values following their name,
   151 		but they end with a {}-wrapped block,
   152 		similar to a <i>rule</i>.
   153 		Even the contents of these blocks are specific to the given <i>at-rule</i>:
   154 		sometimes they contain a sequence of declarations, like a <i>rule</i>;
   155 		other times, they may contain additional blocks, or at-rules, or other structures altogether.
   157 	<div class='example'>
   158 		<p>
   159 			Here are several examples of <i>at-rules</i> that illustrate the varied syntax they may contain.
   161 		<pre>@import "my-styles.css";</pre>
   163 		<p>
   164 			The ''@import'' <i>at-rule</i> is a simple statement.
   165 			After its name, it takes a single string or ''url()'' function to indicate the stylesheet that it should import.
   167 		<pre>
   168 @page :left {
   169 	margin-left: 4cm;
   170 	margin-right: 3cm;
   171 }</pre>
   173 		<p>
   174 			The ''@page'' <i>at-rule</i> consists of an optional page selector (the ":left" pseudoclass),
   175 			followed by a block of properties that apply to the page when printed.
   176 			In this way, it's very similar to a normal <i>style rule</i>,
   177 			except that its properties don't apply to any "element",
   178 			but rather the page itself.
   180 		<pre>
   181 @media print {
   182 	body { font-size: 10pt }
   183 }</pre>
   185 		<p>
   186 			The ''@media'' <i>at-rule</i> begins with a media type
   187 			and a list of optional media queries.
   188 			Its block contains entire rules,
   189 			which are only applied when the ''@media''s conditions are fulfilled.
   190 	</div>
   192 	<p>
   193 		Property names and <i>at-rule</i> names are always <b>idents</b>,
   194 		which have to start with a letter or a hyphen followed by a letter,
   195 		and then can contain letters, numbers, hyphens, or underscores.
   196 		You can include any character at all,
   197 		even ones that CSS uses in its syntax,
   198 		by escaping it with a backslash (\) or by using a hexadecimal escape.
   200 	<p>
   201 		The syntax of selectors is defined in the <a href="http://www.w3.org/TR/selectors/">Selectors spec</a>.
   202 		Similarly, the syntax of the wide variety of CSS values is defined in the <a href="http://www.w3.org/TR/css3-values/">Values &amp; Units spec</a>.
   203 		The special syntaxes of individual <i>at-rules</i> can be found in the specs that define them.
   205 <h2>
   206 Tokenizing and Parsing CSS</h2>
   208 	<p>
   209 		User agents must use the parsing rules described in this specifiction
   210 		to generate the CSSOM trees from text/css resources.
   211 		Together, these rules define what is referred to as the CSS parser.
   213 	<p>
   214 		This specification defines the parsing rules for CSS documents,
   215 		whether they are syntactically correct or not.
   216 		Certain points in the parsing algorithm are said to be parse errors.
   217 		The error handling for parse errors is well-defined:
   218 		user agents must either act as described below when encountering such problems,
   219 		or must abort processing at the first error that they encounter for which they do not wish to apply the rules described below.
   221 	<p>
   222 		Conformance checkers must report at least one parse error condition to the user
   223 		if one or more parse error conditions exist in the document
   224 		and must not report parse error conditions
   225 		if none exist in the document.
   226 		Conformance checkers may report more than one parse error condition if more than one parse error condition exists in the document.
   227 		Conformance checkers are not required to recover from parse errors.
   229 <h3>
   230 Overview of the Parsing Model</h3>
   232 	<p>
   233 		The input to the CSS parsing process consists of a stream of Unicode code points,
   234 		which is passed through a tokenization stage followed by a tree construction stage.
   235 		The output is a CSSStyleSheet object.
   237 	<p class='note'>
   238 		Implementations that do not support scripting do not have to actually create a CSSOM CSSStyleSheet object,
   239 		but the CSSOM tree in such cases is still used as the model for the rest of the specification.
   241 <h3>
   242 The input byte stream</h3>
   244 	<p>
   245 		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
   246 		(typically coming over the network or from the local file system).
   247 		The bytes encode the actual characters according to a particular character encoding,
   248 		which the user agent must use to decode the bytes into characters.
   250 	<p>
   251 		To decode the stream of bytes into a stream of characters,
   252 		UAs must follow these steps.
   254 	<p>
   255 		The algorithms to <a href="http://encoding.spec.whatwg.org/#concept-encoding-get"><dfn>get an encoding</dfn></a>
   256 		and <a href="http://encoding.spec.whatwg.org/#decode"><dfn>decode</dfn></a>
   257 		are defined in the <a href="http://encoding.spec.whatwg.org/">Encoding Standard</a>.
   259 	<p>
   260 		First, determine the fallback encoding:
   262 	<ol>
   263 		<li>
   264 			If HTTP or equivalent protocol defines an encoding (e.g. via the charset parameter of the Content-Type header),
   265 			<i>get an encoding</i> for the specified value.
   266 			If that does not return failure,
   267 			use the return value as the fallback encoding.
   269 		<li>
   270 			Otherwise, check the byte stream. If the first several bytes match the hex sequence
   272 			<pre>40 63 68 61 72 73 65 74 20 22 (not 22)* 22 3B</pre>
   274 			then <i>get an encoding</i> for the sequence of <code>(not 22)*</code> bytes,
   275 			decoded per <code>windows-1252</code>.
   277 			<p class='note'>
   278 				Note: Anything ASCII-compatible will do, so using <code>windows-1252</code> is fine.
   280 			<p class='note'>
   281 				Note: The byte sequence above,
   282 				when decoded as ASCII,
   283 				is the string "<code>@charset "…";</code>",
   284 				where the "…" is the sequence of bytes corresponding to the encoding's name.
   286 			<p>
   287 				If the return value was <code>utf-16</code> or <code>utf-16be</code>,
   288 				use <code>utf-8</code> as the fallback encoding;
   289 				if it was anything else except failure,
   290 				use the return value as the fallback encoding.
   292 			<p class='note'>
   293 				This mimics HTML <code>&lt;meta></code> behavior.
   295 		<li>
   296 			Otherwise, <i>get an encoding</i> for the value of the <code>charset</code> attribute on the <code>&lt;link></code> element or <code>&lt;?xml-stylesheet?></code> processing instruction that caused the style sheet to be included, if any.
   297 			If that does not return failure,
   298 			use the return value as the fallback encoding.
   300 		<li>
   301 			Otherwise, if the referring style sheet or document has an encoding,
   302 			use that as the fallback encoding.
   304 		<li>
   305 			Otherwise, use <code>utf-8</code> as the fallback encoding.
   306 	</ol>
   308 	<p>
   309 		Then, <i>decode</i> the byte stream using the fallback encoding.
   311 	<p class='note'>
   312 		Note: the <i>decode</i> algorithm lets the byte order mark (BOM) take precedence,
   313 		hence the usage of the term "fallback" above.
   315 	<p class='issue'>
   316 		Anne says that steps 4/5 should be an input to this algorithm from the specs that define importing stylesheet,
   317 		to make the algorithm as a whole cleaner.
   318 		Perhaps abstract it into the concept of an "environment charset" or something?
   321 <h4>
   322 Preprocessing the input stream</h4>
   324 	<p>
   325 		The input stream consists of the characters pushed into it as the input byte stream is decoded.
   327 	<p>
   328 		Before sending the input stream to the tokenizer,
   329 		implementations must make the following character substitutions:
   331 	<ul>
   332 		<li>
   333 			Replace any U+000D CARRIAGE RETURN (CR) characters
   334 			or pairs of U+000D CARRIAGE RETURN (CR) followed by U+000A LINE FEED (LF)
   335 			by a single U+000A LINE FEED (LF) character.
   337 		<li>
   338 			Replace any U+0000 NULL characters with U+FFFD REPLACEMENT CHARACTER (�).
   339 	</ul>
   341 	<p>
   342 		The <dfn>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 <i>next input character</i> is the first character in the input. The <dfn>current input character</dfn> is the last character to have been consumed.
   344 	<p>
   345 		The "EOF" character in the tables below is a conceptual character representing the end of the input stream.
   348 <h2>
   349 Tokenization</h2>
   351 	<p>
   352 		Implementations must act as if they used the following state machine to tokenize CSS.
   353 		The state machine must start in the <i>data state</i>.
   354 		Most states consume a single character,
   355 		which may have various side-effects,
   356 		and either switches the state machine to a new state to reconsume the same character,
   357 		or switches it to a new state to consume the next character,
   358 		or stays in the same state to consume the next character.
   359 		Some states have more complicated behavior and can consume several characters before switching to another state.
   361 	<p>
   362 		The output of the tokenization step is a series of zero or more of the following tokens:
   363 		ident,
   364 		function,
   365 		at-keyword,
   366 		hash,
   367 		string,
   368 		bad-string,
   369 		url,
   370 		bad-url,
   371 		delim,
   372 		number,
   373 		percentage,
   374 		dimension,
   375 		unicode-range,
   376 		include-match,
   377 		dash-match,
   378 		prefix-match,
   379 		suffix-match,
   380 		substring-match,
   381 		whitespace,
   382 		cdo,
   383 		cdc,
   384 		colon,
   385 		semicolon,
   386 		comma,
   387 		[,
   388 		],
   389 		(,
   390 		),
   391 		{,
   392 		and }.
   394 	<p>
   395 		ident, function, at-keyword, hash, string, and url tokens have a value composed of zero or more characters.
   396 		Delim tokens have a value composed of a single character.
   397 		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.
   398 		Dimension tokens additionally have a unit composed of one or more characters.
   399 		Unicode-range tokens have a range of characters.
   401 	<p>
   402 		The tokenizer state machine consists of the states defined in the following subsections.
   404 <h3 id='token-diagrams'>
   405 Token Railroad Diagrams</h3>
   407 	<p>
   408 		<em>This section is non-normative.</em>
   410 	<p>
   411 		This section presents an informative view of the token parser,
   412 		in the form of railroad diagrams.
   413 		Railroad diagrams are more compact than a state-machine,
   414 		but often easier to read than a regular expression.
   416 	<p>
   417 		These diagrams are <em>informative</em> and <em>incomplete</em>;
   418 		they describe the grammar of "correct" tokens,
   419 		but do not describe error-handling at all.
   420 		They are provided solely to make it easier to get an intuitive grasp of the syntax of each token.
   422 	<!--
   423 		The "source" of these diagrams is in ./Diagrams.src.html
   424 		The generated SVG is copied here so that JavaScript is not required
   425 		to view the spec.
   426 	-->
   428 	<dl>
   429 		<dt id="escape-diagram">escape</dt>
   430 		<dd><svg class="railroad-diagram" width="377" height="122"><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"></path><path d="M78 31h0"></path><rect x="50" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="64" y="35">\</text></g><path d="M78 31h10"></path><g><path d="M88 31h0"></path><path d="M336 31h0"></path><path d="M88 31h20"></path><g><path d="M108 31h18"></path><path d="M298 31h18"></path><rect x="126" y="20" width="172" height="22"></rect><text x="212" y="35">not NL or hex digit</text></g><path d="M316 31h20"></path><path d="M88 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M108 61h0"></path><path d="M316 61h0"></path><path d="M108 61h10"></path><g><path d="M118 61h0"></path><path d="M230 61h0"></path><path d="M118 61h10"></path><g><path d="M128 61h0"></path><path d="M220 61h0"></path><rect x="128" y="50" width="92" height="22"></rect><text x="174" y="65">hex digit</text></g><path d="M220 61h10"></path><path d="M128 61a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path><g><path d="M128 91h9.5"></path><path d="M210.5 91h9.5"></path><text x="174" y="96" class="comment">1-6 times</text></g><path d="M220 91a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path></g><path d="M230 61h10"></path><g><path d="M240 61h0"></path><path d="M316 61h0"></path><path d="M240 61h20"></path><g><path d="M260 61h36"></path></g><path d="M296 61h20"></path><path d="M240 61a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M260 81h0"></path><path d="M296 81h0"></path><rect x="260" y="70" width="36" height="22"></rect><text x="278" y="85">WS</text></g><path d="M296 81a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g></g><path d="M316 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path d="M 336 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   432 		<dt id="ident-diagram">IDENT</dt>
   433 		<dd><svg class="railroad-diagram" width="729" height="110"><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"></path><path d="M108 41h0"></path><path d="M40 41h20"></path><g><path d="M60 41h28"></path></g><path d="M88 41h20"></path><path d="M40 41a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M60 61h0"></path><path d="M88 61h0"></path><rect x="60" y="50" width="28" height="22" rx="10" ry="10"></rect><text x="74" y="65">-</text></g><path d="M88 61a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g><g><path d="M108 41h0"></path><path d="M344 41h0"></path><path d="M108 41h20"></path><g><path d="M128 41h0"></path><path d="M324 41h0"></path><rect x="128" y="30" width="196" height="22"></rect><text x="226" y="45">a-z A-Z _ or non-ASCII</text></g><path d="M324 41h20"></path><path d="M108 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M128 71h64"></path><path d="M260 71h64"></path><rect x="192" y="60" width="68" height="22"></rect><text x="226" y="75">escape</text></g><path d="M324 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><g><path d="M344 41h0"></path><path d="M688 41h0"></path><path d="M344 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M364 21h304"></path></g><path d="M668 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M344 41h20"></path><g><path d="M364 41h0"></path><path d="M668 41h0"></path><path d="M364 41h10"></path><g><path d="M374 41h0"></path><path d="M658 41h0"></path><path d="M374 41h20"></path><g><path d="M394 41h0"></path><path d="M638 41h0"></path><rect x="394" y="30" width="244" height="22"></rect><text x="516" y="45">a-z A-Z 0-9 _ - or non-ASCII</text></g><path d="M638 41h20"></path><path d="M374 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M394 71h88"></path><path d="M550 71h88"></path><rect x="482" y="60" width="68" height="22"></rect><text x="516" y="75">escape</text></g><path d="M638 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path d="M658 41h10"></path><path d="M374 41a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path d="M374 90h284"></path></g><path d="M658 90a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path d="M668 41h20"></path></g><path d="M 688 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   435 		<dt id="function-diagram">FUNCTION</dt>
   436 		<dd><svg class="railroad-diagram" width="209" height="62"><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"></path><path d="M110 31h0"></path><rect x="50" y="20" width="60" height="22"></rect><text x="80" y="35">IDENT</text></g><path d="M110 31h10"></path><path d="M120 31h10"></path><g><path d="M130 31h0"></path><path d="M158 31h0"></path><rect x="130" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="144" y="35">(</text></g><path d="M158 31h10"></path><path d="M 168 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   438 		<dt id="at-keyword-diagram">AT-KEYWORD</dt>
   439 		<dd><svg class="railroad-diagram" width="209" height="62"><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"></path><path d="M78 31h0"></path><rect x="50" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="64" y="35">@</text></g><path d="M78 31h10"></path><path d="M88 31h10"></path><g><path d="M98 31h0"></path><path d="M158 31h0"></path><rect x="98" y="20" width="60" height="22"></rect><text x="128" y="35">IDENT</text></g><path d="M158 31h10"></path><path d="M 168 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   441 		<dt id="hash-diagram">HASH</dt>
   442 		<dd><svg class="railroad-diagram" width="453" height="100"><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"></path><path d="M78 31h0"></path><rect x="50" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="64" y="35">#</text></g><path d="M78 31h10"></path><path d="M88 31h10"></path><g><path d="M98 31h0"></path><path d="M402 31h0"></path><path d="M98 31h10"></path><g><path d="M108 31h0"></path><path d="M392 31h0"></path><path d="M108 31h20"></path><g><path d="M128 31h0"></path><path d="M372 31h0"></path><rect x="128" y="20" width="244" height="22"></rect><text x="250" y="35">a-z A-Z 0-9 _ - or non-ASCII</text></g><path d="M372 31h20"></path><path d="M108 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M128 61h88"></path><path d="M284 61h88"></path><rect x="216" y="50" width="68" height="22"></rect><text x="250" y="65">escape</text></g><path d="M372 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path d="M392 31h10"></path><path d="M108 31a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path d="M108 80h284"></path></g><path d="M392 80a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path d="M402 31h10"></path><path d="M 412 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   444 		<dt id="string-diagram">STRING</dt>
   445 		<dd><svg class="railroad-diagram" width="441" height="248"><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"></path><path d="M400 41h0"></path><path d="M40 41h20"></path><g><path d="M60 41h0"></path><path d="M380 41h0"></path><path d="M60 41h10"></path><g><path d="M70 41h0"></path><path d="M98 41h0"></path><rect x="70" y="30" width="28" height="22" rx="10" ry="10"></rect><text x="84" y="45">"</text></g><path d="M98 41h10"></path><g><path d="M108 41h0"></path><path d="M332 41h0"></path><path d="M108 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M128 21h184"></path></g><path d="M312 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M108 41h20"></path><g><path d="M128 41h0"></path><path d="M312 41h0"></path><path d="M128 41h10"></path><g><path d="M138 41h0"></path><path d="M302 41h0"></path><path d="M138 41h20"></path><g><path d="M158 41h0"></path><path d="M282 41h0"></path><rect x="158" y="30" width="124" height="22"></rect><text x="220" y="45">not " \ or NL</text></g><path d="M282 41h20"></path><path d="M138 41a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M158 71h28"></path><path d="M254 71h28"></path><rect x="186" y="60" width="68" height="22"></rect><text x="220" y="75">escape</text></g><path d="M282 71a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><path d="M138 41a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path><g><path d="M158 101h10"></path><path d="M272 101h10"></path><path d="M168 101h10"></path><g><path d="M178 101h0"></path><path d="M206 101h0"></path><rect x="178" y="90" width="28" height="22" rx="10" ry="10"></rect><text x="192" y="105">\</text></g><path d="M206 101h10"></path><path d="M216 101h10"></path><g><path d="M226 101h0"></path><path d="M262 101h0"></path><rect x="226" y="90" width="36" height="22"></rect><text x="244" y="105">NL</text></g><path d="M262 101h10"></path></g><path d="M282 101a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path></g><path d="M302 41h10"></path><path d="M138 41a10 10 0 0 0 -10 10v59a10 10 0 0 0 10 10"></path><g><path d="M138 120h164"></path></g><path d="M302 120a10 10 0 0 0 10 -10v-59a10 10 0 0 0 -10 -10"></path></g><path d="M312 41h20"></path></g><path d="M332 41h10"></path><g><path d="M342 41h0"></path><path d="M370 41h0"></path><rect x="342" y="30" width="28" height="22" rx="10" ry="10"></rect><text x="356" y="45">"</text></g><path d="M370 41h10"></path></g><path d="M380 41h20"></path><path d="M40 41a10 10 0 0 1 10 10v88a10 10 0 0 0 10 10"></path><g><path d="M60 149h0"></path><path d="M380 149h0"></path><path d="M60 149h10"></path><g><path d="M70 149h0"></path><path d="M98 149h0"></path><rect x="70" y="138" width="28" height="22" rx="10" ry="10"></rect><text x="84" y="153">&apos;</text></g><path d="M98 149h10"></path><g><path d="M108 149h0"></path><path d="M332 149h0"></path><path d="M108 149a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M128 129h184"></path></g><path d="M312 129a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M108 149h20"></path><g><path d="M128 149h0"></path><path d="M312 149h0"></path><path d="M128 149h10"></path><g><path d="M138 149h0"></path><path d="M302 149h0"></path><path d="M138 149h20"></path><g><path d="M158 149h0"></path><path d="M282 149h0"></path><rect x="158" y="138" width="124" height="22"></rect><text x="220" y="153">not &apos; \ or NL</text></g><path d="M282 149h20"></path><path d="M138 149a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M158 179h28"></path><path d="M254 179h28"></path><rect x="186" y="168" width="68" height="22"></rect><text x="220" y="183">escape</text></g><path d="M282 179a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path><path d="M138 149a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path><g><path d="M158 209h10"></path><path d="M272 209h10"></path><path d="M168 209h10"></path><g><path d="M178 209h0"></path><path d="M206 209h0"></path><rect x="178" y="198" width="28" height="22" rx="10" ry="10"></rect><text x="192" y="213">\</text></g><path d="M206 209h10"></path><path d="M216 209h10"></path><g><path d="M226 209h0"></path><path d="M262 209h0"></path><rect x="226" y="198" width="36" height="22"></rect><text x="244" y="213">NL</text></g><path d="M262 209h10"></path></g><path d="M282 209a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path></g><path d="M302 149h10"></path><path d="M138 149a10 10 0 0 0 -10 10v59a10 10 0 0 0 10 10"></path><g><path d="M138 228h164"></path></g><path d="M302 228a10 10 0 0 0 10 -10v-59a10 10 0 0 0 -10 -10"></path></g><path d="M312 149h20"></path></g><path d="M332 149h10"></path><g><path d="M342 149h0"></path><path d="M370 149h0"></path><rect x="342" y="138" width="28" height="22" rx="10" ry="10"></rect><text x="356" y="153">&apos;</text></g><path d="M370 149h10"></path></g><path d="M380 149a10 10 0 0 0 10 -10v-88a10 10 0 0 1 10 -10"></path></g><path d="M 400 41 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   447 		<dt id="url-diagram">URL</dt>
   448 		<dd><svg class="railroad-diagram" width="813" height="178"><g transform="translate(.5 .5)"><path d="M 20 99 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path><path d="M40 109h10"></path><g><path d="M50 109h0"></path><path d="M150 109h0"></path><rect x="50" y="98" width="100" height="22"></rect><text x="100" y="113">IDENT(url)</text></g><path d="M150 109h10"></path><path d="M160 109h10"></path><g><path d="M170 109h0"></path><path d="M198 109h0"></path><rect x="170" y="98" width="28" height="22" rx="10" ry="10"></rect><text x="184" y="113">(</text></g><path d="M198 109h10"></path><g><path d="M208 109h0"></path><path d="M724 109h0"></path><path d="M208 109a10 10 0 0 0 10 -10v-48a10 10 0 0 1 10 -10"></path><g><path d="M228 41h88"></path><path d="M616 41h88"></path><g><path d="M316 41h0"></path><path d="M412 41h0"></path><path d="M316 41h20"></path><g><path d="M336 41h56"></path></g><path d="M392 41h20"></path><path d="M316 41a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M336 61h0"></path><path d="M392 61h0"></path><path d="M336 61h10"></path><g><path d="M346 61h0"></path><path d="M382 61h0"></path><rect x="346" y="50" width="36" height="22"></rect><text x="364" y="65">WS</text></g><path d="M382 61h10"></path><path d="M346 61a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M346 81h36"></path></g><path d="M382 81a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M392 61a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g><g><path d="M412 41h0"></path><path d="M520 41h0"></path><path d="M412 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M432 21h68"></path></g><path d="M500 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M412 41h20"></path><g><path d="M432 41h0"></path><path d="M500 41h0"></path><rect x="432" y="30" width="68" height="22"></rect><text x="466" y="45">STRING</text></g><path d="M500 41h20"></path></g><g><path d="M520 41h0"></path><path d="M616 41h0"></path><path d="M520 41h20"></path><g><path d="M540 41h56"></path></g><path d="M596 41h20"></path><path d="M520 41a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M540 61h0"></path><path d="M596 61h0"></path><path d="M540 61h10"></path><g><path d="M550 61h0"></path><path d="M586 61h0"></path><rect x="550" y="50" width="36" height="22"></rect><text x="568" y="65">WS</text></g><path d="M586 61h10"></path><path d="M550 61a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M550 81h36"></path></g><path d="M586 81a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M596 61a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g></g><path d="M704 41a10 10 0 0 1 10 10v48a10 10 0 0 0 10 10"></path><path d="M208 109h20"></path><g><path d="M228 109h0"></path><path d="M704 109h0"></path><g><path d="M228 109h0"></path><path d="M324 109h0"></path><path d="M228 109h20"></path><g><path d="M248 109h56"></path></g><path d="M304 109h20"></path><path d="M228 109a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M248 129h0"></path><path d="M304 129h0"></path><path d="M248 129h10"></path><g><path d="M258 129h0"></path><path d="M294 129h0"></path><rect x="258" y="118" width="36" height="22"></rect><text x="276" y="133">WS</text></g><path d="M294 129h10"></path><path d="M258 129a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M258 149h36"></path></g><path d="M294 149a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M304 129a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g><path d="M324 109h10"></path><g><path d="M334 109h0"></path><path d="M598 109h0"></path><path d="M334 109h10"></path><g><path d="M344 109h0"></path><path d="M588 109h0"></path><path d="M344 109h20"></path><g><path d="M364 109h0"></path><path d="M568 109h0"></path><rect x="364" y="98" width="204" height="22"></rect><text x="466" y="113">not " &apos; ( ) \ WS or NPC</text></g><path d="M568 109h20"></path><path d="M344 109a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M364 139h68"></path><path d="M500 139h68"></path><rect x="432" y="128" width="68" height="22"></rect><text x="466" y="143">escape</text></g><path d="M568 139a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path d="M588 109h10"></path><path d="M344 109a10 10 0 0 0 -10 10v29a10 10 0 0 0 10 10"></path><g><path d="M344 158h244"></path></g><path d="M588 158a10 10 0 0 0 10 -10v-29a10 10 0 0 0 -10 -10"></path></g><path d="M598 109h10"></path><g><path d="M608 109h0"></path><path d="M704 109h0"></path><path d="M608 109h20"></path><g><path d="M628 109h56"></path></g><path d="M684 109h20"></path><path d="M608 109a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M628 129h0"></path><path d="M684 129h0"></path><path d="M628 129h10"></path><g><path d="M638 129h0"></path><path d="M674 129h0"></path><rect x="638" y="118" width="36" height="22"></rect><text x="656" y="133">WS</text></g><path d="M674 129h10"></path><path d="M638 129a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M638 149h36"></path></g><path d="M674 149a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M684 129a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g></g><path d="M704 109h20"></path></g><path d="M724 109h10"></path><g><path d="M734 109h0"></path><path d="M762 109h0"></path><rect x="734" y="98" width="28" height="22" rx="10" ry="10"></rect><text x="748" y="113">)</text></g><path d="M762 109h10"></path><path d="M 772 109 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   450 		<dt id="number-diagram">NUMBER</dt>
   451 		<dd><svg class="railroad-diagram" width="713" height="179"><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 60h0"></path><path d="M108 60h0"></path><path d="M40 60a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M60 40h0"></path><path d="M88 40h0"></path><rect x="60" y="29" width="28" height="22" rx="10" ry="10"></rect><text x="74" y="44">+</text></g><path d="M88 40a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M40 60h20"></path><g><path d="M60 60h28"></path></g><path d="M88 60h20"></path><path d="M40 60a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M60 80h0"></path><path d="M88 80h0"></path><rect x="60" y="69" width="28" height="22" rx="10" ry="10"></rect><text x="74" y="84">-</text></g><path d="M88 80a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g><g><path d="M108 60h0"></path><path d="M396 60h0"></path><path d="M108 60h20"></path><g><path d="M128 60h0"></path><path d="M376 60h0"></path><path d="M128 60h10"></path><g><path d="M138 60h0"></path><path d="M218 60h0"></path><path d="M138 60h10"></path><g><path d="M148 60h0"></path><path d="M208 60h0"></path><rect x="148" y="49" width="60" height="22"></rect><text x="178" y="64">digit</text></g><path d="M208 60h10"></path><path d="M148 60a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M148 80h60"></path></g><path d="M208 80a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M218 60h10"></path><path d="M228 60h10"></path><g><path d="M238 60h0"></path><path d="M266 60h0"></path><rect x="238" y="49" width="28" height="22" rx="10" ry="10"></rect><text x="252" y="64">.</text></g><path d="M266 60h10"></path><path d="M276 60h10"></path><g><path d="M286 60h0"></path><path d="M366 60h0"></path><path d="M286 60h10"></path><g><path d="M296 60h0"></path><path d="M356 60h0"></path><rect x="296" y="49" width="60" height="22"></rect><text x="326" y="64">digit</text></g><path d="M356 60h10"></path><path d="M296 60a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M296 80h60"></path></g><path d="M356 80a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M366 60h10"></path></g><path d="M376 60h20"></path><path d="M108 60a10 10 0 0 1 10 10v19a10 10 0 0 0 10 10"></path><g><path d="M128 99h84"></path><path d="M292 99h84"></path><path d="M212 99h10"></path><g><path d="M222 99h0"></path><path d="M282 99h0"></path><rect x="222" y="88" width="60" height="22"></rect><text x="252" y="103">digit</text></g><path d="M282 99h10"></path><path d="M222 99a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M222 119h60"></path></g><path d="M282 119a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M376 99a10 10 0 0 0 10 -10v-19a10 10 0 0 1 10 -10"></path><path d="M108 60a10 10 0 0 1 10 10v58a10 10 0 0 0 10 10"></path><g><path d="M128 138h50"></path><path d="M326 138h50"></path><path d="M178 138h10"></path><g><path d="M188 138h0"></path><path d="M216 138h0"></path><rect x="188" y="127" width="28" height="22" rx="10" ry="10"></rect><text x="202" y="142">.</text></g><path d="M216 138h10"></path><path d="M226 138h10"></path><g><path d="M236 138h0"></path><path d="M316 138h0"></path><path d="M236 138h10"></path><g><path d="M246 138h0"></path><path d="M306 138h0"></path><rect x="246" y="127" width="60" height="22"></rect><text x="276" y="142">digit</text></g><path d="M306 138h10"></path><path d="M246 138a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M246 158h60"></path></g><path d="M306 158a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M316 138h10"></path></g><path d="M376 138a10 10 0 0 0 10 -10v-58a10 10 0 0 1 10 -10"></path></g><g><path d="M396 60h0"></path><path d="M672 60h0"></path><path d="M396 60h20"></path><g><path d="M416 60h236"></path></g><path d="M652 60h20"></path><path d="M396 60a10 10 0 0 1 10 10v28a10 10 0 0 0 10 10"></path><g><path d="M416 108h0"></path><path d="M652 108h0"></path><g><path d="M416 108h0"></path><path d="M484 108h0"></path><path d="M416 108h20"></path><g><path d="M436 108h0"></path><path d="M464 108h0"></path><rect x="436" y="97" width="28" height="22" rx="10" ry="10"></rect><text x="450" y="112">e</text></g><path d="M464 108h20"></path><path d="M416 108a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M436 138h0"></path><path d="M464 138h0"></path><rect x="436" y="127" width="28" height="22" rx="10" ry="10"></rect><text x="450" y="142">E</text></g><path d="M464 138a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><g><path d="M484 108h0"></path><path d="M552 108h0"></path><path d="M484 108a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M504 88h0"></path><path d="M532 88h0"></path><rect x="504" y="77" width="28" height="22" rx="10" ry="10"></rect><text x="518" y="92">+</text></g><path d="M532 88a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M484 108h20"></path><g><path d="M504 108h28"></path></g><path d="M532 108h20"></path><path d="M484 108a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><g><path d="M504 128h0"></path><path d="M532 128h0"></path><rect x="504" y="117" width="28" height="22" rx="10" ry="10"></rect><text x="518" y="132">-</text></g><path d="M532 128a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path></g><path d="M552 108h10"></path><g><path d="M562 108h0"></path><path d="M642 108h0"></path><path d="M562 108h10"></path><g><path d="M572 108h0"></path><path d="M632 108h0"></path><rect x="572" y="97" width="60" height="22"></rect><text x="602" y="112">digit</text></g><path d="M632 108h10"></path><path d="M572 108a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M572 128h60"></path></g><path d="M632 128a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M642 108h10"></path></g><path d="M652 108a10 10 0 0 0 10 -10v-28a10 10 0 0 1 10 -10"></path></g><path d="M 672 60 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   453 		<dt id="dimension-diagram">DIMENSION</dt>
   454 		<dd><svg class="railroad-diagram" width="249" height="62"><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"></path><path d="M118 31h0"></path><rect x="50" y="20" width="68" height="22"></rect><text x="84" y="35">NUMBER</text></g><path d="M118 31h10"></path><path d="M128 31h10"></path><g><path d="M138 31h0"></path><path d="M198 31h0"></path><rect x="138" y="20" width="60" height="22"></rect><text x="168" y="35">IDENT</text></g><path d="M198 31h10"></path><path d="M 208 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   456 		<dt id="percentage-diagram">PERCENTAGE</dt>
   457 		<dd><svg class="railroad-diagram" width="217" height="62"><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"></path><path d="M118 31h0"></path><rect x="50" y="20" width="68" height="22"></rect><text x="84" y="35">NUMBER</text></g><path d="M118 31h10"></path><path d="M128 31h10"></path><g><path d="M138 31h0"></path><path d="M166 31h0"></path><rect x="138" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="152" y="35">%</text></g><path d="M166 31h10"></path><path d="M 176 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   459 		<dt id="unicode-range-diagram">UNICODE-RANGE</dt>
   460 		<dd><svg class="railroad-diagram" width="600" height="222"><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"></path><path d="M108 31h0"></path><path d="M40 31h20"></path><g><path d="M60 31h0"></path><path d="M88 31h0"></path><rect x="60" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="74" y="35">U</text></g><path d="M88 31h20"></path><path d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path><g><path d="M60 61h0"></path><path d="M88 61h0"></path><rect x="60" y="50" width="28" height="22" rx="10" ry="10"></rect><text x="74" y="65">u</text></g><path d="M88 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path></g><path d="M108 31h10"></path><g><path d="M118 31h0"></path><path d="M146 31h0"></path><rect x="118" y="20" width="28" height="22" rx="10" ry="10"></rect><text x="132" y="35">+</text></g><path d="M146 31h10"></path><g><path d="M156 31h0"></path><path d="M559 31h0"></path><path d="M156 31h20"></path><g><path d="M176 31h115.5"></path><path d="M423.5 31h115.5"></path><path d="M291.5 31h10"></path><g><path d="M301.5 31h0"></path><path d="M413.5 31h0"></path><path d="M301.5 31h10"></path><g><path d="M311.5 31h0"></path><path d="M403.5 31h0"></path><rect x="311.5" y="20" width="92" height="22"></rect><text x="357.5" y="35">hex digit</text></g><path d="M403.5 31h10"></path><path d="M311.5 31a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path><g><path d="M311.5 61h9.5"></path><path d="M394 61h9.5"></path><text x="357.5" y="66" class="comment">1-6 times</text></g><path d="M403.5 61a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path></g><path d="M413.5 31h10"></path></g><path d="M539 31h20"></path><path d="M156 31a10 10 0 0 1 10 10v50a10 10 0 0 0 10 10"></path><g><path d="M176 101h0"></path><path d="M539 101h0"></path><g><path d="M176 101h0"></path><path d="M328 101h0"></path><path d="M176 101a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M196 81h112"></path></g><path d="M308 81a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M176 101h20"></path><g><path d="M196 101h0"></path><path d="M308 101h0"></path><path d="M196 101h10"></path><g><path d="M206 101h0"></path><path d="M298 101h0"></path><rect x="206" y="90" width="92" height="22"></rect><text x="252" y="105">hex digit</text></g><path d="M298 101h10"></path><path d="M206 101a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path><g><path d="M206 131h9.5"></path><path d="M288.5 131h9.5"></path><text x="252" y="136" class="comment">1-5 times</text></g><path d="M298 131a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path></g><path d="M308 101h20"></path></g><path d="M328 101h10"></path><g><path d="M338 101h0"></path><path d="M529 101h0"></path><path d="M338 101h10"></path><g><path d="M348 101h71.5"></path><path d="M447.5 101h71.5"></path><rect x="419.5" y="90" width="28" height="22" rx="10" ry="10"></rect><text x="433.5" y="105">?</text></g><path d="M519 101h10"></path><path d="M348 101a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path><g><path d="M348 131h0"></path><path d="M519 131h0"></path><text x="433.5" y="136" class="comment">1 to (6 - digits) times</text></g><path d="M519 131a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path></g><path d="M529 101h10"></path></g><path d="M539 101a10 10 0 0 0 10 -10v-50a10 10 0 0 1 10 -10"></path><path d="M156 31a10 10 0 0 1 10 10v110a10 10 0 0 0 10 10"></path><g><path d="M176 161h25.5"></path><path d="M513.5 161h25.5"></path><path d="M201.5 161h10"></path><g><path d="M211.5 161h0"></path><path d="M323.5 161h0"></path><path d="M211.5 161h10"></path><g><path d="M221.5 161h0"></path><path d="M313.5 161h0"></path><rect x="221.5" y="150" width="92" height="22"></rect><text x="267.5" y="165">hex digit</text></g><path d="M313.5 161h10"></path><path d="M221.5 161a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path><g><path d="M221.5 191h9.5"></path><path d="M304 191h9.5"></path><text x="267.5" y="196" class="comment">1-6 times</text></g><path d="M313.5 191a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path></g><path d="M323.5 161h10"></path><path d="M333.5 161h10"></path><g><path d="M343.5 161h0"></path><path d="M371.5 161h0"></path><rect x="343.5" y="150" width="28" height="22" rx="10" ry="10"></rect><text x="357.5" y="165">-</text></g><path d="M371.5 161h10"></path><path d="M381.5 161h10"></path><g><path d="M391.5 161h0"></path><path d="M503.5 161h0"></path><path d="M391.5 161h10"></path><g><path d="M401.5 161h0"></path><path d="M493.5 161h0"></path><rect x="401.5" y="150" width="92" height="22"></rect><text x="447.5" y="165">hex digit</text></g><path d="M493.5 161h10"></path><path d="M401.5 161a10 10 0 0 0 -10 10v10a10 10 0 0 0 10 10"></path><g><path d="M401.5 191h9.5"></path><path d="M484 191h9.5"></path><text x="447.5" y="196" class="comment">1-6 times</text></g><path d="M493.5 191a10 10 0 0 0 10 -10v-10a10 10 0 0 0 -10 -10"></path></g><path d="M503.5 161h10"></path></g><path d="M539 161a10 10 0 0 0 10 -10v-110a10 10 0 0 1 10 -10"></path></g><path d="M 559 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   462 		<dt id="comment-diagram">COMMENT</dt>
   463 		<dd><svg class="railroad-diagram" width="497" height="81"><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"></path><path d="M86 41h0"></path><rect x="50" y="30" width="36" height="22" rx="10" ry="10"></rect><text x="68" y="45">/*</text></g><path d="M86 41h10"></path><g><path d="M96 41h0"></path><path d="M400 41h0"></path><path d="M96 41a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path><g><path d="M116 21h264"></path></g><path d="M380 21a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path><path d="M96 41h20"></path><g><path d="M116 41h0"></path><path d="M380 41h0"></path><path d="M116 41h10"></path><g><path d="M126 41h0"></path><path d="M370 41h0"></path><rect x="126" y="30" width="244" height="22"></rect><text x="248" y="45">anything but * followed by /</text></g><path d="M370 41h10"></path><path d="M126 41a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path><g><path d="M126 61h244"></path></g><path d="M370 61a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path></g><path d="M380 41h20"></path></g><path d="M400 41h10"></path><g><path d="M410 41h0"></path><path d="M446 41h0"></path><rect x="410" y="30" width="36" height="22" rx="10" ry="10"></rect><text x="428" 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></dd>
   465 		<dt id="cdo-diagram">CDO</dt>
   466 		<dd><svg class="railroad-diagram" width="153" height="62"><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"></path><path d="M102 31h0"></path><rect x="50" y="20" width="52" height="22" rx="10" ry="10"></rect><text x="76" y="35">&lt;!--</text></g><path d="M102 31h10"></path><path d="M 112 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   468 		<dt id="cdc-diagram">CDC</dt>
   469 		<dd><svg class="railroad-diagram" width="145" height="62"><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"></path><path d="M94 31h0"></path><rect x="50" y="20" width="44" height="22" rx="10" ry="10"></rect><text x="72" y="35">--&gt;</text></g><path d="M94 31h10"></path><path d="M 104 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path></g></svg></dd>
   471 	</dl>
   473 <h3>
   474 Tokenizer Flags</h3>
   476 	<p>
   477 		The tokenizer can be run with any of several flags that alter its behavior.
   479 	<dl>
   480 		<dt>the <dfn>transform function whitespace</dfn> flag
   481 		<dd>
   482 			This flag is set when parsing SVG's <code>transform</code> attribute.
   483 			When this is set, whitespace is allowed between the name of a transform function and its opening parenthesis.
   484 	</dl>
   486 <h3>
   487 Definitions</h3>
   489 	<p>
   490 		This section defines several terms used during the tokenization phase.
   492 	<dl>
   493 		<dt><dfn>digit</dfn>
   494 		<dd>
   495 			A character between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9).
   497 		<dt><dfn>hex digit</dfn>
   498 		<dd>
   499 			A <i>digit</i>,
   500 			or a character between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F),
   501 			or a character between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f).
   503 		<dt><dfn>uppercase letter</dfn>
   504 		<dd>
   505 			A character between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z).
   507 		<dt><dfn>lowercase letter</dfn>
   508 		<dd>
   509 			A character between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z).
   511 		<dt><dfn>letter</dfn>
   512 		<dd>
   513 			An <i>uppercase letter</i>
   514 			or a <i>lowercase letter</i>.
   516 		<dt><dfn>non-ASCII character</dfn>
   517 		<dd>
   518 			A character with a codepoint equal to or greater than U+0080 &lt;control>.
   520 		<dt><dfn>name-start character</dfn>
   521 		<dd>
   522 			A <i>letter</i>,
   523 			a <i>non-ASCII character</i>,
   524 			or U+005F LOW LINE (_).
   526 		<dt><dfn>name character</dfn>
   527 		<dd>
   528 			A <i>name-start character</i>,
   529 			A <i>digit</i>,
   530 			or U+002D HYPHEN-MINUS (-).
   532 		<dt><dfn>non-printable character</dfn>
   533 		<dd>
   534 			A character between U+0000 NULL and U+0008 BACKSPACE
   535 			or a character between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE
   536 			or a character between U+007F DELETE and U+009F APPLICATION PROGRAM COMMAND.
   538 		<dt><dfn>newline</dfn>
   539 		<dd>
   540 			U+000A LINE FEED or U+000C FORM FEED.
   541 			<span class='note'>
   542 				Note that U+000D CARRIAGE RETURN is not included in this definition,
   543 				as it is removed from the stream during preprocessing.
   544 			</span>
   546 		<dt><dfn>whitespace</dfn>
   547 		<dd>A <i>newline</i>, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
   549 		<dt><dfn>maximum allowed codepoint</dfn>
   550 		<dd>The greatest codepoint defined by Unicode.  This is currently U+10FFFF.
   552 	</dl>
   554 <h3>
   555 Tokenizer State Machine</h3>
   557 <h4>
   558 <dfn>Data state</dfn></h4>
   560 	<p>
   561 		Consume the <i>next input character</i>.
   563 	<dl>
   564 		<dt><i>whitespace</i>
   565 		<dd>
   566 			Consume as much <i>whitespace</i> as possible.
   567 			Emit a whitespace token.
   568 			Remain in this state.
   570 		<dt>U+0022 QUOTATION MARK (")
   571 		<dd>
   572 			Switch to the <i>double-quote-string state</i>.
   574 		<dt>U+0023 NUMBER SIGN (#)
   575 		<dd>
   576 			Switch to the <i>hash state</i>.
   578 		<dt>U+0024 DOLLAR SIGN ($)
   579 		<dd>
   580 			If the <i>next input character</i> is
   581 			U+003D EQUALS SIGN (=),
   582 			consume it
   583 			and emit a suffix-match token.
   584 			Remain in this state.
   586 			<p>
   587 				Otherwise,
   588 				emit a delim token
   589 				with its value set to the <i>current input character</i>.
   590 				Remain in this state.
   592 		<dt>U+0027 APOSTROPHE (&apos;)
   593 		<dd>
   594 			Switch to the <i>single-quote-string state</i>.
   596 		<dt>U+0028 LEFT PARENTHESIS (()
   597 		<dd>
   598 			Emit a ( token.
   599 			Remain in this state.
   601 		<dt>U+0029 RIGHT PARENTHESIS ())
   602 		<dd>
   603 			Emit a ) token.
   604 			Remain in this state.
   606 		<dt>U+002A ASTERISK (*)
   607 		<dd>
   608 			If the <i>next input character</i> is
   609 			U+003D EQUALS SIGN (=),
   610 			consume it
   611 			and emit a substring-match token.
   612 			Remain in this state.
   614 			<p>
   615 				Otherwise,
   616 				emit a delim token
   617 				with its value set to the <i>current input character</i>.
   618 				Remain in this state.
   620 		<dt>U+002B PLUS SIGN (+)
   621 		<dd>
   622 			If the <i>next input character</i> is
   623 			a <i>digit</i>,
   624 			or the <i title="next input character">next 2 input characters</i> are
   625 			U+002E FULL STOP (.)
   626 			followed by a <i>digit</i>,
   627 			switch to the <i>number state</i>.
   628 			Reconsume the <i>current input character</i>.
   630 			<p>
   631 				Otherwise,
   632 				emit a delim token
   633 				with its value set to U+002B PLUS SIGN (+).
   634 				Remain in this state.
   636 		<dt>U+002C COMMA (,)
   637 		<dd>
   638 			Emit a comma token.
   639 			Remain in this state.
   641 		<dt>U+002D HYPHEN-MINUS (-)
   642 		<dd>
   643 			If the <i title="next input character">next 2 input characters</i> are
   644 			U+002D HYPHEN-MINUS
   645 			U+003E GREATER-THAN SIGN
   646 			(->),
   647 			consume them,
   648 			emit a CDC token,
   649 			and remain in this state.
   651 			<p>
   652 				Otherwise,
   653 				if the <i>next input character</i> is a <i>digit</i>,
   654 				or the <i title="next input character">next 2 input characters</i> are
   655 				U+002E FULL STOP (.)
   656 				followed by a <i>digit</i>,
   657 				switch to the <i>number state</i>.
   658 				Reconsume the <i>current input character</i>.
   660 			<p>
   661 				Otherwise,
   662 				switch to the <i>ident state</i>.
   663 				Reconsume the <i>current input character</i>.
   665 		<dt>U+002E FULL STOP (.)
   666 		<dd>
   667 			If the <i>next input character</i> is a <i>digit</i>,
   668 			switch to the <i>number state</i>.
   669 			Reconsume the <i>current input character</i>.
   671 			<p>
   672 				Otherwise,
   673 				emit a delim token
   674 				with its value set to U+002E FULL STOP (.).
   675 				Remain in this state.
   677 		<dt>U+002F SOLIDUS (/)
   678 		<dd>
   679 			If the <i>next input character</i> is U+002A ASTERISK (*),
   680 			consume it
   681 			and switch to the <i>comment state</i>.
   683 			<p>
   684 				Otherwise,
   685 				emit a delim token
   686 				with its value set to U+002F SOLIDUS (/).
   687 				Remain in this state.
   689 		<dt>U+003A COLON (:)
   690 		<dd>
   691 			Emit a colon token.
   692 			Remain in this state.
   694 		<dt>U+003B SEMICOLON (;)
   695 		<dd>
   696 			Emit a semicolon token.
   697 			Remain in this state.
   699 		<dt>U+003C LESS-THAN SIGN (&lt;)
   700 		<dd>
   701 			If the <i title="next input character">next 3 input characters</i> are
   702 			U+0021 EXCLAMATION MARK
   703 			U+002D HYPHEN-MINUS
   704 			U+002D HYPHEN-MINUS
   705 			(!--),
   706 			consume them
   707 			and emit a cdo token.
   708 			Remain in this state.
   710 			<p>
   711 				Otherwise,
   712 				emit a delim token
   713 				with its value set to U+003C LESS-THAN SIGN (&lt;).
   714 				Remain in this state.
   716 		<dt>U+0040 COMMERCIAL AT (@)
   717 		<dd>
   718 			Switch to the <i>at-keyword state</i>.
   720 		<dt>U+005B LEFT SQUARE BRACKET ([)
   721 		<dd>
   722 			Emit a [ token.
   723 			Remain in this state.
   725 		<dt>U+005C REVERSE SOLIDUS (\)
   726 		<dd>
   727 			If the <i>next input character</i> is
   728 			a <i>newline</i>
   729 			or EOF,
   730 			this is a <i>parse error</i>.
   731 			Emit a delim token
   732 			with its value set to U+005C REVERSE SOLIDUS (\).
   733 			Remain in this state.
   735 			<p>
   736 				Otherwise, switch to the <i>ident state</i>.
   737 				Reconsume the <i>current input character</i>.
   739 		<dt>U+005D RIGHT SQUARE BRACKET (])
   740 		<dd>
   741 			Emit a ] token.
   742 			Remain in this state.
   744 		<dt>U+005E CIRCUMFLEX ACCENT (^)
   745 		<dd>
   746 			If the <i>next input character</i> is
   747 			U+003D EQUALS SIGN (=),
   748 			consume it
   749 			and emit a prefix-match token.
   750 			Remain in this state.
   752 			<p>
   753 				Otherwise,
   754 				emit a delim token
   755 				with its value set to the <i>current input character</i>.
   756 				Remain in this state.
   758 		<dt>U+007B LEFT CURLY BRACKET ({)
   759 		<dd>
   760 			Emit a { token.
   761 			Remain in this state.
   763 		<dt>U+007D RIGHT CURLY BRACKET (})
   764 		<dd>
   765 			Emit a } token.
   766 			Remain in this state.
   768 		<dt><i>digit</i>
   769 		<dd>
   770 			Switch to the <i>number state</i>.
   771 			Reconsume the <i>current input character</i>.
   773 		<dt>U+0055 LATIN CAPITAL LETTER U (U)
   774 		<dt>U+0075 LATIN SMALL LETTER U (u)
   775 		<dd>
   776 			If the <i title="next input character">next 2 input character</i> are
   777 			U+002B PLUS SIGN (+)
   778 			followed by a <i>hex digit</i>
   779 			or U+003F QUESTION MARK (?),
   780 			consume the <i>next input character</i>.
   781 			<span class='note'>Note: don't consume both of them.</span>
   782 			Switch to the <i>unicode-range state</i>.
   784 			<p>Otherwise,
   785 				switch to the <i>ident state</i>.
   786 				Reconsume the <i>current input character</i>.
   788 		<dt><i>name-start character</i>
   789 		<dd>
   790 			Switch to the <i>ident state</i>.
   791 			Reconsume the <i>current input character</i>.
   793 		<dt>U+007C VERTICAL LINE (|)
   794 		<dd>
   795 			If the <i>next input character</i> is
   796 			U+003D EQUALS SIGN (=),
   797 			consume it
   798 			and emit a dash-match token.
   799 			Remain in this state.
   801 			<p>
   802 				Otherwise,
   803 				emit a delim token
   804 				with its value set to the <i>current input character</i>.
   805 				Remain in this state.
   807 		<dt>U+007E TILDE (~)
   808 		<dd>
   809 			If the <i>next input character</i> is
   810 			U+003D EQUALS SIGN (=),
   811 			consume it
   812 			and emit an includes-match token.
   813 			Remain in this state.
   815 			<p>
   816 				Otherwise,
   817 				emit a delim token
   818 				with its value set to the <i>current input character</i>.
   819 				Remain in this state.
   821 		<dt>EOF
   822 		<dd>
   823 			Emit an end-of-file token.
   825 		<dt>anything else
   826 		<dd>
   827 			Emit a delim token
   828 			with its value set to the <i>current input character</i>.
   829 			Remain in this state.
   830 	</dl>
   832 <h4>
   833 <dfn>Double-quote-string state</dfn></h4>
   835 	<p>
   836 		If a string token has not yet been created since entering this state,
   837 		create a string token
   838 		with its value initially set to the empty string.
   840 	<p>
   841 		Consume the <i>next input character</i>.
   843 	<dl>
   844 		<dt>U+0022 QUOTATION MARK (")
   845 		<dd>
   846 			Emit the string token.
   847 			Return to the <i>data state</i>.
   849 		<dt>EOF
   850 		<dd>
   851 			This is a <i>parse error</i>.
   852 			Emit the string token.
   853 			Switch to the <i>data state</i>.
   854 			Reconsume the <i>current input character</i>.
   856 		<dt><i>newline</i>
   857 		<dd>
   858 			This is a <i>parse error</i>.
   859 			Emit a bad-string token.
   860 			Switch to the <i>data state</i>.
   861 			Reconsume the <i>current input character</i>.
   863 		<dt>U+005C REVERSE SOLIDUS (\)
   864 		<dd>
   865 			If the <i>next input character</i>
   866 			is an EOF,
   867 			this is a <i>parse error</i>.
   868 			Emit a bad-string token,
   869 			then switch to the <i>data state</i>.
   871 			<p>
   872 				Otherwise,
   873 				if the <i>next input character</i> is
   874 				a <i>newline</i>,
   875 				consume it.
   876 				Remain in this state.
   878 			<p>
   879 				Otherwise,
   880 				<i>consume an escaped character</i>.
   881 				Append the returned character to the string token's value.
   882 				Remain in this state.
   884 		<dt>anything else
   885 		<dd>
   886 			Append the <i>current input character</i>
   887 			to the string token's value.
   888 			Remain in this state.
   889 	</dl>
   891 <h4>
   892 <dfn>Single-quote-string state</dfn></h4>
   894 	<p>
   895 		If a string token has not yet been created since entering this state,
   896 		create a string token
   897 		with its value initially set to the empty string.
   899 	<p>
   900 		Consume the <i>next input character</i>.
   902 	<dl>
   903 		<dt>U+0027 APOSTROPHE (&apos;)
   904 		<dd>
   905 			Emit the string token.
   906 			Return to the <i>data state</i>.
   908 		<dt>EOF
   909 		<dd>
   910 			This is a <i>parse error</i>.
   911 			Emit the string token.
   912 			Switch to the <i>data state</i>.
   913 			Reconsume the <i>current input character</i>.
   915 		<dt><i>newline</i>
   916 		<dd>
   917 			This is a <i>parse error</i>.
   918 			Emit a bad-string token.
   919 			Switch to the <i>data state</i>.
   920 			Reconsume the <i>current input character</i>.
   922 		<dt>U+005C REVERSE SOLIDUS (\)
   923 		<dd>
   924 			If the <i>next input character</i>
   925 			is an EOF,
   926 			this is a <i>parse error</i>.
   927 			Emit a bad-string token,
   928 			then switch to the <i>data state</i>.
   930 			<p>
   931 				Otherwise,
   932 				if the <i>next input character</i> is
   933 				a <i>newline</i>,
   934 				consume it.
   935 				Remain in this state.
   937 			<p>
   938 				Otherwise,
   939 				<i>consume an escaped character</i>.
   940 				Append the returned character to the string token's value.
   941 				Remain in this state.
   943 		<dt>anything else
   944 		<dd>
   945 			Append the <i>current input character</i>
   946 			to the string token's value.
   947 			Remain in this state.
   948 	</dl>
   950 <h4>
   951 <dfn>Hash state</dfn></h4>
   953 	<p>
   954 		Consume the <i>next input character</i>.
   956 	<dl>
   957 		<dt><i>name character</i>
   958 		<dd>
   959 			Create a hash token
   960 			with its value set to the <i>current input character</i>.
   961 			Switch to the <i>hash-rest state</i>.
   963 		<dt>U+005C REVERSE SOLIDUS (\)
   964 		<dd>
   965 			If the <i>next input character</i> is
   966 			a <i>newline</i> or EOF,
   967 			emit a delim token
   968 			with its value set to U+0023 NUMBER SIGN (#).
   969 			Switch to the <i>data state</i>.
   970 			Reconsume the <i>current input character</i>.
   972 			<p>
   973 				Otherwise,
   974 				<i>consume an escaped character</i>.
   975 				Create a hash token
   976 				with its value set to the returned character.
   977 				Switch to the <i>hash-rest state</i>.
   979 		<dt>anything else
   980 		<dd>
   981 			Emit a delim token
   982 			with its value set to U+0023 NUMBER SIGN (#).
   983 			Switch to the <i>data state</i>.
   984 			Reconsume the <i>current input character</i>.
   985 	</dl>
   987 <h4>
   988 <dfn>Hash-rest state</dfn></h4>
   990 	<p>
   991 		Consume the <i>next input character</i>.
   993 	<dl>
   994 		<dt><i>name character</i>
   995 		<dd>
   996 			Append the <i>current input character</i>
   997 			to the hash token's value.
   998 			Remain in this state.
  1000 		<dt>U+005C REVERSE SOLIDUS (\)
  1001 		<dd>
  1002 			If the <i>next input character</i> is
  1003 			a <i>newline</i> or EOF,
  1004 			emit the hash token.
  1005 			Switch to the <i>data state</i>.
  1006 			Reconsume the <i>current input character</i>.
  1008 			<p>
  1009 				Otherwise,
  1010 				<i>consume an escaped character</i>.
  1011 				Append the returned character to the hash token's value.
  1012 				Remain in this state.
  1014 		<dt>anything else
  1015 		<dd>
  1016 			Emit the hash token.
  1017 			Switch to the <i>data state</i>.
  1018 			Reconsume the <i>current input character</i>.
  1019 	</dl>
  1021 <h4>
  1022 <dfn>Comment state</dfn></h4>
  1024 	<p>
  1025 		Consume the <i>next input character</i>.
  1027 	<dl>
  1028 		<dt>U+002A ASTERISK (*)
  1029 		<dd>
  1030 			If the <i>next input character</i> is
  1031 			U+002F SOLIDUS (/),
  1032 			consume it,
  1033 			and switch to the <i>data state</i>.
  1035 			<p>
  1036 				Otherwise,
  1037 				do nothing
  1038 				and remain in this state.
  1040 		<dt>EOF
  1041 		<dd>
  1042 			This is a <i>parse error</i>.
  1043 			Switch to the <i>data state</i>.
  1044 			Reconsume the <i>current input character</i>.
  1046 		<dt>anything else
  1047 		<dd>
  1048 			Do nothing
  1049 			and remain in this state.
  1050 	</dl>
  1052 <h4>
  1053 <dfn>At-keyword state</dfn></h4>
  1055 	<p>
  1056 		Consume the <i>next input character</i>.
  1058 	<dl>
  1059 		<dt>U+002D HYPHEN-MINUS (-)
  1060 		<dd>
  1061 			If the <i>next input character</i> is a <i>name-start character</i>,
  1062 			Create an at-keyword token
  1063 			with its value initially set to U+002D HYPHEN-MINUS.
  1064 			Switch to the <i>at-keyword-rest state</i>.
  1066 			<p>
  1067 				Otherwise,
  1068 				if the <i title="next input character">next two characters</i> are
  1069 				U+005C REVERSE SOLIDUS (\)
  1070 				followed by anything but
  1071 				a <i>newline</i>
  1072 				or EOF,
  1073 				create an at-keyword token
  1074 				with its value initially set to U+002D HYPHEN-MINUS.
  1075 				Switch to the <i>at-keyword-rest state</i>.
  1077 			<p>
  1078 				Otherwise,
  1079 				emit a delim token
  1080 				with its value set to U+0040 COMMERCIAL AT (@).
  1081 				Switch to the <i>data state</i>.
  1082 				Reconsume the <i>current input character</i>.
  1084 		<dt><i>name-start character</i>
  1085 		<dd>
  1086 			Create an at-keyword token
  1087 			with its value set to the <i>current input character</i>.
  1088 			Switch to the <i>at-keyword-rest state</i>.
  1090 		<dt>U+005C REVERSE SOLIDUS (\)
  1091 		<dd>
  1092 			If the <i>next input character</i> is
  1093 			a <i>newline</i> or EOF,
  1094 			emit a delim token
  1095 			with its value set to U+0040 COMMERCIAL AT (@).
  1096 			Switch to the <i>data state</i>.
  1097 			Reconsume the <i>current input character</i>.
  1099 			<p>
  1100 				Otherwise,
  1101 				<i>consume an escaped character</i>.
  1102 				Create an at-keyword token
  1103 				with its value set to the returned character.
  1104 				Switch to the <i>at-keyword-rest state</i>.
  1106 		<dt>anything else
  1107 		<dd>
  1108 			Emit a delim token
  1109 			with its value set to U+0040 COMMERCIAL AT (@).
  1110 			Switch to the <i>data state</i>.
  1111 			Reconsume the <i>current input character</i>.
  1112 	</dl>
  1114 <h4>
  1115 <dfn>At-keyword-rest state</dfn></h4>
  1117 	<p>
  1118 		Consume the <i>next input character</i>.
  1120 	<dl>
  1121 		<dt><i>name character</i>
  1122 		<dd>
  1123 			Append the <i>current input character</i>
  1124 			to the at-keyword token's value.
  1125 			Remain in this state.
  1127 		<dt>U+005C REVERSE SOLIDUS (\)
  1128 		<dd>
  1129 			If the <i>next input character</i> is
  1130 			a <i>newline</i> or EOF,
  1131 			emit the at-keyword token.
  1132 			Switch to the <i>data state</i>.
  1133 			Reconsume the <i>current input character</i>.
  1135 			<p>
  1136 				Otherwise,
  1137 				<i>consume an escaped character</i>.
  1138 				Append the returned character to the at-keyword token's value.
  1139 				Remain in this state.
  1141 		<dt>anything else
  1142 		<dd>
  1143 			Emit the at-keyword token.
  1144 			Switch to the <i>data state</i>.
  1145 			Reconsume the <i>current input character</i>.
  1146 	</dl>
  1148 <h4>
  1149 <dfn>Ident state</dfn></h4>
  1151 	<p>
  1152 		Consume the <i>next input character</i>.
  1154 	<dl>
  1155 		<dt>U+002D HYPHEN-MINUS (-)
  1156 		<dd>
  1157 			If the <i>next input character</i> is
  1158 			a <i>name-start character</i>,
  1159 			create an identifer token
  1160 			with its value initially set to U+002D HYPHEN-MINUS.
  1161 			Switch to the <i>ident-rest state</i>.
  1163 			<p>
  1164 				Otherwise,
  1165 				if the <i title="next input character">next two characters</i> are
  1166 				U+005C REVERSE SOLIDUS (\)
  1167 				followed by anything but
  1168 				a <i>newline</i>
  1169 				or EOF,
  1170 				create an identifer token
  1171 				with its value initially set to U+002D HYPHEN-MINUS.
  1172 				Switch to the <i>ident-rest state</i>.
  1174 			<p>
  1175 				Otherwise,
  1176 				emit a delim token
  1177 				with its value set to U+002D HYPHEN-MINUS (-).
  1178 				Switch to the <i>data state</i>.
  1180 		<dt><i>name-start character</i>
  1181 		<dd>
  1182 			Create an ident token
  1183 			with its value set to the <i>current input character</i>.
  1184 			Switch to the <i>ident-rest state</i>.
  1186 		<dt>U+005C REVERSE SOLIDUS (\)
  1187 		<dd>
  1188 			If the <i>next input character</i> is
  1189 			a <i>newline</i> or EOF,
  1190 			switch to the <i>data state</i>.
  1191 			Reconsume the <i>current input character</i>.
  1193 			<p>
  1194 				Otherwise,
  1195 				<i>consume an escaped character</i>.
  1196 				Create an ident token
  1197 				with its value set to the returned character.
  1198 				Switch to the <i>ident-rest state</i>.
  1200 		<!--
  1201 			This state should only be entered with a valid character.
  1202 			If it hits anything else, this is a spec error.
  1203 		-->
  1205 	</dl>
  1207 <h4>
  1208 <dfn>Ident-rest state</dfn></h4>
  1210 	<p>
  1211 		Consume the <i>next input character</i>.
  1213 	<dl>
  1214 		<dt><i>name character</i>
  1215 		<dd>
  1216 			Append the <i>current input character</i>
  1217 			to the ident token's value.
  1218 			Remain in this state.
  1220 		<dt>U+005C REVERSE SOLIDUS (\)
  1221 		<dd>
  1222 			If the <i>next input character</i> is
  1223 			a <i>newline</i> or EOF,
  1224 			emit the ident token.
  1225 			Switch to the <i>data state</i>.
  1226 			Reconsume the <i>current input character</i>.
  1228 			<p>
  1229 				Otherwise,
  1230 				<i>consume an escaped character</i>.
  1231 				Append the returned character to the ident token's value.
  1232 				Remain in this state.
  1234 		<dt>U+0028 LEFT PARENTHESIS (()
  1235 		<dd>
  1236 			If the identifier token's value is
  1237 			an <i>ASCII case-insensitive</i> match for "url",
  1238 			switch to the <i>url state</i>.
  1240 			<p>
  1241 				Otherwise,
  1242 				Emit a function token
  1243 				with its value set to the identifier token's value.
  1244 				Switch to the <i>data state</i>.
  1246 		<dt><i>whitespace</i>
  1247 		<dd>
  1248 			If the <i>transform function whitespace</i> flag is set,
  1249 			reconsume the <i>current input character</i>
  1250 			and switch to the <i>transform-function-whitespace state</i>.
  1252 			<p>
  1253 				Otherwise,
  1254 				emit the ident token.
  1255 				Switch to the <i>data state</i>.
  1256 				Reconsume the <i>current input character</i>.
  1258 		<dt>anything else
  1259 		<dd>
  1260 			Emit the ident token.
  1261 			Switch to the <i>data state</i>.
  1262 			Reconsume the <i>current input character</i>.
  1263 	</dl>
  1265 <h4>
  1266 <dfn>Transform-function-whitespace state</dfn></h4>
  1268 	<p>
  1269 		Consume the <i>next input character</i>.
  1271 	<dl>
  1272 		<dt><i>whitespace</i>
  1273 		<dd>
  1274 			If the <i>next input character</i> is <i>whitespace</i>,
  1275 			remain in this state.
  1277 			<p>
  1278 				Otherwise,
  1279 				if the <i>next input character</i> is U+0028 LEFT PARENTHESES ((),
  1280 				emit a function token
  1281 				with its value set to the identifer token's value.
  1282 				Switch to the <i>data state</i>.
  1284 			<p>
  1285 				Otherwise,
  1286 				emit the identifer token.
  1287 				Switch to the <i>data state</i>.
  1288 				Reconsume the <i>current input character</i>.
  1289 	</dl>
  1292 <h4>
  1293 <dfn>Number state</dfn></h4>
  1295 	<p>
  1296 		Create a number token
  1297 		with its representation initially set to the empty string.
  1299 	<p>
  1300 		Consume the <i>next input character</i>.
  1302 	<dl>
  1303 		<dt>U+002D HYPHEN-MINUS (-)
  1304 		<dd>
  1305 			If the <i>next input character</i> is
  1306 			a <i>digit</i>,
  1307 			consume it.
  1308 			Append U+002D HYPHEN-MINUS (-) to the number token's representation.
  1309 			Append the <i>digit</i> to the number token's representation.
  1310 			Switch to the <i>number-rest state</i>.
  1312 			<p>
  1313 				Otherwise,
  1314 				if the <i title="next input character">next 2 input characters</i> are
  1315 				U+002E FULL STOP
  1316 				followed by a <i>digit</i>,
  1317 				consume them.
  1318 				Append U+002D HYPHEN-MINUS (-) to the number token's representation.
  1319 				Append U+002E FULL STOP (.) to the number token's representation.
  1320 				Append the <i>digit</i> to the number token's representation.
  1321 				Switch to the <i>number fraction</i> state.
  1323 			<p>
  1324 				Otherwise,
  1325 				switch to the <i>data state</i>.
  1326 				Reconsume the <i>current input character</i>.
  1328 		<dt>U+002B PLUS SIGN (+)
  1329 		<dd>
  1330 			If the <i>next input character</i> is
  1331 			a <i>digit</i>,
  1332 			consume it.
  1333 			Append U+002D PLUS SIGN (+) to the number token's representation.
  1334 			Append the <i>digit</i> to the number token's representation.
  1335 			Switch to the <i>number-rest state</i>.
  1337 			<p>
  1338 				Otherwise,
  1339 				if the <i title="next input character">next 2 input characters</i> are
  1340 				U+002E FULL STOP
  1341 				followed by a <i>digit</i>,
  1342 				consume them.
  1343 				Append U+002D PLUS SIGN (+) to the number token's representation.
  1344 				Append U+002E FULL STOP (.) to the number token's representation.
  1345 				Append the <i>digit</i> to the number token's representation.
  1346 				Switch to the <i>number fraction</i> state.
  1348 			<p>
  1349 				Otherwise,
  1350 				switch to the <i>data state</i>.
  1351 				Reconsume the <i>current input character</i>.
  1353 		<dt><i>digit</i>
  1354 		<dd>
  1355 			Append the <i>current input character</i>
  1356 			to the number token's representation.
  1357 			Switch to the <i>number-rest state</i>.
  1359 		<dt>U+002E FULL STOP (.)
  1360 		<dd>
  1361 			If the <i>next input character</i> is
  1362 			a <i>digit</i>,
  1363 			consume it.
  1364 			Append U+002E FULL STOP (.) to the number token's representation.
  1365 			Append the <i>digit</i> to the number token's representation.
  1366 			Switch to the <i>number-fraction state</i>.
  1368 			<p>
  1369 				Otherwise,
  1370 				switch to the <i>data state</i>.
  1371 				Reconsume the <i>current input character</i>.
  1373 		<dt>anything else
  1374 		<dd>
  1375 			Switch to the <i>data state</i>.
  1376 			Reconsume the <i>current input character</i>.
  1377 	</dl>
  1379 <h4>
  1380 <dfn>Number-rest state</dfn></h4>
  1382 	<p>
  1383 		Consume the <i>next input character</i>.
  1385 	<dl>
  1386 		<dt><i>digit</i>
  1387 		<dd>
  1388 			Append the <i>current input character</i>
  1389 			to the number token's representation.
  1390 			Remain in this state.
  1392 		<dt>U+002E FULL STOP (.)
  1393 		<dd>
  1394 			If the <i>next input character</i> is
  1395 			a <i>digit</i>,
  1396 			consume it.
  1397 			Append U+002E FULL STOP (.)
  1398 			followed by the <i>digit</i>
  1399 			to the number token's representation.
  1400 			Switch to the <i>number-fraction state</i>.
  1402 			<p>
  1403 				Otherwise,
  1404 				set the number token's value to the number
  1405 				produced by interpreting the number token's representation
  1406 				as a base-10 number
  1407 				and emit it.
  1408 				Switch to the <i>data state</i>.
  1409 				Reconsume the <i>current input character</i>.
  1411 		<dt>U+0025 PERCENT SIGN (%)
  1412 		<dd>
  1413 			Emit a percentage token
  1414 			with its value set to the number
  1415 			produced by interpreting the number token's representation
  1416 			as a base-10 number.
  1417 			Switch to the <i>data state</i>.
  1419 		<dt>U+0045 LATIN CAPITAL LETTER E (E)
  1420 		<dt>U+0065 LATIN SMALL LETTER E (e)
  1421 		<dd>
  1422 			If the <i>next input character</i> is a <i>digit</i>,
  1423 			or the <i title="next input character">next 2 input characters</i>
  1424 			are U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-) followed by a <i>digit</i>,
  1425 			consume them
  1426 			and append them to the number token's representation.
  1427 			Switch to the <i>sci-notation state</i>.
  1429 			<p>
  1430 				Otherwise,
  1431 				create a dimension token
  1432 				with its representation set to the number token's representation,
  1433 				its value set to the number
  1434 				produced by interpreting the number token's representation
  1435 				as a base-10 number,
  1436 				and a unit initially set to the <i>current input character</i>.
  1437 				Switch to the <i>dimension state</i>.
  1439 		<dt>U+002D HYPHEN-MINUS (-)
  1440 		<dd>
  1441 			If the <i>next input character</i> is
  1442 			a <i>name-start character</i>,
  1443 			consume it.
  1444 			Create a dimension token
  1445 			with its representation set to the number token's representation,
  1446 			its value set to the number
  1447 			produced by interpreting the number token's representation
  1448 			as a base-10 number,
  1449 			and a unit initially set to
  1450 			U+002D HYPHEN-MINUS
  1451 			followed by the <i>name-start character</i>.
  1452 			Switch to the <i>dimension state</i>.
  1454 			<p>
  1455 				Otherwise,
  1456 				if the <i title="next input character">next 2 input characters</i> are
  1457 				U+005C REVERSE SOLIDUS (\) followed by a <i>newline</i>,
  1458 				or U+005C REVERSE SOLIDUS (\) followed by EOF,
  1459 				set the number token's value to the number
  1460 				produced by interpreting the number token's representation
  1461 				as a base-10 number
  1462 				and emit it.
  1463 				Switch to the <i>data state</i>.
  1464 				Reconsume the <i>current input character</i>.
  1466 			<p>
  1467 				Otherwise,
  1468 				if the <i>next input character</i> is
  1469 				U+005C REVERSE SOLIDUS (\),
  1470 				consume it,
  1471 				then <i>consume an escaped character</i>.
  1472 				Create a dimension token
  1473 				with its representation set to the number token's representation,
  1474 				its value set to the number
  1475 				produced by interpreting the number token's representation
  1476 				as a base-10 number,
  1477 				and a unit initially set to
  1478 				U+002D HYPHEN-MINUS
  1479 				followed by the returned character.
  1480 				Switch to the <i>dimension state</i>.
  1482 			<p>
  1483 				Otherwise,
  1484 				set the number token's value to the number
  1485 				produced by interpreting the number token's representation
  1486 				as a base-10 number
  1487 				and emit it.
  1488 				Switch to the <i>data state</i>.
  1489 				Reconsume the <i>current input character</i>.
  1491 		<dt><i>name-start character</i>
  1492 		<dd>
  1493 			Create a dimension token
  1494 			with its representation set to the number token's representation,
  1495 			its value set to the number
  1496 			produced by interpreting the number token's representation
  1497 			as a base-10 number,
  1498 			and a unit initially set to the <i>current input character</i>.
  1499 			Switch to the <i>dimension state</i>.
  1501 		<dt>U+005C REVERSE SOLIDUS (\)
  1502 		<dd>
  1503 			If the <i>next input character</i> is
  1504 			a <i>newline</i> or EOF,
  1505 			set the number token's value to the number
  1506 			produced by interpreting the number token's representation
  1507 			as a base-10 number
  1508 			and emit it.
  1509 			Switch to the <i>data state</i>.
  1510 			Reconsume the <i>current input character</i>.
  1512 			<p>
  1513 				Otherwise,
  1514 				<i>consume an escaped character</i>.
  1515 				Create a dimension token
  1516 				with its representation set to the number token's representation,
  1517 				its value set to the number
  1518 				produced by interpreting the number token's representation
  1519 				as a base-10 number,
  1520 				and a unit initially set to the returned character.
  1521 				Switch to the <i>dimension state</i>.
  1523 		<dt>anything else
  1524 		<dd>
  1525 			Emit a number token
  1526 			with its value set to the number
  1527 			produced by interpreting the string token's value
  1528 			as a base-10 number.
  1529 			Switch to the <i>data state</i>.
  1530 			Reconsume the <i>current input character</i>.
  1531 	</dl>
  1533 <h4>
  1534 <dfn>Number-fraction state</dfn></h4>
  1536 	<p>
  1537 		Set the number token's type flag to "number".
  1539 	<p>
  1540 		Consume the <i>next input character</i>.
  1542 	<dl>
  1543 		<dt><i>digit</i>
  1544 		<dd>
  1545 			Append the <i>current input character</i>
  1546 			to the string token's value.
  1547 			Remain in this state.
  1549 		<dt>U+0025 PERCENT SIGN (%)
  1550 		<dd>
  1551 			Emit a percentage token
  1552 			with its value set to the number
  1553 			produced by interpreting the number token's representation
  1554 			as a base-10 number.
  1555 			Switch to the <i>data state</i>.
  1557 		<dt>U+0045 LATIN CAPITAL LETTER E (E)
  1558 		<dt>U+0065 LATIN SMALL LETTER E (e)
  1559 		<dd>
  1560 			If the <i>next input character</i> is a <i>digit</i>,
  1561 			or the <i title="next input character">next 2 input characters</i>
  1562 			are U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-) followed by a <i>digit</i>,
  1563 			consume them
  1564 			and append them to the number token's representation.
  1565 			Switch to the <i>sci-notation state</i>.
  1567 			<p>
  1568 				Otherwise,
  1569 				create a dimension token
  1570 				with its representation set to the number token's representation,
  1571 				its value set to the number
  1572 				produced by interpreting the number token's representation
  1573 				as a base-10 number,
  1574 				and a unit initially set to the <i>current input character</i>.
  1575 				Switch to the <i>dimension state</i>.
  1577 		<dt>U+002D HYPHEN-MINUS (-)
  1578 		<dd>
  1579 			If the <i>next input character</i> is
  1580 			a <i>name-start character</i>,
  1581 			consume it.
  1582 			Create a dimension token
  1583 			with its representation set to the number token's representation,
  1584 			its value set to the number
  1585 			produced by interpreting the number token's representation
  1586 			as a base-10 number,
  1587 			and a unit initially set to
  1588 			U+002D HYPHEN-MINUS
  1589 			followed by the <i>name-start character</i>.
  1590 			Switch to the <i>dimension state</i>.
  1592 			<p>
  1593 				Otherwise,
  1594 				if the <i title="next input character">next 2 input characters</i> are
  1595 				U+005C REVERSE SOLIDUS (\) followed by a <i>newline</i>,
  1596 				or U+005C REVERSE SOLIDUS (\) followed by EOF,
  1597 				set the number token's value to the number
  1598 				produced by interpreting the number token's representation
  1599 				as a base-10 number
  1600 				and emit it.
  1601 				Switch to the <i>data state</i>.
  1602 				Reconsume the <i>current input character</i>.
  1604 			<p>
  1605 				Otherwise,
  1606 				if the <i>next input character</i> is
  1607 				U+005C REVERSE SOLIDUS (\),
  1608 				consume it,
  1609 				then <i>consume an escaped character</i>.
  1610 				Create a dimension token
  1611 				with its representation set to the number token's representation,
  1612 				its value set to the number
  1613 				produced by interpreting the number token's representation
  1614 				as a base-10 number,
  1615 				and a unit initially set to
  1616 				U+002D HYPHEN-MINUS
  1617 				followed by the returned character.
  1618 				Switch to the <i>dimension state</i>.
  1620 			<p>
  1621 				Otherwise,
  1622 				set the number token's value to the number
  1623 				produced by interpreting the number token's representation
  1624 				as a base-10 number
  1625 				and emit it.
  1626 				Switch to the <i>data state</i>.
  1627 				Reconsume the <i>current input character</i>.
  1629 		<dt><i>name-start character</i>
  1630 		<dd>
  1631 			Create a dimension token
  1632 			with its representation set to the number token's representation,
  1633 			its value set to the number
  1634 			produced by interpreting the number token's representation
  1635 			as a base-10 number,
  1636 			and a unit initially set to the <i>current input character</i>.
  1637 			Switch to the <i>dimension state</i>.
  1639 		<dt>U+005C REVERSE SOLIDUS (\)
  1640 		<dd>
  1641 			If the <i>next input character</i> is
  1642 			a <i>newline</i> or EOF,
  1643 			set the number token's value to the number
  1644 			produced by interpreting the number token's representation
  1645 			as a base-10 number
  1646 			and emit it.
  1647 			Switch to the <i>data state</i>.
  1648 			Reconsume the <i>current input character</i>.
  1650 			<p>
  1651 				Otherwise,
  1652 				<i>consume an escaped character</i>.
  1653 				Create a dimension token
  1654 				with its representation set to the number token's representation,
  1655 				its value set to the number
  1656 				produced by interpreting the number token's representation
  1657 				as a base-10 number,
  1658 				and a unit initially set to the returned character.
  1659 				Switch to the <i>dimension state</i>.
  1662 		<dt>anything else
  1663 		<dd>
  1664 			Emit a number token
  1665 			with its value set to the number
  1666 			produced by interpreting the string token's value
  1667 			as a base-10 number.
  1668 			Switch to the <i>data state</i>.
  1669 			Reconsume the <i>current input character</i>.
  1670 	</dl>
  1672 <h4>
  1673 <dfn>Dimension state</dfn></h4>
  1675 	<!--
  1676 		This state is currently always entered with a dimension token
  1677 		having already been created and gotten over the "first valid character" hump,
  1678 		so the dimension token is already ready to emit.
  1680 		If this ever becomes not true, make the necessary additions here
  1681 		or things will break.
  1682 	-->
  1684 	<p>
  1685 		Consume the <i>next input character</i>.
  1687 	<dl>
  1688 		<dt><i>name character</i>
  1689 		<dd>
  1690 			Append the <i>current input character</i>
  1691 			to the dimension token's unit.
  1692 			Remain in this state.
  1694 		<dt>U+005C REVERSE SOLIDUS (\)
  1695 		<dd>
  1696 			If the <i>next input character</i> is
  1697 			a <i>newline</i> or EOF,
  1698 			emit the dimension token.
  1699 			Switch to the <i>data state</i>.
  1700 			Reconsume the <i>current input character</i>.
  1702 			<p>
  1703 				Otherwise,
  1704 				<i>consume an escaped character</i>.
  1705 				Append the returned character
  1706 				to the dimension token's unit.
  1708 		<dt>anything else
  1709 		<dd>
  1710 			Emit the dimension token.
  1711 			Switch to the <i>data state</i>.
  1712 			Reconsume the <i>current input character</i>.
  1713 	</dl>
  1715 <h4>
  1716 <dfn>Sci-notation state</dfn></h4>
  1718 	<p>
  1719 		Set the number token's type flag to "number".
  1721 	<p>
  1722 		Consume the <i>next input character</i>.
  1724 	<dl>
  1725 		<dt><i>digit</i>
  1726 		<dd>
  1727 			Append the <i>current input character</i>
  1728 			to the number token's representation.
  1729 			Remain in this state.
  1731 		<dt>anything else
  1732 		<dd>
  1733 			Let <var>base</var> be the result of interpreting the portion of the number token's representation
  1734 			preceding the U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e)
  1735 			as a base-10 number.
  1736 			<p>
  1737 				Let <var>power</var> be the result of interpreting the portion of the number token's representation
  1738 				following the U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e)
  1739 				as a base-10 number.
  1740 			<p>
  1741 				Set the number token's value to <code><var>base</var> * 10<sup><var>power</var></sup></code>.
  1742 				If the number token's value is not an integer,
  1743 				set the number token's type flag to "number".
  1744 				Emit the number token.
  1745 				Switch to the <i>data state</i>.
  1746 				Reconsume the <i>current input character</i>.
  1747 	</dl>
  1749 <h4>
  1750 <dfn>URL state</dfn></h4>
  1752 	<p>
  1753 		Consume the <i>next input character</i>.
  1755 	<dl>
  1756 		<dt>EOF
  1757 		<dd>
  1758 			This is a <i>parse error</i>.
  1759 			Emit a bad-url token.
  1760 			Switch to the <i>data state</i>.
  1762 		<dt>U+0022 QUOTATION MARK (")
  1763 		<dd>
  1764 			Switch to the <i>url-double-quote state</i>.
  1766 		<dt>U+0027 APOSTROPHE (&apos;)
  1767 		<dd>
  1768 			Switch to the <i>url-single-quote state</i>.
  1770 		<dt>U+0029 RIGHT PARENTHESIS ())
  1771 		<dd>
  1772 			Emit a url token
  1773 			with its value set to the empty string.
  1774 			Switch to the <i>data state</i>.
  1776 		<dt><i>whitespace</i>
  1777 		<dd>
  1778 			Remain in this state.
  1780 		<dt>anything else
  1781 		<dd>
  1782 			Switch to the <i>url-unquoted state</i>.
  1783 			Reconsume the <i>current input character</i>.
  1784 	</dl>
  1786 <h4>
  1787 <dfn>URL-double-quote state</dfn></h4>
  1789 	<p>
  1790 		If a url token has not yet been created since entering this state,
  1791 		create a url token
  1792 		with its value initially set to the empty string.
  1794 	<p>
  1795 		Consume the <i>next input character</i>.
  1797 	<dl>
  1798 		<dt>EOF
  1799 		<dd>
  1800 			This is a <i>parse error</i>.
  1801 			Emit a bad-url token.
  1802 			Switch to the <i>data state</i>.
  1804 		<dt>U+0022 QUOTATION MARK (")
  1805 		<dd>
  1806 			Switch to the <i>url-end state</i>.
  1808 		<dt><i>newline</i>
  1809 		<dd>
  1810 			This is a <i>parse error</i>.
  1811 			Switch to the <i>bad-url state</i>.
  1813 		<dt>U+005C REVERSE SOLIDUS (\)
  1814 		<dd>
  1815 			If the <i>next input character</i> is
  1816 			EOF,
  1817 			this is a <i>parse error</i>.
  1818 			Emit a bad-url token.
  1819 			Switch to the <i>data state</i>.
  1820 			Reconsume the <i>current input character</i>.
  1822 			<p>
  1823 				Otherwise, if the <i>next input character</i> is
  1824 				a <i>newline</i>,
  1825 				consume it
  1826 				and remain in this state.
  1828 			<p>
  1829 				Otherwise,
  1830 				<i>consume an escaped character</i>.
  1831 				Append the returned character to the url token's value.
  1832 				Remain in this state.
  1834 		<dt>anything else
  1835 		<dd>
  1836 			Append the <i>current input character</i>
  1837 			to the url token's value.
  1838 			Remain in this state.
  1839 	</dl>
  1841 <h4>
  1842 <dfn>URL-single-quote state</dfn></h4>
  1844 	<p>
  1845 		If a url token has not yet been created since entering this state,
  1846 		create a url token
  1847 		with its value initially set to the empty string.
  1849 	<p>
  1850 		Consume the <i>next input character</i>.
  1852 	<dl>
  1853 		<dt>EOF
  1854 		<dd>
  1855 			This is a <i>parse error</i>.
  1856 			Emit a bad-url token.
  1857 			Switch to the <i>data state</i>.
  1859 		<dt>U+0027 APOSTROPHE (&apos;)
  1860 		<dd>
  1861 			Switch to the <i>url-end state</i>.
  1863 		<dt><i>newline</i>
  1864 		<dd>
  1865 			This is a <i>parse error</i>.
  1866 			Switch to the <i>bad-url state</i>.
  1868 		<dt>U+005C REVERSE SOLIDUS (\)
  1869 		<dd>
  1870 			If the <i>next input character</i> is
  1871 			EOF,
  1872 			this is a <i>parse error</i>.
  1873 			Emit a bad-url token.
  1874 			Switch to the <i>data state</i>.
  1875 			Reconsume the <i>current input character</i>.
  1877 			<p>
  1878 				Otherwise, if the <i>next input character</i> is
  1879 				a <i>newline</i>,
  1880 				consume it
  1881 				and remain in this state.
  1883 			<p>
  1884 				Otherwise,
  1885 				<i>consume an escaped character</i>.
  1886 				Append the returned character to the url token's value.
  1887 				Remain in this state.
  1889 		<dt>anything else
  1890 		<dd>
  1891 			Append the <i>current input character</i>
  1892 			to the url token's value.
  1893 			Remain in this state.
  1894 	</dl>
  1896 <h4>
  1897 <dfn>URL-end state</dfn></h4>
  1899 	<p>
  1900 		Consume the <i>next input character</i>.
  1902 	<dl>
  1903 		<dt>EOF
  1904 		<dd>
  1905 			This is a <i>parse error</i>.
  1906 			Emit a bad-url token.
  1907 			Switch to the <i>data state</i>.
  1909 		<dt><i>whitespace</i>
  1910 		<dd>
  1911 			Remain in this state.
  1913 		<dt>U+0029 RIGHT PARENTHESIS ())
  1914 		<dd>
  1915 			Emit the url token.
  1916 			Switch to the <i>data state</i>.
  1918 		<dt>anything else
  1919 		<dd>
  1920 			This is a <i>parse error</i>.
  1921 			Switch to the <i>bad-url state</i>.
  1922 			Reconsume the <i>current input character</i>.
  1923 	</dl>
  1925 <h4>
  1926 <dfn>URL-unquoted state</dfn></h4>
  1928 	<p>
  1929 		If a url token has not yet been created since entering this state,
  1930 		create a url token
  1931 		with its value initially set to the empty string.
  1933 	<p>
  1934 		Consume the <i>next input character</i>.
  1936 	<dl>
  1937 		<dt>EOF
  1938 		<dd>
  1939 			This is a <i>parse error</i>.
  1940 			Emit a bad-url token.
  1941 			Switch to the <i>data state</i>.
  1943 		<dt><i>whitespace</i>
  1944 		<dd>
  1945 			Switch to the <i>url-end state</i>.
  1947 		<dt>U+0029 RIGHT PARENTHESIS ())
  1948 		<dd>
  1949 			Emit the url token.
  1950 			Switch to the <i>data state</i>.
  1952 		<dt>U+0022 QUOTATION MARK (")
  1953 		<dt>U+0027 APOSTROPHE (&apos;)
  1954 		<dt>U+0028 LEFT PARENTHESIS (()
  1955 		<dt><i>non-printable character</i>
  1956 		<dd>
  1957 			This is a <i>parse error</i>.
  1958 			Switch to the <i>bad-url state</i>.
  1960 		<dt>U+005C REVERSE SOLIDUS
  1961 		<dd>
  1962 			If the <i>next input character</i>
  1963 			is a <i>newline</i> or EOF,
  1964 			this is a <i>parse error</i>.
  1965 			Switch to the <i>bad-url state</i>.
  1967 			<p>
  1968 				Otherwise,
  1969 				<i>consume an escaped character</i>.
  1970 				Append the returned character
  1971 				to the url token's value.
  1972 				Remain in this state.
  1974 		<dt>anything else
  1975 		<dd>
  1976 			Append the <i>current input character</i>
  1977 			to the url token's value.
  1978 			Remain in this state.
  1979 	</dl>
  1982 <h4>
  1983 <dfn>Bad-URL state</dfn></h4>
  1985 	<p>
  1986 		Consume the <i>next input character</i>.
  1988 	<dl>
  1989 		<dt>EOF
  1990 		<dd>
  1991 			This is a <i>parse error</i>.
  1992 			Emit a bad-url token.
  1993 			Switch to the <i>data state</i>.
  1995 		<dt>U+0029 RIGHT PARENTHESIS ())
  1996 		<dd>
  1997 			Emit a bad-url token.
  1998 			Switch to the <i>data state</i>.
  2000 		<dt>U+005C REVERSE SOLIDUS
  2001 		<dd>
  2002 			If the <i>next input character</i>
  2003 			is a <i>newline</i> or EOF,
  2004 			do nothing
  2005 			and remain in this state.
  2007 			<p>
  2008 				Otherwise,
  2009 				<i>consume an escaped character</i>.
  2010 				Remain in this state.
  2012 		<dt>anything else
  2013 		<dd>
  2014 			Do nothing.
  2015 			Remain in this state.
  2016 	</dl>
  2019 <h4>
  2020 <dfn>Unicode-range state</dfn></h4>
  2022 	<p>
  2023 		Create a new unicode-range token
  2024 		with an empty range.
  2026 	<p>
  2027 		Consume as many <i>hex digits</i> as possible, but no more than 6.
  2028 		If less than 6 <i>hex digits</i> were consumed,
  2029 		consume as many U+003F QUESTION MARK (?) characters as possible,
  2030 		but no more than enough to make the total of <i>hex digits</i> and U+003F QUESTION MARK (?) characters equal to 6.
  2032 		<p>
  2033 			If any U+003F QUESTION MARK (?) characters were consumed,
  2034 			first interpret the consumed characters as a hexadecimal number,
  2035 			with the U+003F QUESTION MARK (?) characters replaced by U+0030 DIGIT ZERO (0) characters.
  2036 			This is the <i>start of the range</i>.
  2037 			Then interpret the consumed characters as a hexadecimal number again,
  2038 			with the U+003F QUESTION MARK (?) character replaced by U+0046 LATIN CAPITAL LETTER F (F) characters.
  2039 			This is the <i>end of the range</i>.
  2040 			<i>Set the unicode-range token's range</i>, then emit it.
  2041 			Switch to the <i>data state</i>.
  2043 		<p>
  2044 			Otherwise,
  2045 			interpret the digits as a hexadecimal number.
  2046 			This is the <i>start of the range</i>.
  2048 	<p>
  2049 		Consume the <i>next input character</i>.
  2051 	<dl>
  2052 		<dt>U+002D HYPHEN-MINUS (-)
  2053 		<dd>
  2054 			If the <i>next input character</i> is a <i>hex digit</i>,
  2055 			consume as many <i>hex digits</i> as possible, but no more than 6.
  2056 			Interpret the digits as a hexadecimal number.
  2057 			This is the <i>end of the range</i>.
  2058 			<i>Set the unicode-range token's range</i>, then emit it.
  2059 			Switch to the <i>data state</i>.
  2061 			<p>
  2062 				Otherwise,
  2063 				<i>set the unicode-range token's range</i>
  2064 				and emit it.
  2065 				Switch to the <i>data state</i>.
  2066 				Reconsume the <i>current input character</i>.
  2068 		<dt>anything else
  2069 		<dd>
  2070 			<i>Set the unicode-range token's range</i>
  2071 			and emit it.
  2072 			Switch to the <i>data state</i>.
  2073 			Reconsume the <i>current input character</i>.
  2074 	</dl>
  2076 <h3>
  2077 <dfn>Consume an escaped character</dfn></h3>
  2079 	<p>
  2080 		This section describes how to <i>consume an escaped character</i>.
  2081 		It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed
  2082 		and that the next input character has already been verified
  2083 		to not be a <i>newline</i> or EOF.
  2084 		It will return a character.
  2086 	<p>
  2087 		Consume the <i>next input character</i>.
  2089 	<dl>
  2090 		<dt><i>hex digit</i>
  2091 		<dd>
  2092 			Consume as many <i>hex digits</i> as possible, but no more than 5.
  2093 			<span class='note'>Note that this means 1-6 hex digits have been consumed in total.</span>
  2094 			If the <i>next input character</i> is
  2095 			<i>whitespace</i>,
  2096 			consume it as well.
  2097 			Interpret the <i>hex digits</i> as a hexadecimal number.
  2098 			If this number is zero,
  2099 			or is greater than the <i>maximum allowed codepoint</i>,
  2100 			return U+FFFD REPLACEMENT CHARACTER (�).
  2101 			Otherwise, return the character with that codepoint.
  2103 		<dt>anything else
  2104 		<dd>
  2105 			Return the <i>current input character</i>.
  2106 	</dl>
  2108 <h3>
  2109 <dfn>Set the unicode-range token's range</dfn></h3>
  2111 	<p>
  2112 		This section describes how to set a unicode-range token's range
  2113 		so that the range it describes
  2114 		is within the supported range of unicode characters.
  2116 	<p>
  2117 		It assumes that the <dfn>start of the range</dfn> has been defined,
  2118 		the <dfn>end of the range</dfn> might be defined,
  2119 		and both are non-negative integers.
  2121 	<p>
  2122 		If the <i>start of the range</i> is greater than
  2123 		the <i>maximum allowed codepoint</i>,
  2124 		the unicode-range token's range is empty.
  2126 	<p>
  2127 		If the <i>end of the range</i> is defined,
  2128 		and it is less than the <i>start of the range</i>,
  2129 		the unicode-range token's range is empty.
  2131 	<p>
  2132 		If the <i>end of the range</i> is not defined,
  2133 		the unicode-range token's range
  2134 		is the single character whose codepoint is the <i>start of the range</i>.
  2136 	<p>
  2137 		Otherwise,
  2138 		if the <i>end of the range</i> is greater than
  2139 		the <i>maximum allowed codepoint</i>,
  2140 		change it to the <i>maximum allowed codepoint</i>.
  2141 		The unicode-range token's range
  2142 		is all characters between
  2143 		the character whose codepoint is the <i>start of the range</i>
  2144 		and the character whose codepoint is the <i>end of the range</i>.
  2147 <h3>
  2148 Changes from CSS 2.1 Tokenizer</h3>
  2150 	<p>
  2151 		<em>This section is non-normative.</em>
  2153 	<p class='issue'>
  2154 		Note that the point of this spec is to match reality;
  2155 		changes from CSS2.1&apos;s tokenizer are nearly always because the tokenizer specified something that doesn't match actual browser behavior,
  2156 		or left something unspecified.
  2157 		If some detail doesn't match browsers,
  2158 		please let me know
  2159 		as it's almost certainly unintentional.
  2161 	<ol>
  2162 		<li>
  2163 			The prefix-match, suffix-match, and substring-match tokens have been imported from Selectors 3.
  2165 		<li>
  2166 			The BAD-URI token (now bad-url) is "self-contained".
  2167 			In other words, once the tokenizer realizes it's in a bad-url rather than a url token,
  2168 			it just seeks forward to look for the closing ),
  2169 			ignoring everything else.
  2170 			This behavior is simpler than treating it like a FUNCTION token
  2171 			and paying attention to opened blocks and such.
  2172 			Only WebKit exhibits this behavior,
  2173 			but it doesn't appear that we've gotten any compat bugs from it.
  2175 		<li>
  2176 			The comma token has been added.
  2178 		<li>
  2179 			The number, percentage, and dimension tokens have been changed
  2180 			to include the preceding +/- sign as part of their value
  2181 			(rather than as a separate DELIM token that needs to be manually handled every time the token is mentioned in other specs).
  2182 			The only consequence of this is that comments can no longer be inserted between the sign and the number.
  2184 		<li>
  2185 			Some flags have been added for SVG-compatible tokenizing,
  2186 			so that a single state machine can be used for both "vanilla" and SVG CSS parsing.
  2188 		<li>
  2189 			Scientific notation is supported for numbers,
  2190 			per WG resolution.
  2192 	</ol>
  2195 <!--
  2196 PPPPPPPPPPPPPPPPP        AAA               RRRRRRRRRRRRRRRRR      SSSSSSSSSSSSSSS EEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRR
  2197 P::::::::::::::::P      A:::A              R::::::::::::::::R   SS:::::::::::::::SE::::::::::::::::::::ER::::::::::::::::R
  2198 P::::::PPPPPP:::::P    A:::::A             R::::::RRRRRR:::::R S:::::SSSSSS::::::SE::::::::::::::::::::ER::::::RRRRRR:::::R
  2199 PP:::::P     P:::::P  A:::::::A            RR:::::R     R:::::RS:::::S     SSSSSSSEE::::::EEEEEEEEE::::ERR:::::R     R:::::R
  2200   P::::P     P:::::P A:::::::::A             R::::R     R:::::RS:::::S              E:::::E       EEEEEE  R::::R     R:::::R
  2201   P::::P     P:::::PA:::::A:::::A            R::::R     R:::::RS:::::S              E:::::E               R::::R     R:::::R
  2202   P::::PPPPPP:::::PA:::::A A:::::A           R::::RRRRRR:::::R  S::::SSSS           E::::::EEEEEEEEEE     R::::RRRRRR:::::R
  2203   P:::::::::::::PPA:::::A   A:::::A          R:::::::::::::RR    SS::::::SSSSS      E:::::::::::::::E     R:::::::::::::RR
  2204   P::::PPPPPPPPP A:::::A     A:::::A         R::::RRRRRR:::::R     SSS::::::::SS    E:::::::::::::::E     R::::RRRRRR:::::R
  2205   P::::P        A:::::AAAAAAAAA:::::A        R::::R     R:::::R       SSSSSS::::S   E::::::EEEEEEEEEE     R::::R     R:::::R
  2206   P::::P       A:::::::::::::::::::::A       R::::R     R:::::R            S:::::S  E:::::E               R::::R     R:::::R
  2207   P::::P      A:::::AAAAAAAAAAAAA:::::A      R::::R     R:::::R            S:::::S  E:::::E       EEEEEE  R::::R     R:::::R
  2208 PP::::::PP   A:::::A             A:::::A   RR:::::R     R:::::RSSSSSSS     S:::::SEE::::::EEEEEEEE:::::ERR:::::R     R:::::R
  2209 P::::::::P  A:::::A               A:::::A  R::::::R     R:::::RS::::::SSSSSS:::::SE::::::::::::::::::::ER::::::R     R:::::R
  2210 P::::::::P A:::::A                 A:::::A R::::::R     R:::::RS:::::::::::::::SS E::::::::::::::::::::ER::::::R     R:::::R
  2211 PPPPPPPPPPAAAAAAA                   AAAAAAARRRRRRRR     RRRRRRR SSSSSSSSSSSSSSS   EEEEEEEEEEEEEEEEEEEEEERRRRRRRR     RRRRRRR
  2212 -->
  2214 <h2>
  2215 Parsing</h2>
  2217 	<p>
  2218 		The input to the parsing stage is a stream or list of tokens from the tokenization stage.
  2219 		The output depends on how the parser is invoked,
  2220 		as defined by the entry points listed later in this section.
  2221 		The parser output can consist of at-rules,
  2222 		qualified rules,
  2223 		and/or declarations.
  2225 	<p>
  2226 		The parser's output is constructed according to the fundamental syntax of CSS,
  2227 		without regards for the validity of any specific item.
  2228 		Implementations may check the validity of items as they are returned by the various parser algorithms
  2229 		and treat the algorithm as returning nothing if the item was invalid according to the implementation's own grammar knowledge,
  2230 		or may construct a full tree as specified
  2231 		and "clean up" afterwards by removing any invalid items.
  2233 	<p>
  2234 		The items that can appear in the tree are a mixture of basic tokens
  2235 		and new objects:
  2237 	<dl>
  2238 		<dt><dfn>at-rule</dfn>
  2239 		<dd>
  2240 			An at-rule has a name,
  2241 			a prelude consisting of a list of component values,
  2242 			and a value consisting of a list of at-rules, style rules, or declarations.
  2244 		<dt><dfn>qualified rule</dfn>
  2245 		<dd>
  2246 			A qualified rule has
  2247 			a prelude consisting of a list of component values,
  2248 			and a value consisting of a list of at-rules or declarations.
  2250 		<dt><dfn>declaration</dfn>
  2251 		<dd>
  2252 			A declaration has a name,
  2253 			a value consisting of a list of component values,
  2254 			and an <var>important</var> flag which is initially unset.
  2256 		<dt><dfn>component value</dfn>
  2257 		<dd>
  2258 			A component value is one of the preserved tokens,
  2259 			a function,
  2260 			or a simple block.
  2262 		<dt><dfn>preserved tokens</dfn>
  2263 		<dd>
  2264 			Any token produced by the tokenizer
  2265 			except for function tokens,
  2266 			{ tokens,
  2267 			( tokens,
  2268 			and [ tokens.
  2270 			<p class='note'>
  2271 				The non-preserved tokens listed above are always consumed into higher-level objects,
  2272 				either functions or simple blocks,
  2273 				and so never appear in any parser output themselves.
  2275 		<dt><dfn>function</dfn>
  2276 		<dd>
  2277 			A function has a name
  2278 			and a list of arguments.
  2279 			Each argument is a list of component values.
  2281 		<dt><dfn>simple block</dfn>
  2282 		<dd>
  2283 			A simple block has an associated token (either a [, (, or { token)
  2284 			and a value consisting of a list of component values.
  2286 		<dt><dfn>recognized at-rule name</dfn>
  2287 		<dd>
  2288 			When the parser is invoked,
  2289 			it must be provided with a list of <i>recognized at-rule names</i>,
  2290 			where each name is additionally associated with whether the <i>at-rule</i> is
  2291 			<i>rule-filled</i>,
  2292 			<i>declaration-filled</i>,
  2293 			or neither.
  2294 	</dl>
  2296 <h3>
  2297 Parser Flags</h3>
  2299 	<dl>
  2300 		<dt>the <dfn>quirks mode</dfn> flag
  2301 		<dd>
  2302 			This flag is set when the host document is in quirks mode.
  2303 			When this is set,
  2304 			the parser allows <a href="#consume-a-component value-with-the-hashless-co">hash colors without the # character</a>
  2305 			and <a href="#consume-a-component value-with-the-unitless-le">pixel lengths without the 'px' unit</a>
  2306 			in some circumstances.
  2307 	</dl>
  2309 <h3>
  2310 Definitions</h3>
  2312 	<dl>
  2313 		<dt><dfn>current input token</dfn>
  2314 		<dd>
  2315 			The token currently being operated on, from the list of tokens produced by the tokenizer.
  2317 		<dt><dfn>next input token</dfn>
  2318 		<dd>
  2319 			The token following the <i>current input token</i> in the list of tokens produced by the tokenizer.
  2320 			If there isn't a token following the <i>current input token</i>,
  2321 			the <i>next input token</i> is an EOF token.
  2323 		<dt><dfn>reconsume the current input token</dfn>
  2324 		<dd>
  2325 			Push the current input token back onto the list of tokens produced by the tokenizer,
  2326 			so that the next time a mode instructs you to consume the next input token,
  2327 			it will instead reconsume the current input token.
  2329 		<dt><dfn>rule-filled</dfn>
  2330 		<dd>
  2331 			An at-rule is <i>rule-filled</i>
  2332 			if it is in the list of <i>recognized at-rules</i>
  2333 			and marked as such.
  2334 			This type of <i>at-rule</i> may have a prelude,
  2335 			and finishes with a <i>simple block</i>
  2336 			which contains <i>at-rules</i> and/or <i>qualified rules</i>.
  2337 			Examples of <i>rule-filled</i> at-rules are ''@media'' and ''@keyframes''.
  2339 		<dt><dfn>declaration-filled</dfn>
  2340 		<dd>
  2341 			An at-rule is <i>declaration-filled</i>
  2342 			if it is in the list of <i>recognized at-rules</i>
  2343 			and marked as such.
  2344 			This type of <i>at-rule</i> may have a prelude,
  2345 			and finishes with a <i>simple block</i>
  2346 			which contains <i>at-rules</i> and/or <i>declarations</i>.
  2347 			Examples of <i>declaration-filled</i> at-rules are ''@font-face'' and ''@page''.
  2349 		<dt><dfn>ASCII case-insensitive</dfn>
  2350 		<dd>
  2351 			When two strings are to be matched ASCII case-insensitively,
  2352 			temporarily convert both of them to ASCII lower-case form
  2353 			by adding 32 (0x20) to the value of each codepoint between
  2354 			U+0041 LATIN CAPITAL LETTER A (A)
  2355 			and U+005A LATIN CAPITAL LETTER Z (Z),
  2356 			inclusive,
  2357 			and then compare them on a codepoint-by-codepoint basis.
  2358 	</dl>
  2362 <h3>
  2363 Parser Entry Points</h3>
  2365 	<p>
  2366 		The algorithms defined in this specification can be invoked in multiple ways
  2367 		to convert a stream of text into various CSS concepts.
  2369 	<p>
  2370 		All of the algorithms defined in this section begin in the parser.
  2371 		It is assumed that the <a href="#preprocessing-the-input-stream">input preprocessing</a>
  2372 		and <a href="#tokenization">tokenization</a>
  2373 		steps have already been completed,
  2374 		resulting in a stream of tokens.
  2376 	<div class='issue'>
  2377 		<p>
  2378 			The following notes should probably be translated into normative text in the relevant specs,
  2379 			hooking this spec's terms:
  2381 		<ul>
  2382 			<li>
  2383 				"<i>Parse a stylesheet</i>" is intended to be the normal parser entry point,
  2384 				for parsing stylesheets.
  2386 			<li>
  2387 				"<i>Parse a rule</i>" is intended for use by the <code>CSSStyleSheet#insertRule</code> method,
  2388 				and similar functions which might exist,
  2389 				which parse text into a single rule.
  2391 			<li>
  2392 				"<i>Parse a list of declarations</i>" is for the contents of a <code>style</code> attribute,
  2393 				which parses text into the contents of a single style rule.
  2395 			<li>
  2396 				Dunno about "<i>Parse a value</i>" yet.
  2397 				I'll remove it if I don't figure out what to do with it.
  2399 			<li>
  2400 				"<i>Parse a list of values</i>" is for the contents of presentational attributes,
  2401 				which parse text into a single declaration's value.
  2403 			<li>
  2404 				"<i>Parse a comma-separated list of values</i>" is similar,
  2405 				but for comma-separated lists.
  2406 		</ul>
  2408 		<p>
  2409 			Are there any other things somewhere where some tech (that isn't straight CSS itself) needs to parse some text into CSS?
  2410 	</div>
  2412 	<p>
  2413 		All of the algorithms defined in this spec may be called with either a list of tokens or of component values.
  2414 		Either way produces an identical result.
  2417 <h4>
  2418 <dfn>Parse a stylesheet</dfn></h4>
  2420 	<p>
  2421 		To <i>parse a stylesheet</i> from a stream of tokens:
  2423 	<ol>
  2424 		<li>
  2425 			Create a new stylesheet.
  2427 		<li>
  2428 			<i>Consume a list of rules</i> from the stream of tokens.
  2430 		<li>
  2431 			Assign the returned value to the stylesheet's value.
  2433 		<li>
  2434 			Return the stylesheet.
  2435 	</ol>
  2437 <h4>
  2438 <dfn>Parse a rule</dfn></h4>
  2440 	<p>
  2441 		To <i>parse a rule</i> from a stream of tokens:
  2443 	<ol>
  2444 		<li>
  2445 			Consume whitespace tokens from the token stream until a non-whitespace token is encountered.
  2447 		<li>
  2448 			If the <i>current input token</i>
  2449 			is a CDO token, CDC token, or EOF token,
  2450 			return a syntax error.
  2452 			<p>
  2453 				Otherwise,
  2454 				if the <i>current input token</i> is an at-keyword token:
  2456 			<ul>
  2457 				<li>
  2458 					If the at-keyword token's name is on the list of <i>recognized at-rule names</i>,
  2459 					and the list indicates that it is a <i>rule-filled</i> or <i>declaration-filled</i> at-rule,
  2460 					<i>consume an at-rule</i>.
  2461 					If nothing was returned,
  2462 					return a syntax error.
  2464 				<li>
  2465 					Otherwise,
  2466 					<i>consume an at-statement</i>.
  2467 					If nothing was returned,
  2468 					return a syntax error.
  2469 			</ul>
  2471 			<p>
  2472 				Otherwise,
  2473 				<i>consume a qualified rule</i>.
  2474 				If nothing was returned,
  2475 				return a syntax error.
  2477 		<li>
  2478 			Consume whitespace tokens from the token stream until a non-whitespace token is encountered.
  2480 		<li>
  2481 			If the <i>current input token</i> is an EOF token,
  2482 			return the rule obtained in step 2.
  2483 			Otherwise, return a syntax error.
  2484 	</ol>
  2486 <h4>
  2487 <dfn>Parse a list of declarations</dfn></h4>
  2489 	<p>
  2490 		To <i>parse a list of declarations</i>:
  2492 	<ol>
  2493 		<li>
  2494 			<i>Consume a list of declarations</i>.
  2495 			If anything was returned,
  2496 			return it.
  2497 	</ol>
  2499 <h4>
  2500 <dfn>Parse a component value</dfn></h4>
  2502 	<p>
  2503 		To <i>parse a component value</i>:
  2505 	<ol>
  2506 		<li>
  2507 			Discard whitespace tokens from the token stream until a non-whitespace token is reached.
  2508 			If the token stream is exhausted without finding a non-whitespace token,
  2509 			return a syntax error.
  2511 		<li>
  2512 			<i>Consume a component value</i>.
  2513 			If nothing is returned,
  2514 			return a syntax error.
  2516 		<li>
  2517 			Discard whitespace tokens from the token stream until a non-whitespace token is reached.
  2518 			If the token stream is exhausted without finding a non-whitespace token,
  2519 			return the value found in the previous step.
  2520 			Otherwise,
  2521 			return a syntax error.
  2522 	</ol>
  2524 <h4>
  2525 <dfn>Parse a list of component values</dfn></h4>
  2527 	<p>
  2528 		To <i>parse a list of component values</i>:
  2530 	<ol>
  2531 		<li>
  2532 			Repeatedly <i>consume a component value</i> until an EOF token is returned,
  2533 			appending the returned values into a list.
  2534 			Return the list.
  2535 	</ol>
  2537 <h4>
  2538 <dfn>Parse a comma-separated list of component values</dfn></h4>
  2540 	<p>
  2541 		To <i>parse a comma-separated list of component values</i>:
  2543 	<ol>
  2544 		<li>
  2545 			Initialize <var>val</var> to an empty list,
  2546 			and <var>temp</var> to an empty list.
  2548 		<li>
  2549 			Repeatedly <i>consume a component value</i>,
  2550 			appending the returned values to <var>temp</var>,
  2551 			until either a comma token or EOF token is returned.
  2553 		<li>
  2554 			If a comma token is encountered,
  2555 			do not append it to <var>temp</var>.
  2556 			Instead,
  2557 			append <var>temp</var> to <var>val</var>.
  2558 			Create a new <var>temp</var>,
  2559 			and return to step 2.
  2561 		<li>
  2562 			If an EOF token is encountered,
  2563 			append <var>temp</var> to <var>val</var>,
  2564 			and return <var>val</var>.
  2565 	</ol>
  2567 <h4>
  2568 <dfn>Parse an+b notation</dfn></h4>
  2570 	<p>
  2571 		To <i>parse an+b notation</i>:
  2573 	<p>
  2574 		Initialize an integer called <var>step</var> to 0,
  2575 		an integer called <var>offset</var> to 0,
  2576 		and a string called <var>repr</var> to the empty string.
  2578 	<p>
  2579 		Repeatedly consume the <i>next input token</i>
  2580 		and process it as follows:
  2582 	<dl>
  2583 		<dt>ident token
  2584 		<dt>number token with its type flag set to "integer"
  2585 		<dt>dimension token
  2586 		<dd>
  2587 			Append the token's value, representation, or representation and unit, respectively, to <var>repr</var>.
  2589 		<dt>delim token with the value "+"
  2590 		<dd>
  2591 			Append U+002B PLUS SIGN (+) to <var>repr</var>.
  2593 		<dt>delim token with the value "-"
  2594 		<dd>
  2595 			Append U+002D HYPHEN-MINUS (-) to <var>repr</var>.
  2597 		<dt>whitespace token
  2598 		<dd>
  2599 			Append U+0020 SPACE ( ) to <var>repr</var>.
  2601 		<dt>EOF
  2602 		<dd>
  2603 			Continue to the next step of the algorithm.
  2605 		<dt>anything else
  2606 		<dd>
  2607 			This is a <i>parse error</i>.
  2608 			Return a syntax error.
  2609 	</dl>
  2611 	<p>
  2612 		Trim U+0020 SPACE ( ) characters from the front and back of <var>repr</var>,
  2613 		then process it as follows:
  2615 	<ol>
  2616 		<li>
  2617 			If <var>repr</var> is an <i>ASCII case-insensitive</i> match
  2618 			for the string "odd",
  2619 			set <var>step</var> to 2
  2620 			and <var>offset</var> to 1.
  2622 		<li>
  2623 			Otherwise, if <var>repr</var> is an <i>ASCII case-insensitive</i> match
  2624 			for the string "even",
  2625 			set <var>step</var> to 2
  2626 			and <var>offset</var> to 0.
  2628 		<li>
  2629 			Otherwise, if <var>repr</var> consists solely of <i>digits</i>,
  2630 			optionally prefixed with a single
  2631 			U+002B PLUS SIGN (+)
  2632 			or U+002D HYPHEN-MINUS (-),
  2633 			interpret <var>repr</var> as a base-10 number,
  2634 			and set <var>step</var> to the result.
  2636 		<li>
  2637 			Otherwise, if <var>repr</var> contains
  2638 			U+004E LATIN CAPITAL LETTER N (N),
  2639 			or U+006E LATIN SMALL LETTER N (n),
  2640 			split <var>repr</var> into two substrings
  2641 			composed respectively of the characters preceding and following the first such letter.
  2643 			<p>
  2644 				Interpret the first string as follows:
  2646 			<ul>
  2647 				<li>
  2648 					If the first string is empty,
  2649 					set <var>step</var> to 1.
  2651 				<li>
  2652 					Otherwise, if the first string consists solely of a single
  2653 					U+002B PLUS SIGN (+)
  2654 					or U+002D HYPHEN-MINUS (-),
  2655 					set <var>step</var> to 1 or -1, respectively.
  2657 				<li>
  2658 					Otherwise, if the first string consists solely of <i>digits</i>,
  2659 					optionally prefixed with a single
  2660 					U+002B PLUS SIGN (+)
  2661 					or U+002D HYPHEN-MINUS (-),
  2662 					interpret the first string as a base-10 number,
  2663 					and set <var>step</var> to the result.
  2665 				<li>
  2666 					Otherwise, this is a <i>parse error</i>;
  2667 					return a syntax error.
  2668 			</ul>
  2670 			<p>
  2671 				Interpret the second string as follows:
  2673 			<ul>
  2674 				<li>
  2675 					If the second string is empty,
  2676 					set <var>offset</var> to 0.
  2678 				<li>
  2679 					Otherwise, if the second string consists solely of
  2680 					0 or more U+0020 SPACE characters,
  2681 					optionally followed by a single
  2682 					U+002B PLUS SIGN (+)
  2683 					or U+002D HYPHEN-MINUS (-) character,
  2684 					followed by 0 or more U+0020 SPACE characters,
  2685 					followed by 1 or more <i>digits</i>,
  2686 					interpret the digits as a base-10 number.
  2687 					If there was a U+002D HYPHEN-MINUS (-) character,
  2688 					negate the result.
  2689 					Set <var>offset</var> to the result.
  2691 				<li>
  2692 					Otherwise, this is a <i>parse error</i>;
  2693 					return a syntax error.
  2694 			</ul>
  2696 		<li>
  2697 			Otherwise, this is a <i>parse error</i>;
  2698 			return a syntax error.
  2699 	</ol>
  2701 	<p>
  2702 		Return <var>step</var> and <var>offset</var>.
  2704 <h3>
  2705 Parser Algorithms</h3>
  2707 	<p>
  2708 		The following algorithms comprise the parser.
  2709 		They are called by the parser entry points above.
  2711 	<p>
  2712 		These algorithms may be called with a list of either tokens or of component values.
  2713 		(The difference being that some tokens are replaced by <i>functions</i> and <i>simple blocks</i> in a list of component values.)
  2714 		Similar to how the input stream returned EOF characters to represent when it was empty during the tokenization stage,
  2715 		the lists in this stage must return an EOF token when the next token is requested but they are empty.
  2717 	<p>
  2718 		An algorithm may be invoked with a specific list,
  2719 		in which case it consumes only that list
  2720 		(and when that list is exhausted,
  2721 		it begins returning EOF tokens).
  2722 		Otherwise,
  2723 		it is implicitly invoked with the same list as the invoking algorithm.
  2726 <h4>
  2727 <dfn>Consume a list of rules</dfn></h4>
  2729 	<p>
  2730 		Create an initially empty list of rules.
  2732 	<p>
  2733 		Repeatedly consume the <i>next input token</i>:
  2735 	<dl>
  2736 		<dt>cdo token
  2737 		<dt>cdc token
  2738 		<dt>whitespace token
  2739 		<dd>
  2740 			Do nothing.
  2742 		<dt>EOF token
  2743 		<dd>
  2744 			Return the list of rules.
  2746 		<dt>at-keyword token
  2747 		<dd>
  2748 			<i>Reconsume the current input token</i>.
  2749 			If the token's value is on the list of <i>recognized at-rule names</i>,
  2750 			and is noted as <i>rule-filled</i> or <i>declaration-filled</i>,
  2751 			<i>consume an at-rule</i>;
  2752 			otherwise,
  2753 			<i>consume an at-statement</i>.
  2754 			If anything was returned,
  2755 			append it to the list of rules.
  2757 		<dt>anything else
  2758 		<dd>
  2759 			<i>Reconsume the current input token</i>.
  2760 			<i>Consume a qualified rule</i>.
  2761 			If anything is returned,
  2762 			append it to the list of rules
  2763 	</dl>
  2766 <h4>
  2767 <dfn>Consume an at-rule</dfn></h4>
  2769 	<p>
  2770 		Create a new at-rule
  2771 		with its name set to the value of the <i>current input token</i>,
  2772 		its prelude initially set to an empty list,
  2773 		and its value initially set to nothing.
  2776 	<p>
  2777 		Repeatedly consume the <i>next input token</i>:
  2779 	<dl>
  2780 		<dt>{ token
  2781 		<dd>
  2782 			<i>Consume a simple block</i>.
  2783 			If the at-rule is <i>rule-filled</i>,
  2784 			<i>consume a list of rules</i> from the block's value;
  2785 			otherwise,
  2786 			<i>consume a list of declarations</i> from the block's value.
  2787 			If anything was returned,
  2788 			assign it to the at-rule's value.
  2789 			Return the at-rule.
  2791 		<dt><i>simple block</i> with an associated token of {
  2792 		<dd>
  2793 			If the at-rule is <i>rule-filled</i>,
  2794 			<i>consume a list of rules</i> from the block's value;
  2795 			otherwise,
  2796 			<i>consume a list of declarations</i> from the block's value.
  2797 			If anything was returned,
  2798 			assign it to the at-rule's value.
  2799 			Return the at-rule.
  2802 		<dt>EOF token
  2803 		<dd>
  2804 			This is a <i>parse error</i>.
  2805 			Return nothing.
  2807 		<dt>anything else
  2808 		<dd>
  2809 			<i>Consume a component value</i>.
  2810 			Append the returned value to the at-rule's prelude.
  2811 	</dl>
  2813 <h4>
  2814 <dfn>Consume an at-statement</dfn></h4>
  2816 	<p>
  2817 		Create a new at-rule
  2818 		with its name set to the value of the <i>current input token</i>,
  2819 		its prelude initially set to an empty list,
  2820 		and its value set to nothing.
  2822 	<p>
  2823 		Repeatedly consume the <i>next input token</i>:
  2825 	<dl>
  2826 		<dt>semicolon token
  2827 		<dt>EOF token
  2828 		<dd>
  2829 			Return the at-rule.
  2831 		<dt>anything else
  2832 		<dd>
  2833 			<i>Consume a component value</i>.
  2834 			Append the returned value to the at-rule's prelude.
  2835 	</dl>
  2838 <h4>
  2839 <dfn>Consume a qualified rule</dfn></h4>
  2841 	<p>
  2842 		Create a new qualified rule
  2843 		with its prelude initially set to an empty list,
  2844 		and its value initially set to nothing.
  2846 	<p>
  2847 		Repeatedly consume the <i>next input token</i>:
  2849 	<dl>
  2850 		<dt>EOF token
  2851 		<dd>
  2852 			This is a <i>parse error</i>.
  2853 			Return nothing.
  2855 		<dt>{ token
  2856 		<dd>
  2857 			<i>Consume a simple block</i>.
  2858 			<i>Consume a list of declarations</i> from the block's value.
  2859 			If anything was returned,
  2860 			assign it to the qualified rule's value.
  2861 			Return the qualified rule.
  2863 		<dt><i>simple block</i> with an associated token of {
  2864 		<dd>
  2865 			<i>Consume a list of declarations</i> from the block's value.
  2866 			If anything was returned,
  2867 			assign it to the qualified rule's value.
  2868 			Return the qualified rule.
  2870 		<dt>anything else
  2871 		<dd>
  2872 			<i>Consume a component value</i>.
  2873 			Append the returned value to the qualified rule's prelude.
  2874 	</dl>
  2877 <h4>
  2878 <dfn>Consume a list of declarations</dfn></h4>
  2880 	<p>
  2881 		Create an initially empty list of declarations.
  2883 	<p>
  2884 		Repeatedly consume the <i>next input token</i>:
  2886 	<dl>
  2887 		<dt>whitespace token
  2888 		<dt>semicolon token
  2889 		<dd>
  2890 			Do nothing.
  2892 		<dt>EOF token
  2893 		<dd>
  2894 			Return the list of declarations.
  2896 		<dt>at-keyword token
  2897 		<dd>
  2898 			<i>Reconsume the current input token</i>.
  2899 			If the token's value is on the list of <i>recognized at-rule names</i>,
  2900 			and is noted as <i>rule-filled</i> or <i>declaration-filled</i>,
  2901 			<i>consume an at-rule</i>;
  2902 			otherwise,
  2903 			<i>consume an at-statement</i>.
  2904 			If anything was returned,
  2905 			append it to the list of declarations.
  2907 		<dt>ident token
  2908 		<dd>
  2909 			Initialize a temporary list initially filled with the <i>current input token</i>.
  2910 			Repeatedly <i>consume a component value</i> from the <i>next input token</i> 
  2911 			until a semicolon token or EOF token is returned,
  2912 			appending all of the returned values up to that point to the temporary list.
  2913 			<i>Consume a declaration</i> from the temporary list.
  2914 			If anything was returned,
  2915 			append it to the list of declarations.
  2917 		<dt>anything else</dd>
  2918 		<dd>
  2919 			This is a <i>parse error</i>.
  2920 			Repeatedly consume the <i>next input token</i>
  2921 			until it is a semicolon token or EOF token.
  2922 	</dl>
  2925 <h4>
  2926 <dfn>Consume a declaration</dfn></h4>
  2928 	<p>
  2929 		Create a new declaration
  2930 		with its name set to the value of the <i>current input token</i>.
  2932 	<p>
  2933 		Repeatedly consume whitespace tokens until a non-whitespace token is reached.
  2934 		If this token is anything but a colon token,
  2935 		this is a <i>parse error</i>.
  2936 		Return nothing.
  2938 	<p>
  2939 		Otherwise,
  2940 		repeatedly <i>consume a component value</i> from the <i>next input token</i>
  2941 		until an EOF token is reached,
  2942 		appending all of the returned values up to that point to the declaration's value.
  2944 	<p>
  2945 		If the last two non-whitespace tokens in the declaration's value are
  2946 		a delim token with the value "!"
  2947 		followed by an ident token with a value that is an <i>ASCII case-insensitive</i> match for "important",
  2948 		remove them from the declaration's value
  2949 		and set the declaration's <var>important</var> flag to true.
  2951 	<p>
  2952 		Return the declaration.
  2955 <h4>
  2956 <dfn>Consume a component value</dfn></h4>
  2958 	<p>
  2959 		This section describes how to <i>consume a component value</i>.
  2961 	<p>
  2962 		If the <i>current input token</i>
  2963 		is a {, [, or ( token,
  2964 		<i>consume a simple block</i>
  2965 		and return it.
  2967 	<p>
  2968 		Otherwise, if the <i>current input token</i>
  2969 		is a function token,
  2970 		<i>consume a function</i>
  2971 		and return it.
  2973 	<p>
  2974 		Otherwise, return the <i>current input token</i>.
  2976 <h4>
  2977 <dfn>Consume a component value with the hashless color quirk</dfn></h4>
  2979 	<p>
  2980 		This section describes how to <i>consume a component value with the hashless color quirk</i>.
  2982 	<p>
  2983 		The <dfn>hashless color quirk list</dfn> contains the following property names:
  2985 	<ul>
  2986 		<li>'background-color'
  2987 		<li>'border-color'
  2988 		<li>'border-top-color'
  2989 		<li>'border-right-color'
  2990 		<li>'border-bottom-color'
  2991 		<li>'border-left-color'
  2992 		<li>'color'
  2993 	</ul>
  2995 	<p>
  2996 		If the <i>current input token</i> is a number token,
  2997 		let <var>value</var> be the token's representation.
  2998 		If the <i>current input token</i> is a dimension token,
  2999 		let <var>value</var> be the token's representation followed by the token's unit.
  3000 		If the <i>current input token</i> is an ident token,
  3001 		let <var>value</var> be the token's value.
  3003 	<p>
  3004 		If <var>value</var> has a length of 3 or 6 and is composed solely of <i>hex digits</i>,
  3005 		create a hash token with its value set to the <var>value</var>
  3006 		and return it.
  3008 	<p>
  3009 		Otherwise,
  3010 		<i>consume a component value</i>
  3011 		and return the returned value.
  3013 <h4>
  3014 <dfn>Consume a component value with the unitless length quirk</dfn></h4>
  3016 	<p>
  3017 		This section describes how to <i>consume a component value with the unitless length quirk</i>.
  3019 	<p>
  3020 		The <dfn>unitless length quirk list</dfn> contains the following property names:
  3022 	<ul>
  3023 		<li>'border-top-width'
  3024 		<li>'border-right-width'
  3025 		<li>'border-bottom-width'
  3026 		<li>'border-left-width'
  3027 		<li>'border-width'
  3028 		<li>'bottom'
  3029 		<li>'font-size'
  3030 		<li>'height'
  3031 		<li>'left'
  3032 		<li>'letter-spacing'
  3033 		<li>'margin'
  3034 		<li>'margin-right'
  3035 		<li>'margin-left'
  3036 		<li>'margin-top'
  3037 		<li>'margin-bottom'
  3038 		<li>'padding'
  3039 		<li>'padding-top'
  3040 		<li>'padding-right'
  3041 		<li>'padding-bottom'
  3042 		<li>'padding-left'
  3043 		<li>'right'
  3044 		<li>'top'
  3045 		<li>'width'
  3046 		<li>'word-spacing'
  3047 	</ul>
  3049 	<p>
  3050 		If the <i>current input token</i> is a number token,
  3051 		create a dimension token with its value and representation set to the token's value and representation,
  3052 		and its unit set to "px".
  3053 		Return the dimension token.
  3055 	<p>
  3056 		Otherwise,
  3057 		<i>consume a component value</i>
  3058 		and return the returned value.
  3062 <h4>
  3063 <dfn>Consume a simple block</dfn></h4>
  3065 	<p>
  3066 		This section describes how to <i>consume a simple block</i>.
  3068 	<p>
  3069 		The <dfn>ending token</dfn> is the mirror variant of the <i>current input token</i>.
  3070 		(E.g. if it was called with [, the <i>ending token</i> is ].)
  3072 	<p>
  3073 		Create a simple block with its associated token set to the <i>current input token</i>.
  3075 	<p>
  3076 		Repeatedly consume the <i>next input token</i> and process it as follows:
  3078 	<dl>
  3079 		<dt>EOF token
  3080 		<dt><i>ending token</i>
  3081 		<dd>
  3082 			Return the block.
  3084 		<dt>anything else
  3085 		<dd>
  3086 			<i>Consume a component value</i>
  3087 			and append it to the value of the block.
  3088 	</dl>
  3091 <h4>
  3092 <dfn>Consume a function</dfn></h4>
  3094 	<p>
  3095 		This section describes how to <i>consume a function</i>.
  3097 	<p>
  3098 		Create a function with a name equal to the value of the <i>current input token</i>,
  3099 		and an argument list which is initially empty.
  3100 		Create an argument,
  3101 		called the <dfn>current argument</dfn>,
  3102 		with a value which is initially an empty list.
  3104 	<p>
  3105 		Repeatedly consume the <i>next input token</i> and process it as follows:
  3107 	<dl>
  3108 		<dt>EOF token
  3109 		<dt>) token
  3110 		<dd>
  3111 			Return the function.
  3113 		<dt>comma token
  3114 		<dd>
  3115 			Append the <i>current argument</i> to the function's argument list.
  3116 			Create a new <i>current argument</i> which is initially empty.
  3118 		<dt>number token
  3119 		<dd>
  3120 			If the <i>quirks mode</i> flag is set,
  3121 			and the function's name is as <i>ASCII case-insensitive</i> match with "rect",
  3122 			<i>consume a component value with the unitless length quirk</i>.
  3123 			If anything was returned,
  3124 			append the returned value
  3125 			to the value of the <i>current argument</i>;
  3126 			otherwise, set the <var>valid</var> flag to false.
  3128 			<p>
  3129 				Otherwise,
  3130 				<i>consume a component value</i>.
  3131 				If anything was returned,
  3132 				append the returned value
  3133 				to the value of the <i>current argument</i>;
  3134 				otherwise, set the <var>valid</var> flag to false.
  3136 		<dt>anything else
  3137 		<dd>
  3138 			<i>Consume a component value</i>
  3139 			and append the returned value
  3140 			to the value of the <i>current argument</i>.
  3141 	</dl>
  3145 <h3>
  3146 Changes from CSS 2.1 Core Grammar</h3>
  3148 	<p>
  3149 		<em>This section is non-normative.</em>
  3151 	<p class='issue'>
  3152 		Note that the point of this spec is to match reality;
  3153 		changes from CSS2.1&apos;s Core Grammar are nearly always because the Core Grammar specified something that doesn't match actual browser behavior,
  3154 		or left something unspecified.
  3155 		If some detail doesn't match browsers,
  3156 		please let me know
  3157 		as it's almost certainly unintentional.
  3159 	<ol>
  3160 		<li>
  3161 			The handling of some miscellanous "special" tokens
  3162 			(like an unmatched } token)
  3163 			showing up in various places in the grammar
  3164 			has been specified with some reasonable behavior shown by at least one browser.
  3165 			Previously, stylesheets with those tokens in those places just didn't match the stylesheet grammar at all,
  3166 			so their handling was totally undefined.
  3167 			Specifically:
  3169 			<ul>
  3170 				<li>
  3171 					[] blocks, () blocks and functions can now contain {} blocks, at-keywords or semicolons
  3173 				<li>
  3174 					Selectors can now contain semicolons
  3176 				<li>
  3177 					Selectors and at-rule preludes can now contain at-keywords
  3178 			</ul>
  3180 		<li>
  3181 			Quirks mode parsing differences are now officially recognized in the parser.
  3182 	</ol>
  3187 <h2>Serialization</h2>
  3189 	<p>
  3190 		This specification does not define how to serialize CSS in general,
  3191 		leaving that task to the CSSOM and individual feature specifications.
  3192 		However, there is one important facet that must be specified here regarding comments,
  3193 		to ensure accurate "round-tripping" of data from text to CSS objects and back.
  3195 	<p>
  3196 		The tokenizer described in this specification does not produce tokens for comments,
  3197 		or otherwise preserve them in any way.
  3198 		Implementations may preserve the contents of comments and their location in the token stream.
  3199 		If they do, this preserved information must have no effect on the parsing step,
  3200 		but must be serialized in its position as
  3201 		"/*"
  3202 		followed by its contents
  3203 		followed by "*/".
  3205 	<p>
  3206 		If the implementation does not preserve comments,
  3207 		it must insert the text "/**/" between the serialization of adjacent tokens
  3208 		when the two tokens are of the following pairs:
  3210 	<ul>
  3211 		<li>
  3212 			hash or at-keyword token followed by a number, percentage, ident, dimension, unicode-range, url, or a function token;
  3214 		<li>
  3215 			number, ident, and dimension tokens in any combination;
  3217 		<li>
  3218 			number, ident, or dimension token followed by a percentage, unicode-range, url, or function token;
  3220 		<li>
  3221 			ident token followed by a ( token;
  3223 		<li>
  3224 			a delim token containing "#" or "@" followed by any token except whitespace;
  3226 		<li>
  3227 			a delim token containing "-", "+", ".", "&lt;", ">", or "!" following or followed by any token except whitespace;
  3229 		<li>
  3230 			a delim token containing "/" following or followed by a delim token containing "*".
  3231 	</ul>
  3233 	<p class='note'>
  3234 		The preceding pairs of tokens can only be adjacent due to comments in the original text,
  3235 		so the above rule reinserts the minimum number of comments into the serialized text to ensure an accurate round-trip.
  3236 		(Roughly.  The delim token rules are slightly too powerful, for simplicity.)
  3241 <!--
  3243 TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHH     HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE
  3244 T:::::::::::::::::::::TH:::::::H     H:::::::HE::::::::::::::::::::E
  3245 T:::::::::::::::::::::TH:::::::H     H:::::::HE::::::::::::::::::::E
  3246 T:::::TT:::::::TT:::::THH::::::H     H::::::HHEE::::::EEEEEEEEE::::E
  3247 TTTTTT  T:::::T  TTTTTT  H:::::H     H:::::H    E:::::E       EEEEEE
  3248         T:::::T          H:::::H     H:::::H    E:::::E
  3249         T:::::T          H::::::HHHHH::::::H    E::::::EEEEEEEEEE
  3250         T:::::T          H:::::::::::::::::H    E:::::::::::::::E
  3251         T:::::T          H:::::::::::::::::H    E:::::::::::::::E
  3252         T:::::T          H::::::HHHHH::::::H    E::::::EEEEEEEEEE
  3253         T:::::T          H:::::H     H:::::H    E:::::E
  3254         T:::::T          H:::::H     H:::::H    E:::::E       EEEEEE
  3255       TT:::::::TT      HH::::::H     H::::::HHEE::::::EEEEEEEE:::::E
  3256       T:::::::::T      H:::::::H     H:::::::HE::::::::::::::::::::E
  3257       T:::::::::T      H:::::::H     H:::::::HE::::::::::::::::::::E
  3258       TTTTTTTTTTT      HHHHHHHHH     HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE
  3262 EEEEEEEEEEEEEEEEEEEEEENNNNNNNN        NNNNNNNNDDDDDDDDDDDDD
  3263 E::::::::::::::::::::EN:::::::N       N::::::ND::::::::::::DDD
  3264 E::::::::::::::::::::EN::::::::N      N::::::ND:::::::::::::::DD
  3265 EE::::::EEEEEEEEE::::EN:::::::::N     N::::::NDDD:::::DDDDD:::::D
  3266   E:::::E       EEEEEEN::::::::::N    N::::::N  D:::::D    D:::::D
  3267   E:::::E             N:::::::::::N   N::::::N  D:::::D     D:::::D
  3268   E::::::EEEEEEEEEE   N:::::::N::::N  N::::::N  D:::::D     D:::::D
  3269   E:::::::::::::::E   N::::::N N::::N N::::::N  D:::::D     D:::::D
  3270   E:::::::::::::::E   N::::::N  N::::N:::::::N  D:::::D     D:::::D
  3271   E::::::EEEEEEEEEE   N::::::N   N:::::::::::N  D:::::D     D:::::D
  3272   E:::::E             N::::::N    N::::::::::N  D:::::D     D:::::D
  3273   E:::::E       EEEEEEN::::::N     N:::::::::N  D:::::D    D:::::D
  3274 EE::::::EEEEEEEE:::::EN::::::N      N::::::::NDDD:::::DDDDD:::::D
  3275 E::::::::::::::::::::EN::::::N       N:::::::ND:::::::::::::::DD
  3276 E::::::::::::::::::::EN::::::N        N::::::ND::::::::::::DDD
  3277 EEEEEEEEEEEEEEEEEEEEEENNNNNNNN         NNNNNNNDDDDDDDDDDDDD
  3278 -->
  3280 <h2 id="conformance">
  3281 Conformance</h2>
  3283 <h3 id="conventions">
  3284 Document conventions</h3>
  3286 	<p>Conformance requirements are expressed with a combination of
  3287 	descriptive assertions and RFC 2119 terminology. The key words “MUST”,
  3288 	“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
  3289 	“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
  3290 	document are to be interpreted as described in RFC 2119.
  3291 	However, for readability, these words do not appear in all uppercase
  3292 	letters in this specification.
  3294 	<p>All of the text of this specification is normative except sections
  3295 	explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
  3297 	<p>Examples in this specification are introduced with the words “for example”
  3298 	or are set apart from the normative text with <code>class="example"</code>,
  3299 	like this:
  3301 	<div class="example">
  3302 		<p>This is an example of an informative example.</p>
  3303 	</div>
  3305 	<p>Informative notes begin with the word “Note” and are set apart from the
  3306 	normative text with <code>class="note"</code>, like this:
  3308 	<p class="note">Note, this is an informative note.</p>
  3310 <h3 id="conformance-classes">
  3311 Conformance classes</h3>
  3313 	<p>Conformance to CSS Syntax Module Level 3 is defined for three conformance classes:
  3315 	<dl>
  3316 		<dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
  3317 			<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
  3318 			style sheet</a>.
  3319 		<dt><dfn>renderer</dfn>
  3320 			<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  3321 			that interprets the semantics of a style sheet and renders
  3322 			documents that use them.
  3323 		<dt><dfn id="authoring-tool">authoring tool</dfn>
  3324 			<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  3325 			that writes a style sheet.
  3326 	</dl>
  3328 	<p>A style sheet is conformant to CSS Syntax Module Level 3
  3329 	if it is syntactically valid according to this module.
  3331 	<p>A renderer is conformant to CSS Syntax Module Level 3
  3332 	if it parses a stylesheet according to this module.
  3334 	<p>An authoring tool is conformant to CSS Syntax Module Level 3
  3335 	if it writes style sheets that are syntactically valid according to this module.
  3337 <h2 class=no-num id="acknowledgments">
  3338 Acknowledgments</h2>
  3340 	<p>
  3341 		Thanks for feedback and contributions from
  3342 		David Baron,
  3343 		呂康豪 (Kang-Hao Lu),
  3344 		and Simon Sapin.
  3347 <h2 class=no-num id="references">
  3348 References</h2>
  3350 <h3 class="no-num" id="normative-references">
  3351 Normative references</h3>
  3352 <!--normative-->
  3354 <h3 class="no-num" id="other-references">
  3355 Other references</h3>
  3356 <!--informative-->
  3358 <h2 class="no-num" id="index">
  3359 Index</h2>
  3360 <!--index-->
  3362 <h2 class="no-num" id="property-index">
  3363 Property index</h2>
  3364 <!-- properties -->
  3366 </body>
  3367 </html>
  3368 <!-- Keep this comment at the end of the file
  3369 Local variables:
  3370 mode: sgml
  3371 sgml-declaration:"~/SGML/HTML4.decl"
  3372 sgml-default-doctype-name:"html"
  3373 sgml-minimize-attributes:t
  3374 sgml-nofill-elements:("pre" "style" "br")
  3375 sgml-live-element-indicator:t
  3376 sgml-omittag:nil
  3377 sgml-shorttag:nil
  3378 sgml-namecase-general:t
  3379 sgml-general-insert-case:lower
  3380 sgml-always-quote-attributes:t
  3381 sgml-indent-step:nil
  3382 sgml-indent-data:t
  3383 sgml-parent-document:nil
  3384 sgml-exposed-tags:nil
  3385 sgml-local-catalogs:nil
  3386 sgml-local-ecat-files:nil
  3387 End:
  3388 -->

mercurial