Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Mar 13, 2024
1 parent d072ee2 commit 49ea500
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions encoding.bs
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ from an <a for=/>I/O queue</a> <var>ioQueue</var>, run these steps:
<p>To <a for="I/O queue">push</a> a sequence of items to an <a for=/>I/O queue</a>
<var>ioQueue</var> is to push each item in the sequence to <var>ioQueue</var>, in the given order.

<p>To <dfn id=concept-stream-prepend for="I/O queue">prepend</dfn> an <a for=list>item</a> other
than <a>end-of-queue</a> to an <a for=/>I/O queue</a>, perform the normal <a for=/>list</a>
<a for=list>prepend</a> operation. To prepend a <a for=/>list</a> of <a for=list>items</a> excluding
<a>end-of-queue</a>, insert those items, in the given order, before the first item in the queue.
<p>To <dfn id=concept-stream-prepend for="I/O queue">restore</dfn> an <a for=list>item</a> other
than <a>end-of-queue</a> to an <a for=/>I/O queue</a>, perform the <a for=/>list</a>
<a for=list>prepend</a> operation. To <a for="I/O queue">restore</a> a <a for=/>list</a> of
<a for=list>items</a> excluding <a>end-of-queue</a> to an <a for=/>I/O queue</a>, insert those
items, in the given order, before the first item in the queue.

<p class=example id=example-tokens>Inserting the sequence of scalar value items
<code>&amp;#128169;</code> in an I/O queue of scalar values "<code> hello world</code>", results in
an I/O queue "<code>&amp;#128169; hello world</code>". The next item to be read would be
<code>&amp;</code>. <!-- 💩 -->
<p class=example id=example-tokens>Inserting the bytes « 0xF0, 0x9F » in an I/O queue
« 0x92 0xA9, <a>end-of-queue</a> », results in an I/O queue
« 0xF0, 0x9F, 0x92 0xA9, <a>end-of-queue</a> ». The next item to be read would be 0xF0. <!-- 💩 -->

<p>To <dfn for="from I/O queue">convert</dfn> an <a for=/>I/O queue</a> <var>ioQueue</var> into a
<a for=/>list</a>, <a>string</a>, or <a>byte sequence</a>, return the result of
Expand All @@ -218,8 +218,8 @@ an I/O queue "<code>&amp;#128169; hello world</code>". The next item to be read
See <a href="https://github.com/whatwg/infra/issues/319">whatwg/infra issue #319</a>. [[INFRA]]

