Skip to content

Commit

Permalink
fixup: [spec] npm run build
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Sep 26, 2023
1 parent c448ee1 commit b3464d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,7 @@
</ul></div><div id="menu-toggle"><svg xmlns="http://www.w3.org/2000/svg" style="width:100%; height:100%; stroke:currentColor" viewBox="0 0 120 120">
<title>Menu</title>
<path stroke-width="10" stroke-linecap="round" d="M30,60 h60 M30,30 m0,5 h60 M30,90 m0,-5 h60"></path>
</svg></div><div id="menu-spacer" class="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins</div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-json-object" title="The JSON Object"><span class="secnum">1</span> The JSON Object</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-json.israwjson" title="JSON.isRawJSON ( O )"><span class="secnum">1.1</span> JSON.isRawJSON ( <var>O</var> )</a></li><li><span class="item-toggle">◢</span><a href="#sec-json.parse" title="JSON.parse ( text [ , reviver ] )"><span class="secnum">1.2</span> JSON.parse ( <var>text</var> [ , <var>reviver</var> ] )</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-json-parse-record" title="JSON Parse Record"><span class="secnum">1.2.1</span> JSON Parse Record</a></li><li><span class="item-toggle-none"></span><a href="#sec-createjsonparserecord" title="CreateJSONParseRecord ( parseNode, key, val )"><span class="secnum">1.2.2</span> CreateJSONParseRecord ( <var>parseNode</var>, <var>key</var>, <var>val</var> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-internalizejsonproperty" title="InternalizeJSONProperty ( holder, name, reviver, parseRecord )"><span class="secnum">1.2.3</span> InternalizeJSONProperty ( <var>holder</var>, <var>name</var>, <var>reviver</var>, <ins><var>parseRecord</var></ins> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-static-semantics-shallowestcontainedjsonvalue" title="Static Semantics: ShallowestContainedJSONValue"><span class="secnum">1.2.4</span> SS: ShallowestContainedJSONValue</a></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-json.rawjson" title="JSON.rawJSON ( text )"><span class="secnum">1.3</span> JSON.rawJSON ( <var>text</var> )</a></li><li><span class="item-toggle">◢</span><a href="#sec-json.stringify" title="JSON.stringify ( value [ , replacer [ , space ] ] )"><span class="secnum">1.4</span> JSON.stringify ( <var>value</var> [ , <var>replacer</var> [ , <var>space</var> ] ] )</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-serializejsonproperty" title="SerializeJSONProperty ( state, key, holder )"><span class="secnum">1.4.1</span> SerializeJSONProperty ( <var>state</var>, <var>key</var>, <var>holder</var> )</a></li></ol></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-static-semantics-arrayliteralcontentnodes" title="Static Semantics: ArrayLiteralContentNodes"><span class="secnum">2</span> SS: ArrayLiteralContentNodes</a></li><li><span class="item-toggle-none"></span><a href="#sec-static-semantics-propertydefinitionnodes" title="Static Semantics: PropertyDefinitionNodes"><span class="secnum">3</span> SS: PropertyDefinitionNodes</a></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="shortname">Proposal <a href="<no location>"></a><a href="https://github.com/tc39/proposal-json-parse-with-source">proposal-json-parse-with-source</a></h1><h1 class="version">Stage 3 Draft / September 18, 2023</h1><h1 class="title">JSON.parse source text access</h1>
</svg></div><div id="menu-spacer" class="menu-spacer"></div><div id="menu"><div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search..."><div id="menu-search-results" class="inactive"></div></div><div id="menu-pins"><div class="menu-pane-header">Pins</div><ul id="menu-pins-list"></ul></div><div class="menu-pane-header">Table of Contents</div><div id="menu-toc"><ol class="toc"><li><span class="item-toggle">◢</span><a href="#sec-json-object" title="The JSON Object"><span class="secnum">1</span> The JSON Object</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-json.israwjson" title="JSON.isRawJSON ( O )"><span class="secnum">1.1</span> JSON.isRawJSON ( <var>O</var> )</a></li><li><span class="item-toggle">◢</span><a href="#sec-json.parse" title="JSON.parse ( text [ , reviver ] )"><span class="secnum">1.2</span> JSON.parse ( <var>text</var> [ , <var>reviver</var> ] )</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-json-parse-record" title="JSON Parse Record"><span class="secnum">1.2.1</span> JSON Parse Record</a></li><li><span class="item-toggle-none"></span><a href="#sec-createjsonparserecord" title="CreateJSONParseRecord ( parseNode, key, val )"><span class="secnum">1.2.2</span> CreateJSONParseRecord ( <var>parseNode</var>, <var>key</var>, <var>val</var> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-internalizejsonproperty" title="InternalizeJSONProperty ( holder, name, reviver, parseRecord )"><span class="secnum">1.2.3</span> InternalizeJSONProperty ( <var>holder</var>, <var>name</var>, <var>reviver</var>, <ins><var>parseRecord</var></ins> )</a></li><li><span class="item-toggle-none"></span><a href="#sec-static-semantics-shallowestcontainedjsonvalue" title="Static Semantics: ShallowestContainedJSONValue"><span class="secnum">1.2.4</span> SS: ShallowestContainedJSONValue</a></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-json.rawjson" title="JSON.rawJSON ( text )"><span class="secnum">1.3</span> JSON.rawJSON ( <var>text</var> )</a></li><li><span class="item-toggle">◢</span><a href="#sec-json.stringify" title="JSON.stringify ( value [ , replacer [ , space ] ] )"><span class="secnum">1.4</span> JSON.stringify ( <var>value</var> [ , <var>replacer</var> [ , <var>space</var> ] ] )</a><ol class="toc"><li><span class="item-toggle-none"></span><a href="#sec-serializejsonproperty" title="SerializeJSONProperty ( state, key, holder )"><span class="secnum">1.4.1</span> SerializeJSONProperty ( <var>state</var>, <var>key</var>, <var>holder</var> )</a></li></ol></li></ol></li><li><span class="item-toggle-none"></span><a href="#sec-static-semantics-arrayliteralcontentnodes" title="Static Semantics: ArrayLiteralContentNodes"><span class="secnum">2</span> SS: ArrayLiteralContentNodes</a></li><li><span class="item-toggle-none"></span><a href="#sec-static-semantics-propertydefinitionnodes" title="Static Semantics: PropertyDefinitionNodes"><span class="secnum">3</span> SS: PropertyDefinitionNodes</a></li><li><span class="item-toggle-none"></span><a href="#sec-copyright-and-software-license" title="Copyright &amp; Software License"><span class="secnum">A</span> Copyright &amp; Software License</a></li></ol></div></div><div id="spec-container"><h1 class="shortname">Proposal <a href="<no location>"></a><a href="https://github.com/tc39/proposal-json-parse-with-source">proposal-json-parse-with-source</a></h1><h1 class="version">Stage 3 Draft / September 26, 2023</h1><h1 class="title">JSON.parse source text access</h1>
<code title="work around https://github.com/tc39/ecmarkup/issues/510"><script>
// Initialize to a reasonable amount of TOC expansion:
// * Expand any full nesting level up to an arbitrary limit of 20 total visible items.
Expand Down Expand Up @@ -2658,7 +2658,7 @@ <h1><span class="secnum">1.2.3</span> InternalizeJSONProperty ( <var>holder</var
<emu-clause id="sec-static-semantics-shallowestcontainedjsonvalue" type="sdo" aoid="ShallowestContainedJSONValue">
<h1><span class="secnum">1.2.4</span> Static Semantics: ShallowestContainedJSONValue</h1>
<p>The <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations"><a href="https://tc39.es/ecma262/#sec-algorithm-conventions-syntax-directed-operations">syntax-directed operation</a></emu-xref> ShallowestContainedJSONValue takes no arguments and returns a <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref> or <emu-const>empty</emu-const>. It performs a breadth-first search of the parse tree rooted at the context node, and returns the first node that is an instance of a nonterminal corresponding to a JSON value, or <emu-const>empty</emu-const> if there is no such node.</p>
<emu-alg><ol><li>Let <var>F</var> be the <emu-xref href="#active-function-object"><a href="https://tc39.es/ecma262/#active-function-object">active function object</a></emu-xref>.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>F</var> is a <code>JSON.parse</code> built-in <emu-xref href="#function-object"><a href="https://tc39.es/ecma262/#function-object">function object</a></emu-xref> (see <emu-xref href="#sec-json.parse" id="_ref_3"><a href="#sec-json.parse">JSON.parse</a></emu-xref>).</li><li>Let <var>types</var> be « <emu-nt><a href="https://tc39.es/ecma262/#prod-NullLiteral">NullLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-BooleanLiteral">BooleanLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-NumericLiteral">NumericLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-StringLiteral">StringLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-ArrayLiteral">ArrayLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-ObjectLiteral">ObjectLiteral</a></emu-nt> ».</li><li>Let <var>queue</var> be « this <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref> ».</li><li>Repeat, while <var>queue</var> is not empty,<ol><li>Let <var>candidate</var> be the first element of <var>queue</var>.</li><li>Remove the first element from <var>queue</var>.</li><li>Let <var>queuedChildren</var> be <emu-val>false</emu-val>.</li><li>For each nonterminal <var>type</var> of <var>types</var>, do<ol><li>If <var>candidate</var> is an instance of <var>type</var>, return <var>candidate</var>.</li><li>If <var>queuedChildren</var> is <emu-val>false</emu-val> and <var>candidate</var> is an instance of a nonterminal and <var>candidate</var> <emu-xref aoid="Contains"><a href="https://tc39.es/ecma262/#sec-static-semantics-contains">Contains</a></emu-xref> <var>type</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>children</var> be a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> containing each child node of <var>candidate</var>, in order.</li><li>Set <var>queue</var> to the <emu-xref href="#list-concatenation"><a href="https://tc39.es/ecma262/#list-concatenation">list-concatenation</a></emu-xref> of <var>queue</var> and <var>children</var>.</li><li>Set <var>queuedChildren</var> to <emu-val>true</emu-val>.</li></ol></li></ol></li></ol></li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-alg><ol><li>Let <var>F</var> be the <emu-xref href="#active-function-object"><a href="https://tc39.es/ecma262/#active-function-object">active function object</a></emu-xref>.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>F</var> is a <code>JSON.parse</code> built-in <emu-xref href="#function-object"><a href="https://tc39.es/ecma262/#function-object">function object</a></emu-xref> (see <emu-xref href="#sec-json.parse" id="_ref_3"><a href="#sec-json.parse">JSON.parse</a></emu-xref>).</li><li>Let <var>types</var> be « <emu-nt><a href="https://tc39.es/ecma262/#prod-NullLiteral">NullLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-BooleanLiteral">BooleanLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-NumericLiteral">NumericLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-StringLiteral">StringLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-ArrayLiteral">ArrayLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-ObjectLiteral">ObjectLiteral</a></emu-nt>, <emu-nt><a href="https://tc39.es/ecma262/#prod-UnaryExpression">UnaryExpression</a></emu-nt> ».</li><li>Let <var>unaryExpression</var> be <emu-const>empty</emu-const>.</li><li>Let <var>queue</var> be « this <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref> ».</li><li>Repeat, while <var>queue</var> is not empty,<ol><li>Let <var>candidate</var> be the first element of <var>queue</var>.</li><li>Remove the first element from <var>queue</var>.</li><li>Let <var>queuedChildren</var> be <emu-val>false</emu-val>.</li><li>For each nonterminal <var>type</var> of <var>types</var>, do<ol><li>If <var>candidate</var> is an instance of <var>type</var>, then<ol><li>NOTE: In the JSON grammar, a <code>number</code> token may represent a negative value. In ECMAScript, negation is represented as a unary operation.</li><li>If <var>type</var> is <emu-nt><a href="https://tc39.es/ecma262/#prod-UnaryExpression">UnaryExpression</a></emu-nt>, then<ol><li>Set <var>unaryExpression</var> to <var>candidate</var>.</li></ol></li><li>Else if <var>type</var> is <emu-nt><a href="https://tc39.es/ecma262/#prod-NumericLiteral">NumericLiteral</a></emu-nt>, then<ol><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>unaryExpression</var> <emu-xref aoid="Contains"><a href="https://tc39.es/ecma262/#sec-static-semantics-contains">Contains</a></emu-xref> <var>candidate</var> is <emu-val>true</emu-val>.</li><li>Return <var>unaryExpression</var>.</li></ol></li><li>Else,<ol><li>Return <var>candidate</var>.</li></ol></li></ol></li><li>If <var>queuedChildren</var> is <emu-val>false</emu-val> and <var>candidate</var> is an instance of a nonterminal and <var>candidate</var> <emu-xref aoid="Contains"><a href="https://tc39.es/ecma262/#sec-static-semantics-contains">Contains</a></emu-xref> <var>type</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>children</var> be a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> containing each child node of <var>candidate</var>, in order.</li><li>Set <var>queue</var> to the <emu-xref href="#list-concatenation"><a href="https://tc39.es/ecma262/#list-concatenation">list-concatenation</a></emu-xref> of <var>queue</var> and <var>children</var>.</li><li>Set <var>queuedChildren</var> to <emu-val>true</emu-val>.</li></ol></li></ol></li></ol></li><li>Return <emu-const>empty</emu-const>.</li></ol></emu-alg>
<emu-note type="editor"><span class="note">Editor's Note</span><div class="note-contents">
<p>
It may make sense to generalize this operation and define <emu-xref aoid="Contains"><a href="https://tc39.es/ecma262/#sec-static-semantics-contains">Contains</a></emu-xref> in terms of it rather than vice versa, but <emu-xref aoid="Contains"><a href="https://tc39.es/ecma262/#sec-static-semantics-contains">Contains</a></emu-xref> is currently limited to a single target nonterminal and has specialized treatment for e.g. <emu-nt><a href="https://tc39.es/ecma262/#prod-ClassTail">ClassTail</a></emu-nt> descending into <emu-nt><a href="https://tc39.es/ecma262/#prod-ClassBody">ClassBody</a></emu-nt> exclusively to inspect computed names.
Expand Down

0 comments on commit b3464d2

Please sign in to comment.