Skip to content

Commit 895b0af

Browse files
committed
[css-syntax] Drop incorrect comparison of railroad diagram and regular expressions.
http://lists.w3.org/Archives/Public/www-style/2014May/0151.html
1 parent 5366d8b commit 895b0af

2 files changed

Lines changed: 33 additions & 23 deletions

File tree

css-syntax/Overview.bs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,8 +1886,6 @@ Parser Railroad Diagrams</h3>
18861886

18871887
This section presents an informative view of the parser,
18881888
in the form of railroad diagrams.
1889-
Railroad diagrams are more compact than a state-machine,
1890-
but often easier to read than a regular expression.
18911889

18921890
These diagrams are <em>informative</em> and <em>incomplete</em>;
18931891
they describe the grammar of "correct" stylesheets,

css-syntax/Overview.html

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
<body class=h-entry>
5454
<div class=head>
5555
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
56-
<img alt=W3C height=48 src=http://www.w3.org/Icons/w3c_home width=72>
56+
<img alt=W3C height=48 src=https://www.w3.org/Icons/w3c_home width=72>
5757
</a>
5858
</p>
5959
<h1 class="p-name no-ref" id=title>CSS Syntax Module Level 3</h1>
6060
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
61-
<span class=dt-updated><span class=value-title title=20140514>14 May 2014</span></span></span></h2>
61+
<span class=dt-updated><span class=value-title title=20140521>21 May 2014</span></span></span></h2>
6262
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-syntax-3/>http://www.w3.org/TR/css-syntax-3/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/ rel=previous>http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/</a>
6363
<dt>Feedback:</dt>
6464
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-syntax%5D%20feedback">www-style@w3.org</a>
@@ -256,15 +256,15 @@ <h2 class="heading settled heading" data-level=2 id=syntax-description><span cla
256256
}
257257
</pre>
258258

259-
In the above rule, "<code>p &gt; a</code>" is the selector,
259+
<p>In the above rule, "<code>p &gt; a</code>" is the selector,
260260
which, if the source document is HTML,
261-
selects any <code>&lt;a&gt;</code> elements that are children of a <code>&lt;p&gt;</code> element.
261+
selects any <code>&lt;a&gt;</code> elements that are children of a <code>&lt;p&gt;</code> element.</p>
262262

263-
"<code>color: blue;</code>" is a declaration specifying that,
263+
<p>"<code>color: blue;</code>" is a declaration specifying that,
264264
for the elements that match the selector,
265265
their <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-color-3/#color0 title=color>color</a> property should have the value <span class=css data-link-type=maybe title=blue>blue</span>.
266266
Similarly, their <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-text-decor-3/#propdef-text-decoration title=text-decoration>text-decoration</a> property should have the value <span class=css data-link-type=maybe title=underline>underline</span>.
267-
</div>
267+
</div><p></p>
268268

269269
<p>At-rules are all different, but they have a basic structure in common.
270270
They start with an "@" <a data-link-type=dfn href=#code-point title="code point">code point</a> followed by their name.
@@ -476,11 +476,11 @@ <h3 class="heading settled heading" data-level=3.2 id=input-byte-stream><span cl
476476

477477
<pre>40 63 68 61 72 73 65 74 20 22 XX* 22 3B</pre>
478478

479-
where each <code>XX</code> byte is a value between 0<sub>16</sub> and 21<sub>16</sub> inclusive
479+
<p>where each <code>XX</code> byte is a value between 0<sub>16</sub> and 21<sub>16</sub> inclusive
480480
or a value between 23<sub>16</sub> and 7F<sub>16</sub> inclusive,
481481
then <a data-link-type=dfn href=#get-an-encoding title="get an encoding">get an encoding</a>
482482
for the sequence of <code>XX</code> bytes,
483-
interpreted as <code>ASCII</code>.
483+
interpreted as <code>ASCII</code>.</p>
484484

