Script updating gh-pages from 1362646. [ci skip]

This commit is contained in:
ID Bot 2025-04-17 21:05:36 +00:00
parent 1d381ee95b
commit 9a4556de59
2 changed files with 77 additions and 56 deletions

View File

@ -1566,20 +1566,28 @@ about how to interpret a value.<a href="#section-3.8-3" class="pilcrow">¶</a></
annotation as a "suffix", instead of prepending it between <code>(</code> and <code>)</code>. This annotation as a "suffix", instead of prepending it between <code>(</code> and <code>)</code>. This
makes it possible to, for example, write <code>10px</code>, <code>10.5%</code>, <code>512GiB</code>, etc., which makes it possible to, for example, write <code>10px</code>, <code>10.5%</code>, <code>512GiB</code>, etc., which
are equivalent to <code>(px)10</code>, <code>(%)5</code>, and <code>(GiB)512</code>, respectively.<a href="#section-3.8.1-1" class="pilcrow"></a></p> are equivalent to <code>(px)10</code>, <code>(%)5</code>, and <code>(GiB)512</code>, respectively.<a href="#section-3.8.1-1" class="pilcrow"></a></p>
<p id="section-3.8.1-2">An implementation that finds BOTH a parenthesized and a suffix <p id="section-3.8.1-2">Most suffixes can be appended directly to the number (a
(<a href="#type-annotation" class="auto internal xref">Section 3.8</a>) on the same (<a href="#number" class="auto internal xref">Section 3.14</a>) MUST yield a syntax error.<a href="#section-3.8.1-2" class="pilcrow"></a></p> (<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>)), as shown in the previous paragraph. To avoid
<p id="section-3.8.1-3">Suffixes MUST BE plain (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>)s. No other (<a href="#string" class="auto internal xref">Section 3.9</a>) is parsing ambiguity, there are some restrictions on this; an
acceptable.<a href="#section-3.8.1-3" class="pilcrow"></a></p> (<a href="#explicit-suffix-type-annotation" class="auto internal xref">Section 3.8.1.2</a>) avoids all these restrictions by using an
<p id="section-3.8.1-4">There are two kinds of (<a href="#suffix-type-annotation" class="auto internal xref">Section 3.8.1</a>) available: additional <code>#</code> to explicitly indicate it. For example, <code>10.0u8</code> is invalid, but
(<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>)s and (<a href="#explicit-suffix-type-annotation" class="auto internal xref">Section 3.8.1.2</a>).<a href="#section-3.8.1-4" class="pilcrow"></a></p> <code>10.0#u8</code> is valid and equivalent to <code>(u8)10.0</code>. See
(<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>) for the full list of restrictions.<a href="#section-3.8.1-2" class="pilcrow"></a></p>
<p id="section-3.8.1-3">An implementation that finds BOTH a parenthesized and a suffix
(<a href="#type-annotation" class="auto internal xref">Section 3.8</a>) on the same (<a href="#number" class="auto internal xref">Section 3.14</a>) MUST yield a syntax error.<a href="#section-3.8.1-3" class="pilcrow"></a></p>
<p id="section-3.8.1-4">Suffixes MUST BE plain (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>)s. No other (<a href="#string" class="auto internal xref">Section 3.9</a>) is
acceptable.<a href="#section-3.8.1-4" class="pilcrow"></a></p>
<p id="section-3.8.1-5">There are two kinds of (<a href="#suffix-type-annotation" class="auto internal xref">Section 3.8.1</a>) available:
(<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>)s and (<a href="#explicit-suffix-type-annotation" class="auto internal xref">Section 3.8.1.2</a>).<a href="#section-3.8.1-5" class="pilcrow"></a></p>
<div id="bare-suffix-type-annotation"> <div id="bare-suffix-type-annotation">
<section id="section-3.8.1.1"> <section id="section-3.8.1.1">
<h5 id="name-bare-suffix-type-annotation"> <h5 id="name-bare-suffix-type-annotation">
<a href="#section-3.8.1.1" class="section-number selfRef">3.8.1.1. </a><a href="#name-bare-suffix-type-annotation" class="section-name selfRef">Bare Suffix Type Annotation</a> <a href="#section-3.8.1.1" class="section-number selfRef">3.8.1.1. </a><a href="#name-bare-suffix-type-annotation" class="section-name selfRef">Bare Suffix Type Annotation</a>
</h5> </h5>
<p id="section-3.8.1.1-1">When a (<a href="#value" class="auto internal xref">Section 3.7</a>) is a decimal (<a href="#number" class="auto internal xref">Section 3.14</a>) WITHOUT exponential syntax (<code>1e+5</code> <p id="section-3.8.1.1-1">When a (<a href="#value" class="auto internal xref">Section 3.7</a>) is a decimal (<a href="#number" class="auto internal xref">Section 3.14</a>) WITHOUT exponential syntax (<code>1e+5</code>
etc) (and ONLY a decimal), it's possible to attach the type annotation as a etc) (and ONLY a decimal: that is, numbers which do NOT have a <code>0b</code>/<code>0o</code>/<code>0x</code>
suffix directly to the number, without any additional syntax.<a href="#section-3.8.1.1-1" class="pilcrow"></a></p> prefix), it's possible to attach the type annotation as a suffix directly to the
number, without any additional syntax.<a href="#section-3.8.1.1-1" class="pilcrow"></a></p>
<p id="section-3.8.1.1-2">They also come with some additional rules (like only being available for <p id="section-3.8.1.1-2">They also come with some additional rules (like only being available for
decimals), in order to prevent potential ambiguity or footguns with the syntax. decimals), in order to prevent potential ambiguity or footguns with the syntax.
This is generally acceptable, as type annotations in particular tend to be This is generally acceptable, as type annotations in particular tend to be
@ -1587,27 +1595,26 @@ application-defined and limited in scope, rather than arbitrary user data. In
designing this feature, it was determined that the value for various real-world designing this feature, it was determined that the value for various real-world
DSLs outweighed the complexity of the following rules.<a href="#section-3.8.1.1-2" class="pilcrow"></a></p> DSLs outweighed the complexity of the following rules.<a href="#section-3.8.1.1-2" class="pilcrow"></a></p>
<p id="section-3.8.1.1-3">As such, to remove ambiguity, the suffix (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>) MUST NOT start <p id="section-3.8.1.1-3">As such, to remove ambiguity, the suffix (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>) MUST NOT start
with any of the following patterns, all of which MUST yield syntax errors with any of the following patterns, all of which MUST yield syntax errors (if
(if they can be distinguished from other syntaxes at all):<a href="#section-3.8.1.1-3" class="pilcrow"></a></p> they can be distinguished from other syntaxes at all):<a href="#section-3.8.1.1-3" class="pilcrow"></a></p>
<ul class="normal"> <ul class="normal">
<li class="normal" id="section-3.8.1.1-4.1"> <li class="normal" id="section-3.8.1.1-4.1">
<p id="section-3.8.1.1-4.1.1"><code>.</code>, <code>,</code>, or <code>_</code><a href="#section-3.8.1.1-4.1.1" class="pilcrow"></a></p> <p id="section-3.8.1.1-4.1.1"><code>.</code>, <code>,</code>, or <code>_</code><a href="#section-3.8.1.1-4.1.1" class="pilcrow"></a></p>
</li> </li>
<li class="normal" id="section-3.8.1.1-4.2"> <li class="normal" id="section-3.8.1.1-4.2">
<p id="section-3.8.1.1-4.2.1"><code>[a-zA-Z][0-9_]</code> (to disambiguate all non-decimals, with breathing room)<a href="#section-3.8.1.1-4.2.1" class="pilcrow"></a></p> <p id="section-3.8.1.1-4.2.1"><code>[eE][+-]?[0-9]</code> (to disambiguate exponentials)<a href="#section-3.8.1.1-4.2.1" class="pilcrow"></a></p>
</li>
<li class="normal" id="section-3.8.1.1-4.3">
<p id="section-3.8.1.1-4.3.1"><code>[eE][+-]?[0-9]</code> (to disambiguate exponentials)<a href="#section-3.8.1.1-4.3.1" class="pilcrow"></a></p>
</li>
<li class="normal" id="section-3.8.1.1-4.4">
<p id="section-3.8.1.1-4.4.1"><code>[xX][a-fA-F]</code> (to disambiguate hexadecimals)<a href="#section-3.8.1.1-4.4.1" class="pilcrow"></a></p>
</li> </li>
</ul> </ul>
<p id="section-3.8.1.1-5">All other (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>)s can be safely appended to decimal numbers, so <p id="section-3.8.1.1-5">For example, <code>10,000</code> is illegal. <code>10e0n</code> is illegal, but <code>10e0</code> is a legal
long as the decimal does not include an exponential component.<a href="#section-3.8.1.1-5" class="pilcrow"></a></p> <em>decimal number using exponential syntax</em>, <strong>not</strong> equivalent to <code>(e0)10</code>.
<p id="section-3.8.1.1-6">If the desired suffix would violate any of the above rules, either regular Additionally, note that since bare suffixes are only legal on <em>decimals</em>, <code>0u8</code>
parenthetical (<a href="#type-annotation" class="auto internal xref">Section 3.8</a>)s, or (<a href="#explicit-suffix-type-annotation" class="auto internal xref">Section 3.8.1.2</a>)s is legal, but <code>0xs</code> is <em>not</em>, since hexadecimals are determined by their
may be used.<a href="#section-3.8.1.1-6" class="pilcrow"></a></p> prefixes. Similarly, <code>1xs</code> <em>is</em> legal, and equivalent to <code>(xs)1</code>.<a href="#section-3.8.1.1-5" class="pilcrow"></a></p>
<p id="section-3.8.1.1-6">All other (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>)s can be safely appended to decimal numbers, so
long as the decimal does not include an exponential component.<a href="#section-3.8.1.1-6" class="pilcrow"></a></p>
<p id="section-3.8.1.1-7">If the desired suffix would violate any of the above rules, either regular
parenthetical (<a href="#type-annotation" class="auto internal xref">Section 3.8</a>)s or (<a href="#explicit-suffix-type-annotation" class="auto internal xref">Section 3.8.1.2</a>)s
may be used.<a href="#section-3.8.1.1-7" class="pilcrow"></a></p>
</section> </section>
</div> </div>
<div id="explicit-suffix-type-annotation"> <div id="explicit-suffix-type-annotation">
@ -1615,14 +1622,14 @@ may be used.<a href="#section-3.8.1.1-6" class="pilcrow">¶</a></p>
<h5 id="name-explicit-suffix-type-annota"> <h5 id="name-explicit-suffix-type-annota">
<a href="#section-3.8.1.2" class="section-number selfRef">3.8.1.2. </a><a href="#name-explicit-suffix-type-annota" class="section-name selfRef">Explicit Suffix Type Annotation</a> <a href="#section-3.8.1.2" class="section-number selfRef">3.8.1.2. </a><a href="#name-explicit-suffix-type-annota" class="section-name selfRef">Explicit Suffix Type Annotation</a>
</h5> </h5>
<p id="section-3.8.1.2-1">Any (<a href="#number" class="auto internal xref">Section 3.14</a>) may have a <code>#</code> attached to it, followed by any valid <p id="section-3.8.1.2-1">Any (<a href="#number" class="auto internal xref">Section 3.14</a>) may have a <code>#</code> appended to it, followed by any valid
(<a href="#identifier-string" class="auto internal xref">Section 3.10</a>). This is an explicit (<a href="#suffix-type-annotation" class="auto internal xref">Section 3.8.1</a>) syntax (<a href="#identifier-string" class="auto internal xref">Section 3.10</a>). This is an explicit (<a href="#suffix-type-annotation" class="auto internal xref">Section 3.8.1</a>) syntax
without any of the relatively complex requirements of without any of the relatively complex requirements of
(<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>), which can be a useful escape hatch. For (<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>), which can be a useful escape hatch. For
example: <code>10.0#u8</code> is invalid syntax without the <code>#</code> prefix.<a href="#section-3.8.1.2-1" class="pilcrow"></a></p> example: <code>0#b1</code> is invalid syntax without the <code>#</code> prefix.<a href="#section-3.8.1.2-1" class="pilcrow"></a></p>
<p id="section-3.8.1.2-2">Note again that, unlike (<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>)s, Explicit Suffixes <p id="section-3.8.1.2-2">Note again that, unlike (<a href="#bare-suffix-type-annotation" class="auto internal xref">Section 3.8.1.1</a>)s, Explicit Suffixes
may be used with ALL (<a href="#number" class="auto internal xref">Section 3.14</a>) formats (hexadecimal, decimal, octal, and may be used with ALL (<a href="#number" class="auto internal xref">Section 3.14</a>) formats (hexadecimal, decimal, octal, and
binary). For example, <code>0x1234#u16</code> is valid.<a href="#section-3.8.1.2-2" class="pilcrow"></a></p> binary). For example, <code>0x1234#u32</code> is valid.<a href="#section-3.8.1.2-2" class="pilcrow"></a></p>
</section> </section>
</div> </div>
</section> </section>
@ -2849,8 +2856,9 @@ node-children := '{' nodes final-node? '}'
node-terminator := single-line-comment | newline | ';' | eof node-terminator := single-line-comment | newline | ';' | eof
prop := string node-space* '=' node-space* value prop := string node-space* '=' node-space* value
value := type? node-space* (string | number | keyword) value := normal-value | suffixed-decimal
type := '(' node-space* string node-space* ')' type := '(' node-space* string node-space* ')'
normal-value := type? node-space* (string | number | keyword)
// Strings // Strings
string := identifier-string | quoted-string | raw-string ¶ string := identifier-string | quoted-string | raw-string ¶
@ -2911,24 +2919,25 @@ multi-line-raw-string-body :=
// Numbers // Numbers
number := keyword-number | hex | octal | binary | decimal number := keyword-number | hex | octal | binary | decimal
decimal := sign? integer ('.' integer)? ( decimal := significand exponent?
// NOTE: This grammar does not explicitly guard against having both suffixed-decimal := significand (
// parenthesized and type suffixes. bare-type-suffix
bare-type-suffix | | (exponent? explicit-type-suffix)
explicit-type-suffix | )
(exponent explicit-type-suffix?) significand := sign? significand-initial integer? ('.' integer)?
)?
exponent := ('e' | 'E') sign? integer exponent := ('e' | 'E') sign? integer
integer := digit (digit | '_')* integer := digit (digit | '_')*
significand-initial = digit
- '0b'
- '0o'
- '0x'
digit := [0-9] digit := [0-9]
sign := '+' | '-' sign := '+' | '-'
bare-type-suffix := bare-type-suffix-initial identifier-char* bare-type-suffix := bare-type-suffix-initial identifier-char*
bare-type-suffix-initial := identifier-char bare-type-suffix-initial := identifier-char
- '.' - ',' - '_' - '.' - ',' - '_'
- ([a-zA-Z] [0-9_])
- (('e' | 'E') sign? digit) - (('e' | 'E') sign? digit)
- (('x' | 'X') [a-fA-F])
explicit-type-suffix := '#' identifier-string explicit-type-suffix := '#' identifier-string
hex := sign? '0x' hex-digit (hex-digit | '_')* hex := sign? '0x' hex-digit (hex-digit | '_')*

