Skip to content

Commit ad45df6

Browse files
committed
Remove more of the parse errors. Particularly, remove it from 'consume a block' algo, which lets me simplify all the places where I needed to return a block.
--HG-- extra : rebase_source : 8c35b005b7b81e8929699c54b10ac795318c4361
1 parent d199e18 commit ad45df6

2 files changed

Lines changed: 29 additions & 168 deletions

File tree

css3-syntax/Overview.html

Lines changed: 20 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,25 +2106,15 @@ <h4 id=at-rule-mode><span class=secno>3.5.4. </span> <dfn
21062106
<dt><span class=temp>(</span> token
21072107

21082108
<dd> <a href="#consume-a-block0"><i>Consume a block</i></a> with the
2109-
<i>current input token</i>. If a block is returned, append it to the
2110-
prelude of the <a href="#current-rule"><i>current rule</i></a> and remain
2111-
in this mode.
2112-
<p> Otherwise, pop the <a href="#current-rule"><i>current rule</i></a>
2113-
from the <a href="#stack-of-open-rules"><i>stack of open rules</i></a>.
2114-
Switch to the <a
2115-
href="#next-block-or-statement-error-mode0"><i>next-block-or-statement
2116-
error mode</i></a>.
2109+
<i>current input token</i>. Append the returned block to the prelude of
2110+
the <a href="#current-rule"><i>current rule</i></a> and remain in this
2111+
mode.
21172112

21182113
<dt>function token
21192114

2120-
<dd> <i>Consume a function</i> with the <i>current input token</i>. If a
2121-
function is returned, append it to the prelude of the <a
2115+
<dd> <i>Consume a function</i> with the <i>current input token</i>. Append
2116+
the returned function to the prelude of the <a
21222117
href="#current-rule"><i>current rule</i></a> and remain in this mode.
2123-
<p> Otherwise, pop the <a href="#current-rule"><i>current rule</i></a>
2124-
from the <a href="#stack-of-open-rules"><i>stack of open rules</i></a>.
2125-
Switch to the <a
2126-
href="#next-block-or-statement-error-mode0"><i>next-block-or-statement
2127-
error mode</i></a>.
21282118

21292119
<dt>anything else
21302120

@@ -2190,23 +2180,15 @@ <h4 id=style-rule-mode><span class=secno>3.5.6. </span> <dfn
21902180
<dt><span class=temp>(</span> token
21912181

21922182
<dd> <a href="#consume-a-block0"><i>Consume a block</i></a> with the
2193-
<i>current input token</i>. If a block is returned, append it to the
2194-
selector of the <a href="#current-rule"><i>current rule</i></a> and
2195-
remain in this mode.
2196-
<p> Otherwise, pop the <a href="#current-rule"><i>current rule</i></a>
2197-
from the <a href="#stack-of-open-rules"><i>stack of open rules</i></a>.
2198-
Switch to the <a href="#next-block-error-mode0"><i>next-block error
2199-
mode</i></a>.
2183+
<i>current input token</i>. Append the returned block to the selector of
2184+
the <a href="#current-rule"><i>current rule</i></a> and remain in this
2185+
mode.
22002186

22012187
<dt>function token
22022188

2203-
<dd> <i>Consume a function</i> with the <i>current input token</i>. If a
2204-
function is returned, append it to the selector of the <a
2189+
<dd> <i>Consume a function</i> with the <i>current input token</i>. Append
2190+
the returned function to the selector of the <a
22052191
href="#current-rule"><i>current rule</i></a> and remain in this mode.
2206-
<p> Otherwise, pop the <a href="#current-rule"><i>current rule</i></a>
2207-
from the <a href="#stack-of-open-rules"><i>stack of open rules</i></a>.
2208-
Switch to the <a href="#next-block-error-mode0"><i>next-block error
2209-
mode</i></a>.
22102192

22112193
<dt>anything else
22122194

@@ -2284,48 +2266,23 @@ <h4 id=declaration-value-mode><span class=secno>3.5.9. </span> <dfn
22842266
<p> Consume the <a href="#next-input-token"><i>next input token</i></a>.
22852267

22862268
<dl>
2287-
<dt>cdo token
2288-
2289-
<dt>cdc token
2290-
2291-
<dt><span class=temp>]</span> token
2292-
2293-
<dt><span class=temp>)</span> token
2294-
2295-
<dt>bad-string token
2296-
2297-
<dt>bad-url token
2298-
2299-
<dd> This is a <i>parse error</i>. Discard the <a
2300-
href="#current-declaration"><i>current declaration</i></a> and switch to
2301-
the <a href="#next-declaration-error-mode0"><i>next-declaration error
2302-
mode</i></a>.
2303-
23042269
<dt><span class=temp>{</span> token
23052270

23062271
<dt><span class=temp>[</span> token
23072272

23082273
<dt><span class=temp>(</span> token
23092274

23102275
<dd> <a href="#consume-a-block0"><i>Consume a block</i></a> with the
2311-
<i>current input token</i>. If a block is returned, append it to the
2312-
value of the <a href="#current-declaration"><i>current
2313-
declaration</i></a> and remain in this mode.
2314-
<p> Otherwise, discard the <a href="#current-declaration"><i>current
2315-
declaration</i></a> and switch to the <a
2316-
href="#next-declaration-error-mode0"><i>next-declaration error
2317-
mode</i></a>.
2276+
<i>current input token</i>. Append the returned block to the value of the
2277+
<a href="#current-declaration"><i>current declaration</i></a> and remain
2278+
in this mode.
23182279

23192280
<dt>function token
23202281

2321-
<dd> <i>Consume a function</i> with the <i>current input token</i>. If a
2322-
function is returned, append it to the value of the <a
2282+
<dd> <i>Consume a function</i> with the <i>current input token</i>. Append
2283+
the returned function to the value of the <a
23232284
href="#current-declaration"><i>current declaration</i></a>. and remain in
23242285
this mode.
2325-
<p> Otherwise, discard the <a href="#current-declaration"><i>current
2326-
declaration</i></a> and switch to the <a
2327-
href="#next-declaration-error-mode0"><i>next-declaration error
2328-
mode</i></a>.
23292286

23302287
<dt>delim token with a value of "!"
23312288

@@ -2538,28 +2495,7 @@ <h4 id=consume-a-block><span class=secno>3.5.14. </span> <dfn
25382495

25392496
<dt><a href="#ending-token"><i>ending token</i></a>
25402497

2541-
<dd> If the error flag is false, return the block.
2542-
<p> Otherwise, return nothing.
2543-
2544-
<dt>}, ], or ) token (whichever two are not the <a
2545-
href="#ending-token"><i>ending token</i></a>)
2546-
2547-
<dd> This is a <i>parse error</i>. Set the error flag to true.
2548-
2549-
<dt>bad-string token
2550-
2551-
<dt>bad-url token
2552-
2553-
<dt>semicolon token
2554-
2555-
<dt>cdo token
2556-
2557-
<dt>cdc token
2558-
2559-
<dt>at-keyword token
2560-
2561-
<dd> This is a <i>parse error</i>. Set the <a href="#error-flag"><i>error
2562-
flag</i></a> to true.
2498+
<dd> Return the block.
25632499