485485
<details class=why>
486486
<summary>What does that byte sequence mean?</summary>
@@ -491,25 +491,25 @@ <h3 class="heading settled heading" data-level=3.2 id=input-byte-stream><span cl
491491
where the "…" is the sequence of bytes corresponding to the encoding’s label.
492492
</details><p></p>
493493

494-
If the return value was <code>utf-16be</code> or <code>utf-16le</code>,
494+
<p>If the return value was <code>utf-16be</code> or <code>utf-16le</code>,
495495
use <code>utf-8</code> as the fallback encoding;
496496
if it was anything else except failure,
497-
use the return value as the fallback encoding.
497+
use the return value as the fallback encoding.</p>
498498

499499
<details class=why>
500500
<summary>Why use utf-8 when the declaration says utf-16?</summary>
501501

502-
The bytes of the encoding declaration spell out “<code>@charset "…";</code>” in ASCII,
502+
<p>The bytes of the encoding declaration spell out “<code>@charset "…";</code>” in ASCII,
503503
but UTF-16 is not ASCII-compatible.
504504
Either you’ve typed in complete gibberish (like <code>䁣桡牳整•utf-16be∻</code>) to get the right bytes in the document,
505505
which we don’t want to encourage,
506506
or your document is actually in an ASCII-compatible encoding
507-
and your encoding declaration is lying.
507+
and your encoding declaration is lying.</p>
508508

509509
<p>Either way, defaulting to UTF-8 is a decent answer.</p>
510510

511-
As well, this mimics the behavior of HTML’s <code>&lt;meta charset&gt;</code> attribute.
512-
</details>
511+
<p>As well, this mimics the behavior of HTML’s <code>&lt;meta charset&gt;</code> attribute.
512+
</details><p></p>
513513

514514
<p class=note>Note: Note that the syntax of an encoding declaration <em>looks like</em> the syntax of an <a class=css-code data-link-type=at-rule href=#at-ruledef-charset title=@charset>@charset</a> rule,
515515
but it’s actually much more restrictive.
@@ -554,11 +554,11 @@ <h3 class="heading settled heading" data-level=3.2 id=input-byte-stream><span cl
554554
New formats and new linking mechanisms <b>should not</b> provide an <a data-link-type=dfn href=#environment-encoding title="environment encoding">environment encoding</a>,
555555
so the stylesheet defaults to UTF-8 instead in the absence of more explicit information.</p>
556556

557-
Note: <a data-biblio-type=informative data-link-type=biblio href=#html title=html>[HTML]</a> defines <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-stylesheet>the environment encoding for <code>&lt;link rel=stylesheet&gt;</code></a>.
557+
<p class=note>Note: <a data-biblio-type=informative data-link-type=biblio href=#html title=html>[HTML]</a> defines <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-stylesheet>the environment encoding for <code>&lt;link rel=stylesheet&gt;</code></a>.</p>
558558

559-
Note: <a data-biblio-type=informative data-link-type=biblio href=#cssom title=cssom>[CSSOM]</a> defines <a href=http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction>the environment encoding for <code>&lt;xml-stylesheet?&gt;</code></a>.
559+
<p class=note>Note: <a data-biblio-type=informative data-link-type=biblio href=#cssom title=cssom>[CSSOM]</a> defines <a href=http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction>the environment encoding for <code>&lt;xml-stylesheet?&gt;</code></a>.</p>
560560

561-
Note: <a data-biblio-type=informative data-link-type=biblio href=#css3cascade title=css3cascade>[CSS3CASCADE]</a> defines <a href=http://dev.w3.org/csswg/css-cascade/#at-ruledef-import>the environment encoding for <code>@import</code></a>.
561+
<p class=note>Note: <a data-biblio-type=informative data-link-type=biblio href=#css3cascade title=css3cascade>[CSS3CASCADE]</a> defines <a href=http://dev.w3.org/csswg/css-cascade/#at-ruledef-import>the environment encoding for <code>@import</code></a>.</p>
562562

563563

564564
<h3 class="heading settled heading" data-level=3.3 id=input-preprocessing><span class=secno>3.3 </span><span class=content>
@@ -2962,8 +2962,6 @@ <h3 class="heading settled heading" data-level=5.1 id=parser-diagrams><span clas
29622962