View File

@ -312,6 +312,14 @@ Table of Contents
512GiB, etc., which are equivalent to (px)10, (%)5, and (GiB)512, 512GiB, etc., which are equivalent to (px)10, (%)5, and (GiB)512,
respectively. respectively.
Most suffixes can be appended directly to the number (a
(Section 3.8.1.1)), as shown in the previous paragraph. To avoid
parsing ambiguity, there are some restrictions on this; an
(Section 3.8.1.2) avoids all these restrictions by using an
additional # to explicitly indicate it. For example, 10.0u8 is
invalid, but 10.0#u8 is valid and equivalent to (u8)10.0. See
(Section 3.8.1.1) for the full list of restrictions.
An implementation that finds BOTH a parenthesized and a suffix An implementation that finds BOTH a parenthesized and a suffix
(Section 3.8) on the same (Section 3.14) MUST yield a syntax error. (Section 3.8) on the same (Section 3.14) MUST yield a syntax error.
@ -324,9 +332,9 @@ Table of Contents
3.8.1.1. Bare Suffix Type Annotation 3.8.1.1. Bare Suffix Type Annotation
When a (Section 3.7) is a decimal (Section 3.14) WITHOUT exponential When a (Section 3.7) is a decimal (Section 3.14) WITHOUT exponential
syntax (1e+5 etc) (and ONLY a decimal), it's possible to attach the syntax (1e+5 etc) (and ONLY a decimal: that is, numbers which do NOT
type annotation as a suffix directly to the number, without any have a 0b/0o/0x prefix), it's possible to attach the type annotation
additional syntax. as a suffix directly to the number, without any additional syntax.
They also come with some additional rules (like only being available They also come with some additional rules (like only being available
for decimals), in order to prevent potential ambiguity or footguns for decimals), in order to prevent potential ambiguity or footguns
@ -343,31 +351,33 @@ Table of Contents
* ., ,, or _ * ., ,, or _
* [a-zA-Z][0-9_] (to disambiguate all non-decimals, with breathing
room)
* [eE][+-]?[0-9] (to disambiguate exponentials) * [eE][+-]?[0-9] (to disambiguate exponentials)
* [xX][a-fA-F] (to disambiguate hexadecimals) For example, 10,000 is illegal. 10e0n is illegal, but 10e0 is a legal
_decimal number using exponential syntax_, *not* equivalent to
(e0)10. Additionally, note that since bare suffixes are only legal
on _decimals_, 0u8 is legal, but 0xs is _not_, since hexadecimals are
determined by their prefixes. Similarly, 1xs _is_ legal, and
equivalent to (xs)1.
All other (Section 3.10)s can be safely appended to decimal numbers, All other (Section 3.10)s can be safely appended to decimal numbers,
so long as the decimal does not include an exponential component. so long as the decimal does not include an exponential component.
If the desired suffix would violate any of the above rules, either If the desired suffix would violate any of the above rules, either
regular parenthetical (Section 3.8)s, or (Section 3.8.1.2)s may be regular parenthetical (Section 3.8)s or (Section 3.8.1.2)s may be
used. used.
3.8.1.2. Explicit Suffix Type Annotation 3.8.1.2. Explicit Suffix Type Annotation
Any (Section 3.14) may have a # attached to it, followed by any valid Any (Section 3.14) may have a # appended to it, followed by any valid
(Section 3.10). This is an explicit (Section 3.8.1) syntax without (Section 3.10). This is an explicit (Section 3.8.1) syntax without
any of the relatively complex requirements of (Section 3.8.1.1), any of the relatively complex requirements of (Section 3.8.1.1),
which can be a useful escape hatch. For example: 10.0#u8 is invalid which can be a useful escape hatch. For example: 0#b1 is invalid
syntax without the # prefix. syntax without the # prefix.
Note again that, unlike (Section 3.8.1.1)s, Explicit Suffixes may be Note again that, unlike (Section 3.8.1.1)s, Explicit Suffixes may be
used with ALL (Section 3.14) formats (hexadecimal, decimal, octal, used with ALL (Section 3.14) formats (hexadecimal, decimal, octal,
and binary). For example, 0x1234#u16 is valid. and binary). For example, 0x1234#u32 is valid.
3.8.2. Reserved Type Annotations for Numbers Without Decimals 3.8.2. Reserved Type Annotations for Numbers Without Decimals
@ -1146,8 +1156,9 @@ Table of Contents
node-terminator := single-line-comment | newline | ';' | eof node-terminator := single-line-comment | newline | ';' | eof
prop := string node-space* '=' node-space* value prop := string node-space* '=' node-space* value
value := type? node-space* (string | number | keyword) value := normal-value | suffixed-decimal
type := '(' node-space* string node-space* ')' type := '(' node-space* string node-space* ')'
normal-value := type? node-space* (string | number | keyword)
// Strings // Strings
string := identifier-string | quoted-string | raw-string ¶ string := identifier-string | quoted-string | raw-string ¶
@ -1208,24 +1219,25 @@ Table of Contents
// Numbers // Numbers
number := keyword-number | hex | octal | binary | decimal number := keyword-number | hex | octal | binary | decimal
decimal := sign? integer ('.' integer)? ( decimal := significand exponent?
// NOTE: This grammar does not explicitly guard against having both suffixed-decimal := significand (
// parenthesized and type suffixes. bare-type-suffix
bare-type-suffix | | (exponent? explicit-type-suffix)
explicit-type-suffix | )
(exponent explicit-type-suffix?) significand := sign? significand-initial integer? ('.' integer)?
)?
exponent := ('e' | 'E') sign? integer exponent := ('e' | 'E') sign? integer
integer := digit (digit | '_')* integer := digit (digit | '_')*
significand-initial = digit
- '0b'
- '0o'
- '0x'
digit := [0-9] digit := [0-9]
sign := '+' | '-' sign := '+' | '-'
bare-type-suffix := bare-type-suffix-initial identifier-char* bare-type-suffix := bare-type-suffix-initial identifier-char*
bare-type-suffix-initial := identifier-char bare-type-suffix-initial := identifier-char
- '.' - ',' - '_' - '.' - ',' - '_'
- ([a-zA-Z] [0-9_])
- (('e' | 'E') sign? digit) - (('e' | 'E') sign? digit)
- (('x' | 'X') [a-fA-F])
explicit-type-suffix := '#' identifier-string explicit-type-suffix := '#' identifier-string
hex := sign? '0x' hex-digit (hex-digit | '_')* hex := sign? '0x' hex-digit (hex-digit | '_')*