Skip to content

Commit 582f5d8

Browse files
committed
[css-syntax] Fix a similar bug in the 'parse a rule' section. Make all the parse algos consistent in how they deal with leading whitespace.
1 parent 0f21024 commit 582f5d8

2 files changed

Lines changed: 22 additions & 30 deletions

File tree

css-syntax/Overview.bs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,19 +2155,17 @@ Parse a rule</h4>
21552155

21562156
<ol>
21572157
<li>
2158-
<a>Consume the next input token</a>.
2159-
2160-
<li>
2161-
While the <a>current input token</a> is a <<whitespace-token>>,
2158+
While the <a>next input token</a> is a <<whitespace-token>>,
21622159
<a>consume the next input token</a>.
21632160

21642161
<li>
2165-
If the <a>current input token</a> is an <<EOF-token>>,
2162+
If the <a>next input token</a> is an <<EOF-token>>,
21662163
return a syntax error.
21672164

21682165
Otherwise,
2169-
if the <a>current input token</a> is an <<at-keyword-token>>,
2170-
<a>consume an at-rule</a>
2166+
if the <a>next input token</a> is an <<at-keyword-token>>,
2167+
consume it
2168+
and <a>consume an at-rule</a>,
21712169
and let <var>rule</var> be the return value.
21722170

21732171
Otherwise,
@@ -2177,11 +2175,11 @@ Parse a rule</h4>
21772175
return a syntax error.
21782176

21792177
<li>
2180-
While the <a>current input token</a> is a <<whitespace-token>>,
2178+
While the <a>next input token</a> is a <<whitespace-token>>,
21812179
<a>consume the next input token</a>.
21822180

21832181
<li>
2184-
If the <a>current input token</a> is an <<EOF-token>>,
2182+
If the <a>next input token</a> is an <<EOF-token>>,
21852183
return <var>rule</var>.
21862184
Otherwise, return a syntax error.
21872185
</ol>
@@ -2196,18 +2194,16 @@ Parse a declaration</h4>
21962194

21972195
<ol>
21982196
<li>
2199-
<a>Consume the next input token</a>.
2200-
2201-
<li>
2202-
While the <a>current input token</a> is a <<whitespace-token>>,
2197+
While the <a>next input token</a> is a <<whitespace-token>>,
22032198
<a>consume the next input token</a>.
22042199

22052200
<li>
2206-
If the <a>current input token</a> is not an <<ident-token>>,
2201+
If the <a>next input token</a> is not an <<ident-token>>,
22072202
return a syntax error.
22082203

22092204
<li>
2210-
<a>Consume a declaration</a>.
2205+
<a>Consume the next input token</a>,
2206+
then <a>consume a declaration</a>.
22112207
If anything was returned, return it.
22122208
Otherwise, return a syntax error.
22132209
</ol>

css-syntax/Overview.html

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,19 +3668,17 @@ <h4 class="heading settled heading" data-level=5.3.3 id=parse-a-rule><span class
36683668

36693669
<ol>
36703670
<li>
3671-
<a data-link-type=dfn href=#consume-the-next-input-token title="consume the next input token">Consume the next input token</a>.
3672-
3673-
<li>
3674-
While the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is a <a class="production css-code" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>">&lt;whitespace-token&gt;</a>,
3671+
While the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is a <a class="production css-code" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>">&lt;whitespace-token&gt;</a>,
36753672
<a data-link-type=dfn href=#consume-the-next-input-token title="consume the next input token">consume the next input token</a>.
36763673

36773674
<li>
3678-
If the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is an <a class="production css-code" data-link-type=type href=#typedef-eof-token title="<eof-token>">&lt;EOF-token&gt;</a>,
3675+
If the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is an <a class="production css-code" data-link-type=type href=#typedef-eof-token title="<eof-token>">&lt;EOF-token&gt;</a>,
36793676
return a syntax error.
36803677

36813678
<p> Otherwise,
3682-
if the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is an <a class="production css-code" data-link-type=type href=#typedef-at-keyword-token title="<at-keyword-token>">&lt;at-keyword-token&gt;</a>,
3683-
<a data-link-type=dfn href=#consume-an-at-rule0 title="consume an at-rule">consume an at-rule</a>
3679+
if the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is an <a class="production css-code" data-link-type=type href=#typedef-at-keyword-token title="<at-keyword-token>">&lt;at-keyword-token&gt;</a>,
3680+
consume it
3681+
and <a data-link-type=dfn href=#consume-an-at-rule0 title="consume an at-rule">consume an at-rule</a>,
36843682
and let <var>rule</var> be the return value.
36853683

36863684
<p> Otherwise,
@@ -3690,11 +3688,11 @@ <h4 class="heading settled heading" data-level=5.3.3 id=parse-a-rule><span class
36903688
return a syntax error.
36913689

36923690
<li>
3693-
While the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is a <a class="production css-code" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>">&lt;whitespace-token&gt;</a>,
3691+
While the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is a <a class="production css-code" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>">&lt;whitespace-token&gt;</a>,
36943692
<a data-link-type=dfn href=#consume-the-next-input-token title="consume the next input token">consume the next input token</a>.
36953693

36963694
<li>
3697-
If the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is an <a class="production css-code" data-link-type=type href=#typedef-eof-token title="<eof-token>">&lt;EOF-token&gt;</a>,
3695+
If the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is an <a class="production css-code" data-link-type=type href=#typedef-eof-token title="<eof-token>">&lt;EOF-token&gt;</a>,
36983696
return <var>rule</var>.
36993697
Otherwise, return a syntax error.
37003698
</ol>
@@ -3709,18 +3707,16 @@ <h4 class="heading settled heading" data-level=5.3.4 id=parse-a-declaration><spa
37093707

37103708
<ol>
37113709
<li>
3712-
<a data-link-type=dfn href=#consume-the-next-input-token title="consume the next input token">Consume the next input token</a>.
3713-
3714-
<li>
3715-
While the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is a <a class="production css-code" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>">&lt;whitespace-token&gt;</a>,
3710+
While the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is a <a class="production css-code" data-link-type=type href=#typedef-whitespace-token title="<whitespace-token>">&lt;whitespace-token&gt;</a>,
37163711
<a data-link-type=dfn href=#consume-the-next-input-token title="consume the next input token">consume the next input token</a>.
37173712

37183713
<li>
3719-
If the <a data-link-type=dfn href=#current-input-token title="current input token">current input token</a> is not an <a class="production css-code" data-link-type=type href=#typedef-ident-token title="<ident-token>">&lt;ident-token&gt;</a>,
3714+
If the <a data-link-type=dfn href=#next-input-token title="next input token">next input token</a> is not an <a class="production css-code" data-link-type=type href=#typedef-ident-token title="<ident-token>">&lt;ident-token&gt;</a>,
37203715
return a syntax error.
37213716

37223717
<li>
3723-
<a data-link-type=dfn href=#consume-a-declaration0 title="consume a declaration">Consume a declaration</a>.
3718+
<a data-link-type=dfn href=#consume-the-next-input-token title="consume the next input token">Consume the next input token</a>,
3719+
then <a data-link-type=dfn href=#consume-a-declaration0 title="consume a declaration">consume a declaration</a>.
37243720
If anything was returned, return it.
37253721
Otherwise, return a syntax error.
37263722
</ol>

0 commit comments

Comments
 (0)