29632963
This section presents an informative view of the parser,
29642964
in the form of railroad diagrams.
2965-
Railroad diagrams are more compact than a state-machine,
2966-
but often easier to read than a regular expression.
29672965

29682966
These diagrams are <em>informative</em> and <em>incomplete</em>;
29692967
they describe the grammar of "correct" stylesheets,
@@ -5117,11 +5115,25 @@ <h2 class="no-num no-ref heading settled heading" id=references><span class=cont
51175115

51185116
<h3 class="no-num no-ref heading settled heading" id=normative><span class=content>
51195117
Normative References</span><a class=self-link href=#normative></a></h3>
5120-
<div data-fill-with=normative-references><dl><dt id=css21 title=CSS21><a class=self-link href=#css21></a>[CSS21]<dd>Bert Bos; et al. <a href=http://www.w3.org/TR/2011/REC-CSS2-20110607>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. W3C Recommendation. URL: <a href=http://www.w3.org/TR/2011/REC-CSS2-20110607>http://www.w3.org/TR/2011/REC-CSS2-20110607</a><dt id=css3cascade title=CSS3CASCADE><a class=self-link href=#css3cascade></a>[CSS3CASCADE]<dd>Håkon Wium Lie; Elika J. Etemad; Tab Atkins Jr.. <a href=http://www.w3.org/TR/2013/CR-css-cascade-3-20131003/>CSS Cascading and Inheritance Level 3</a>. 3 October 2013. W3C Candidate Recommendation. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/CR-css-cascade-3-20131003/>http://www.w3.org/TR/2013/CR-css-cascade-3-20131003/</a><dt id=encoding title=ENCODING><a class=self-link href=#encoding></a>[ENCODING]<dd>Anne van Kesteren; Joshua Bell. <a href=http://encoding.spec.whatwg.org/>Encoding</a>. Living Standard. URL: <a href=http://encoding.spec.whatwg.org/>http://encoding.spec.whatwg.org/</a><dt id=rfc2119 title=RFC2119><a class=self-link href=#rfc2119></a>[RFC2119]<dd>S. Bradner. <a href=http://www.ietf.org/rfc/rfc2119.txt>Key words for use in RFCs to Indicate Requirement Levels</a>. URL: <a href=http://www.ietf.org/rfc/rfc2119.txt>http://www.ietf.org/rfc/rfc2119.txt</a><dt id=select title=SELECT><a class=self-link href=#select></a>[SELECT]<dd>Tantek Çelik; et al. <a href=http://www.w3.org/TR/2011/REC-css3-selectors-20110929/>Selectors Level 3</a>. 29 September 2011. W3C Recommendation. URL: <a href=http://www.w3.org/TR/2011/REC-css3-selectors-20110929/>http://www.w3.org/TR/2011/REC-css3-selectors-20110929/</a><dt id=unicode title=UNICODE><a class=self-link href=#unicode></a>[UNICODE]<dd>The Unicode Consortium. <a href=http://www.unicode.org/standard/versions/enumeratedversions.html>The Unicode Standard</a>. 2013. Defined by: The Unicode Standard, Version 6.3.0, (Mountain View, CA: The Unicode Consortium, 2013. ISBN 978-1-936213-08-5), as updated from time to time by the publication of new versions URL: <a href=http://www.unicode.org/standard/versions/enumeratedversions.html>http://www.unicode.org/standard/versions/enumeratedversions.html</a></dl></div>
5118+
<div data-fill-with=normative-references><dl>
5119+
<dt id=css21 title=CSS21><a class=self-link href=#css21></a>[CSS21]<dd>Bert Bos; et al. <a href=http://www.w3.org/TR/2011/REC-CSS2-20110607>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. W3C Recommendation. URL: <a href=http://www.w3.org/TR/2011/REC-CSS2-20110607>http://www.w3.org/TR/2011/REC-CSS2-20110607</a></dd>
5120+
<dt id=css3cascade title=CSS3CASCADE><a class=self-link href=#css3cascade></a>[CSS3CASCADE]<dd>Håkon Wium Lie; Elika J. Etemad; Tab Atkins Jr.. <a href=http://www.w3.org/TR/2013/CR-css-cascade-3-20131003/>CSS Cascading and Inheritance Level 3</a>. 3 October 2013. W3C Candidate Recommendation. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/CR-css-cascade-3-20131003/>http://www.w3.org/TR/2013/CR-css-cascade-3-20131003/</a></dd>
5121+
<dt id=encoding title=ENCODING><a class=self-link href=#encoding></a>[ENCODING]<dd>Anne van Kesteren; Joshua Bell. <a href=http://encoding.spec.whatwg.org/>Encoding</a>. Living Standard. URL: <a href=http://encoding.spec.whatwg.org/>http://encoding.spec.whatwg.org/</a></dd>
5122+
<dt id=rfc2119 title=RFC2119><a class=self-link href=#rfc2119></a>[RFC2119]<dd>S. Bradner. <a href=http://www.ietf.org/rfc/rfc2119.txt>Key words for use in RFCs to Indicate Requirement Levels</a>. URL: <a href=http://www.ietf.org/rfc/rfc2119.txt>http://www.ietf.org/rfc/rfc2119.txt</a></dd>
5123+
<dt id=select title=SELECT><a class=self-link href=#select></a>[SELECT]<dd>Tantek Çelik; et al. <a href=http://www.w3.org/TR/2011/REC-css3-selectors-20110929/>Selectors Level 3</a>. 29 September 2011. W3C Recommendation. URL: <a href=http://www.w3.org/TR/2011/REC-css3-selectors-20110929/>http://www.w3.org/TR/2011/REC-css3-selectors-20110929/</a></dd>
5124+
<dt id=unicode title=UNICODE><a class=self-link href=#unicode></a>[UNICODE]<dd>The Unicode Consortium. <a href=http://www.unicode.org/standard/versions/enumeratedversions.html>The Unicode Standard</a>. 2013. Defined by: The Unicode Standard, Version 6.3.0, (Mountain View, CA: The Unicode Consortium, 2013. ISBN 978-1-936213-08-5), as updated from time to time by the publication of new versions URL: <a href=http://www.unicode.org/standard/versions/enumeratedversions.html>http://www.unicode.org/standard/versions/enumeratedversions.html</a></dd>
5125+
</dl></div>
51215126