25642500
<dt><span class=temp>{</span> token
25652501

@@ -2568,19 +2504,14 @@ <h4 id=consume-a-block><span class=secno>3.5.14. </span> <dfn
25682504
<dt><span class=temp>(</span> token
25692505

25702506
<dd> <a href="#consume-a-block0"><i>Consume a block</i></a> with the
2571-
<i>current input token</i>. If it returns a block, append the returned
2572-
block to the value of the <a href="#current-block"><i>current
2573-
block</i></a>.
2574-
<p> Otherwise, set the <a href="#error-flag"><i>error flag</i></a> to
2575-
true.
2507+
<i>current input token</i>. Append the returned block to the value of the
2508+
<a href="#current-block"><i>current block</i></a>.
25762509

25772510
<dt>function token
25782511

2579-
<dd> <i>Consume a function</i> with the <i>current input token</i>. If it
2580-
returns a function, append the returned function to the value of the <a
2512+
<dd> <i>Consume a function</i> with the <i>current input token</i>. Append
2513+
the returned function to the value of the <a
25812514
href="#current-block"><i>current block</i></a>.
2582-
<p> Otherwise, set the <a href="#error-flag"><i>error flag</i></a> to
2583-
true.
25842515

25852516
<dt>anything else
25862517

css3-syntax/Overview.src.html

Lines changed: 9 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,25 +2098,15 @@ <h4>
20982098
<dt><span class='temp'>(</span> token
20992099
<dd>
21002100
<i>Consume a block</i> with the <i>current input token</i>.
2101-
If a block is returned,
2102-
append it to the prelude of the <i>current rule</i>
2101+
Append the returned block to the prelude of the <i>current rule</i>
21032102
and remain in this mode.
21042103

2105-
<p>
2106-
Otherwise, pop the <i>current rule</i> from the <i>stack of open rules</i>.
2107-
Switch to the <i>next-block-or-statement error mode</i>.
2108-
21092104
<dt>function token
21102105
<dd>
21112106
<i>Consume a function</i> with the <i>current input token</i>.
2112-
If a function is returned,
2113-
append it to the prelude of the <i>current rule</i>
2107+
Append the returned function to the prelude of the <i>current rule</i>
21142108
and remain in this mode.
21152109

2116-
<p>
2117-
Otherwise, pop the <i>current rule</i> from the <i>stack of open rules</i>.
2118-
Switch to the <i>next-block-or-statement error mode</i>.
2119-
21202110
<dt>anything else
21212111
<dd>
21222112
Append the <i>current input token</i>
@@ -2179,26 +2169,16 @@ <h4>
21792169
<dt><span class='temp'>(</span> token
21802170
<dd>
21812171
<i>Consume a block</i> with the <i>current input token</i>.
2182-
If a block is returned,
2183-
append it to the selector of the <i>current rule</i>
2172+
Append the returned block to the selector of the <i>current rule</i>
21842173
and remain in this mode.
21852174

2186-
<p>
2187-
Otherwise, pop the <i>current rule</i> from the <i>stack of open rules</i>.
2188-
Switch to the <i>next-block error mode</i>.
2189-
21902175

21912176
<dt>function token
21922177
<dd>
21932178
<i>Consume a function</i> with the <i>current input token</i>.
2194-
If a function is returned,
2195-
append it to the selector of the <i>current rule</i>
2179+
Append the returned function to the selector of the <i>current rule</i>
21962180
and remain in this mode.
21972181

2198-
<p>
2199-
Otherwise, pop the <i>current rule</i> from the <i>stack of open rules</i>.
2200-
Switch to the <i>next-block error mode</i>.
2201-
22022182
<dt>anything else
22032183
<dd>
22042184
Append the token to the selector of the <i>current rule</i>.
@@ -2276,42 +2256,20 @@ <h4>
22762256
Consume the <i>next input token</i>.
22772257

22782258
<dl>
2279-
<dt>cdo token
2280-
<dt>cdc token
2281-
<dt><span class='temp'>]</span> token
2282-
<dt><span class='temp'>)</span> token
2283-
<dt>bad-string token
2284-
<dt>bad-url token
2285-
<dd>
2286-
This is a <i>parse error</i>.
2287-
Discard the <i>current declaration</i>
2288-
and switch to the <i>next-declaration error mode</i>.
2289-
22902259
<dt><span class='temp'>{</span> token
22912260
<dt><span class='temp'>[</span> token
22922261
<dt><span class='temp'>(</span> token
22932262
<dd>
22942263
<i>Consume a block</i> with the <i>current input token</i>.
2295-
If a block is returned,
2296-
append it to the value of the <i>current declaration</i>
2264+
Append the returned block to the value of the <i>current declaration</i>
22972265
and remain in this mode.
22982266

2299-
<p>
2300-
Otherwise,
2301-
discard the <i>current declaration</i>
2302-
and switch to the <i>next-declaration error mode</i>.
2303-
23042267
<dt>function token
23052268
<dd>
23062269
<i>Consume a function</i> with the <i>current input token</i>.
2307-
If a function is returned,
2308-
append it to the value of the <i>current declaration</i>.
2270+
Append the returned function to the value of the <i>current declaration</i>.
23092271
and remain in this mode.
23102272

2311-
<p>
2312-
Otherwise, discard the <i>current declaration</i>
2313-
and switch to the <i>next-declaration error mode</i>.
2314-
23152273
<dt>delim token with a value of "!"
23162274
<dd>
23172275
If the <i>next input token</i>
@@ -2526,50 +2484,22 @@ <h4>
25262484
<dt>EOF token
25272485
<dt><i>ending token</i>
25282486
<dd>
2529-
If the error flag is false,
2530-
return the block.
2531-
2532-
<p>
2533-
Otherwise,
2534-
return nothing.
2535-
2536-
<dt>}, ], or ) token (whichever two are not the <i>ending token</i>)
2537-
<dd>
2538-
This is a <i>parse error</i>.
2539-
Set the error flag to true.
2540-
2541-
<dt>bad-string token
2542-
<dt>bad-url token
2543-
<dt>semicolon token
2544-
<dt>cdo token
2545-
<dt>cdc token
2546-
<dt>at-keyword token
2547-
<dd>
2548-
This is a <i>parse error</i>.
2549-
Set the <i>error flag</i> to true.
2487+
Return the block.
25502488

25512489
<dt><span class='temp'>{</span> token
25522490
<dt><span class='temp'>[</span> token
25532491
<dt><span class='temp'>(</span> token
25542492
<dd>
25552493
<i>Consume a block</i> with the <i>current input token</i>.
2556-
If it returns a block,
2557-
append the returned block
2494+
Append the returned block
25582495
to the value of the <i>current block</i>.
25592496

2560-
<p>
2561-
Otherwise, set the <i>error flag</i> to true.
2562-
25632497
<dt>function token
25642498
<dd>
25652499
<i>Consume a function</i> with the <i>current input token</i>.
2566-
If it returns a function,
2567-
append the returned function
2500+
Append the returned function
25682501
to the value of the <i>current block</i>.
25692502

2570-
<p>
2571-
Otherwise, set the <i>error flag</i> to true.
2572-
25732503
<dt>anything else
25742504
<dd>
25752505
Append the <i>current input token</i>

0 commit comments

Comments
 (0)