<p class=note><a for=/>I/O queues</a> are defined as <a for=/>lists</a>, not
<a spec=infra>queues</a>, because they feature a <a for="I/O queue">prepend</a> operation. However,
this prepend operation is an internal detail of the algorithms in this specification, and is not to
<a spec=infra>queues</a>, because they feature a <a for="I/O queue">restore</a> operation. However,
this restore operation is an internal detail of the algorithms in this specification, and is not to
be used by other standards. Implementations are free to find alternative ways to implement such
algorithms, as detailed in [[#implementation-considerations]].

Expand Down Expand Up @@ -1981,7 +1981,7 @@ constructor steps are:
whose value is 0x10000 + ((<var>high surrogate</var> &minus; 0xD800) &lt;&lt; 10) +
(<var>item</var> &minus; 0xDC00).

<li><p><a>Prepend</a> <var>item</var> to <var>input</var>.
<li><p><a>Restore</a> <var>item</var> to <var>input</var>.

<li><p>Return U+FFFD.
</ol>
Expand Down Expand Up @@ -2113,7 +2113,7 @@ in deployed content. Therefore it is not part of the <a>UTF-8 decoder</a> algori
set <a>UTF-8 lower boundary</a> to 0x80, and set
<a>UTF-8 upper boundary</a> to 0xBF.

<li><p><a>Prepend</a> <var>byte</var> to <var>ioQueue</var>.
<li><p><a>Restore</a> <var>byte</var> to <var>ioQueue</var>.

<li><p>Return <a>error</a>.
</ol>
Expand Down Expand Up @@ -2339,7 +2339,7 @@ consumers of content generated with <a>GBK</a>'s <a for=/>encoder</a>.
<p>If <var>byte</var> is not in the range 0x30 to 0x39, inclusive, then:

<ol>
<li><p><a>Prepend</a> « <a>gb18030 second</a>, <a>gb18030 third</a>, <var>byte</var> » to
<li><p><a>Restore</a> « <a>gb18030 second</a>, <a>gb18030 third</a>, <var>byte</var> » to
<var>ioQueue</var>.

<li><p>Set <a>gb18030 first</a>, <a>gb18030 second</a>, and <a>gb18030 third</a> to 0x00.
Expand All @@ -2366,7 +2366,7 @@ consumers of content generated with <a>GBK</a>'s <a for=/>encoder</a>.
<li><p>If <var>byte</var> is in the range 0x81 to 0xFE, inclusive, set
<a>gb18030 third</a> to <var>byte</var> and return <a>continue</a>.

<li><p><a>Prepend</a> « <a>gb18030 second</a>, <var>byte</var> » to <var>ioQueue</var>, set
<li><p><a>Restore</a> « <a>gb18030 second</a>, <var>byte</var> » to <var>ioQueue</var>, set
<a>gb18030 first</a> and <a>gb18030 second</a> to 0x00, and return <a>error</a>.
</ol>

Expand All @@ -2392,7 +2392,7 @@ consumers of content generated with <a>GBK</a>'s <a for=/>encoder</a>.
<li><p>If <var>code point</var> is non-null, return a code point whose value is
<var>code point</var>.

<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
<var>ioQueue</var>.

<li><p>Return <a>error</a>.
Expand Down Expand Up @@ -2538,7 +2538,7 @@ and <var>byte</var>, runs these steps:
<li><p>If <var>code point</var> is non-null, return a code point whose value is
<var>code point</var>.

<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
<var>ioQueue</var>.

<li><p>Return <a>error</a>.
Expand Down Expand Up @@ -2634,7 +2634,7 @@ and <var>code point</var>, runs these steps:
<li><p>If <var>code point</var> is non-null, return a code point whose value is
<var>code point</var>.

<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
<var>ioQueue</var>.

<li><p>Return <a>error</a>.
Expand Down Expand Up @@ -2852,7 +2852,7 @@ and <var>code point</var>, runs these steps:
<a lt="ISO-2022-JP decoder escape">escape</a>, and return
<a>continue</a>.

<li><p>If <var>byte</var> is not <a>end-of-queue</a>, then <a>prepend</a>
<li><p>If <var>byte</var> is not <a>end-of-queue</a>, then <a>restore</a>
<var>byte</var> to <var>ioQueue</var>.

<li><p>Set <a>ISO-2022-JP output</a> to false,
Expand Down Expand Up @@ -2896,8 +2896,8 @@ and <var>code point</var>, runs these steps:
<a>error</a> otherwise.
</ol>

<li><p>If <var>byte</var> is <a>end-of-queue</a>, then <a>prepend</a> <var>lead</var> to
<var>ioQueue</var>; otherwise, <a>prepend</a> « <var>lead</var>, <var>byte</var> » to
<li><p>If <var>byte</var> is <a>end-of-queue</a>, then <a>restore</a> <var>lead</var> to
<var>ioQueue</var>; otherwise, <a>restore</a> « <var>lead</var>, <var>byte</var> » to
<var>ioQueue</var>.

<li><p>Set <a>ISO-2022-JP output</a> to false,
Expand Down Expand Up @@ -2970,15 +2970,15 @@ and <var>code point</var>, runs these steps:
<li><p>If <var>code point</var> is an <a>ASCII code point</a>, and
<a>ISO-2022-JP encoder state</a> is not
<a lt="ISO-2022-JP encoder ASCII">ASCII</a>,
<a>prepend</a> <var>code point</var> to
<a>restore</a> <var>code point</var> to
<var>ioQueue</var>, set <a>ISO-2022-JP encoder state</a> to
<a lt="ISO-2022-JP encoder ASCII">ASCII</a>, and return three bytes
0x1B 0x28 0x42.

<li><p>If <var>code point</var> is either U+00A5 or U+203E, and
<a>ISO-2022-JP encoder state</a> is not
<a lt="ISO-2022-JP encoder Roman">Roman</a>,
<a>prepend</a> <var>code point</var> to
<a>restore</a> <var>code point</var> to
<var>ioQueue</var>, set <a>ISO-2022-JP encoder state</a> to
<a lt="ISO-2022-JP encoder Roman">Roman</a>, and return three bytes
0x1B 0x28 0x4A.
Expand All @@ -3001,7 +3001,7 @@ and <var>code point</var>, runs these steps:

<ol>
<li><p>If <a>ISO-2022-JP encoder state</a> is <a lt="ISO-2022-JP encoder jis0208">jis0208</a>,
then <a>prepend</a> <var>code point</var> to <var>ioQueue</var>, set
then <a>restore</a> <var>code point</var> to <var>ioQueue</var>, set
<a>ISO-2022-JP encoder state</a> to <a lt="ISO-2022-JP encoder ASCII">ASCII</a>, and return three
bytes 0x1B 0x28 0x42.

Expand All @@ -3010,7 +3010,7 @@ and <var>code point</var>, runs these steps:

<li><p>If <a>ISO-2022-JP encoder state</a> is not
<a lt="ISO-2022-JP encoder jis0208">jis0208</a>,
<a>prepend</a> <var>code point</var> to
<a>restore</a> <var>code point</var> to
<var>ioQueue</var>, set <a>ISO-2022-JP encoder state</a> to
<a lt="ISO-2022-JP encoder jis0208">jis0208</a>, and return three bytes
0x1B 0x24 0x42.
Expand Down Expand Up @@ -3069,7 +3069,7 @@ and <var>code point</var>, runs these steps:
<li><p>If <var>code point</var> is non-null, return a code point whose value is
<var>code point</var>.

<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
<var>ioQueue</var>.

<li><p>Return <a>error</a>.
Expand Down Expand Up @@ -3169,7 +3169,7 @@ and <var>code point</var>, runs these steps:
<li><p>If <var>code point</var> is non-null, return a code point whose value is
<var>code point</var>.

<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
<var>ioQueue</var>.

<li><p>Return <a>error</a>.
Expand Down Expand Up @@ -3299,7 +3299,7 @@ rather the <a>decode</a> algorithm.
and <var>byte2</var>, if <a>is UTF-16BE decoder</a> is true; otherwise <var>byte2</var> and
<var>byte1</var>.

<li><p><a>Prepend</a> <var>bytes</var> to <var>ioQueue</var> and return <a>error</a>.
<li><p><a>Restore</a> <var>bytes</var> to <var>ioQueue</var> and return <a>error</a>.
<!-- unpaired surrogates; IE/WebKit output them, Gecko/Opera U+FFFD them -->
</ol>

Expand Down Expand Up @@ -3395,7 +3395,7 @@ decoded using <a>UTF-16BE/LE</a>.

<h2 class=no-num id=implementation-considerations>Implementation considerations</h2>

<p>Instead of supporting <a for=/>I/O queues</a> with arbitrary <a for="I/O queue">prepend</a>, the
<p>Instead of supporting <a for=/>I/O queues</a> with arbitrary <a for="I/O queue">restore</a>, the
<a for=/>decoders</a> for <a for=/>encodings</a> in this standard could be implemented with:

<ol>
Expand Down

0 comments on commit 49ea500

Please sign in to comment.