51225127
<h3 class="no-num no-ref heading settled heading" id=informative><span class=content>
51235128
Informative References</span><a class=self-link href=#informative></a></h3>
5124-
<div data-fill-with=informative-references><dl><dt id=css-variables title=CSS-VARIABLES><a class=self-link href=#css-variables></a>[CSS-VARIABLES]<dd>Tab Atkins Jr.; Luke Macpherson; Daniel Glazman. <a href=http://www.w3.org/TR/2013/WD-css-variables-20130620/>CSS Custom Properties for Cascading Variables Module Level 1</a>. 20 June 2013. W3C Working Draft. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/WD-css-variables-20130620/>http://www.w3.org/TR/2013/WD-css-variables-20130620/</a><dt id=css3-animations title=CSS3-ANIMATIONS><a class=self-link href=#css3-animations></a>[CSS3-ANIMATIONS]<dd>Dean Jackson; et al. <a href=http://www.w3.org/TR/2013/WD-css3-animations-20130219/>CSS Animations</a>. 19 February 2013. W3C Working Draft. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/WD-css3-animations-20130219/>http://www.w3.org/TR/2013/WD-css3-animations-20130219/</a><dt id=css3-conditional title=CSS3-CONDITIONAL><a class=self-link href=#css3-conditional></a>[CSS3-CONDITIONAL]<dd>L. David Baron. <a href=http://www.w3.org/TR/2013/CR-css3-conditional-20130404/>CSS Conditional Rules Module Level 3</a>. 4 April 2013. W3C Candidate Recommendation. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/CR-css3-conditional-20130404/>http://www.w3.org/TR/2013/CR-css3-conditional-20130404/</a><dt id=cssom title=CSSOM><a class=self-link href=#cssom></a>[CSSOM]<dd>Anne van Kesteren. <a href=http://www.w3.org/TR/2011/WD-cssom-20110712/>CSSOM</a>. 12 July 2011. W3C Working Draft. (Work in progress.) URL: <a href=http://www.w3.org/TR/2011/WD-cssom-20110712/>http://www.w3.org/TR/2011/WD-cssom-20110712/</a><dt id=html title=HTML><a class=self-link href=#html></a>[HTML]<dd>Ian Hickson. <a href=http://whatwg.org/html>HTML</a>. Living Standard. URL: <a href=http://whatwg.org/html>http://whatwg.org/html</a><dt id=mediaq title=MEDIAQ><a class=self-link href=#mediaq></a>[MEDIAQ]<dd>Florian Rivoal. <a href=http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/>Media Queries</a>. 19 June 2012. W3C Recommendation. URL: <a href=http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/>http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/</a></dl></div>
5129+
<div data-fill-with=informative-references><dl>
5130+
<dt id=css-variables title=CSS-VARIABLES><a class=self-link href=#css-variables></a>[CSS-VARIABLES]<dd>Tab Atkins Jr.; Luke Macpherson; Daniel Glazman. <a href=http://www.w3.org/TR/2013/WD-css-variables-20130620/>CSS Custom Properties for Cascading Variables Module Level 1</a>. 20 June 2013. W3C Working Draft. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/WD-css-variables-20130620/>http://www.w3.org/TR/2013/WD-css-variables-20130620/</a></dd>
5131+
<dt id=css3-animations title=CSS3-ANIMATIONS><a class=self-link href=#css3-animations></a>[CSS3-ANIMATIONS]<dd>Dean Jackson; et al. <a href=http://www.w3.org/TR/2013/WD-css3-animations-20130219/>CSS Animations</a>. 19 February 2013. W3C Working Draft. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/WD-css3-animations-20130219/>http://www.w3.org/TR/2013/WD-css3-animations-20130219/</a></dd>
5132+
<dt id=css3-conditional title=CSS3-CONDITIONAL><a class=self-link href=#css3-conditional></a>[CSS3-CONDITIONAL]<dd>L. David Baron. <a href=http://www.w3.org/TR/2013/CR-css3-conditional-20130404/>CSS Conditional Rules Module Level 3</a>. 4 April 2013. W3C Candidate Recommendation. (Work in progress.) URL: <a href=http://www.w3.org/TR/2013/CR-css3-conditional-20130404/>http://www.w3.org/TR/2013/CR-css3-conditional-20130404/</a></dd>
5133+
<dt id=cssom title=CSSOM><a class=self-link href=#cssom></a>[CSSOM]<dd>Anne van Kesteren. <a href=http://www.w3.org/TR/2011/WD-cssom-20110712/>CSSOM</a>. 12 July 2011. W3C Working Draft. (Work in progress.) URL: <a href=http://www.w3.org/TR/2011/WD-cssom-20110712/>http://www.w3.org/TR/2011/WD-cssom-20110712/</a></dd>
5134+
<dt id=html title=HTML><a class=self-link href=#html></a>[HTML]<dd>Ian Hickson. <a href=http://whatwg.org/html>HTML</a>. Living Standard. URL: <a href=http://whatwg.org/html>http://whatwg.org/html</a></dd>
5135+
<dt id=mediaq title=MEDIAQ><a class=self-link href=#mediaq></a>[MEDIAQ]<dd>Florian Rivoal. <a href=http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/>Media Queries</a>. 19 June 2012. W3C Recommendation. URL: <a href=http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/>http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/</a></dd>
5136+
</dl></div>
51255137

51265138
<h2 class="no-num no-ref heading settled heading" id=index><span class=content>
51275139
Index</span><a class=self-link href=#index></a></h2>

0 commit comments

Comments
 (0)