@@ -258,14 +258,23 @@ <h1>
258258 <emu-alg>
259259 1. Let _F_ be the active function object.
260260 1. Assert: _F_ is a `JSON.parse` built-in function object (see <emu-xref href="#sec-json.parse">JSON.parse</emu-xref>).
261- 1. Let _types_ be « |NullLiteral|, |BooleanLiteral|, |NumericLiteral|, |StringLiteral|, |ArrayLiteral|, |ObjectLiteral| ».
261+ 1. Let _types_ be « |NullLiteral|, |BooleanLiteral|, |NumericLiteral|, |StringLiteral|, |ArrayLiteral|, |ObjectLiteral|, |UnaryExpression| ».
262+ 1. Let _unaryExpression_ be ~empty~.
262263 1. Let _queue_ be « this Parse Node ».
263264 1. Repeat, while _queue_ is not empty,
264265 1. Let _candidate_ be the first element of _queue_.
265266 1. Remove the first element from _queue_.
266267 1. Let _queuedChildren_ be *false*.
267268 1. For each nonterminal _type_ of _types_, do
268- 1. If _candidate_ is an instance of _type_, return _candidate_.
269+ 1. If _candidate_ is an instance of _type_, then
270+ 1. NOTE: In the JSON grammar, a <code>number</code> token may represent a negative value. In ECMAScript, negation is represented as a unary operation.
271+ 1. If _type_ is |UnaryExpression|, then
272+ 1. Set _unaryExpression_ to _candidate_.
273+ 1. Else if _type_ is |NumericLiteral|, then
274+ 1. Assert: _unaryExpression_ Contains _candidate_ is *true*.
275+ 1. Return _unaryExpression_.
276+ 1. Else,
277+ 1. Return _candidate_.
269278 1. If _queuedChildren_ is *false* and _candidate_ is an instance of a nonterminal and _candidate_ Contains _type_ is *true*, then
270279 1. Let _children_ be a List containing each child node of _candidate_, in order.
271280 1. Set _queue_ to the list-concatenation of _queue_ and _children_.
0 commit comments