fix(json_parser): handle unterminated strings as bogus values (#2621)

This commit is contained in:
Victorien Elvinger 2024-04-28 17:43:30 +02:00 committed by GitHub
parent cf48a89a5f
commit 1abda0cfca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 852 additions and 828 deletions

View file

@ -68,6 +68,9 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
#### Bug fixes
- [noDuplicateJsonKeys](https://biomejs.dev/linter/rules/no-duplicate-json-keys/) no longer crashes when a JSON file contains an unterminated string ([#2357](https://github.com/biomejs/biome/issues/2357)).
Contributed by @Conaclos
- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) now reports redeclarations of parameters in a functions body ([#2394](https://github.com/biomejs/biome/issues/2394)).
The rule was unable to detect redeclarations of a parameter or type parameter in the function body.

View file

@ -2,7 +2,6 @@
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: json/json/json5.json
---
# Input
```json
@ -133,6 +132,19 @@ json5.json:3:3 parse ━━━━━━━━━━━━━━━━━━━
i Use double quotes to escape the string.
json5.json:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
1 │ [
2 │ {
> 3 │ '//': 'JSON5 allow `Infinity` and `NaN`',
│ ^
4 │ numbers: [
5 │ Infinity,
i Remove :
json5.json:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -146,6 +158,43 @@ json5.json:3:9 parse ━━━━━━━━━━━━━━━━━━━
i Use double quotes to escape the string.
json5.json:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
2 │ {
3 │ '//': 'JSON5 allow `Infinity` and `NaN`',
> 4 │ numbers: [
│ ^^^^^^^
5 │ Infinity,
6 │ -Infinity,
json5.json:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
2 │ {
3 │ '//': 'JSON5 allow `Infinity` and `NaN`',
> 4 │ numbers: [
│ ^
5 │ Infinity,
6 │ -Infinity,
i Remove :
json5.json:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `[`
2 │ {
3 │ '//': 'JSON5 allow `Infinity` and `NaN`',
> 4 │ numbers: [
│ ^
5 │ Infinity,
6 │ -Infinity,
i Remove [
json5.json:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
@ -157,21 +206,6 @@ json5.json:5:5 parse ━━━━━━━━━━━━━━━━━━━
6 │ -Infinity,
7 │ NaN,
json5.json:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
2 │ {
3 │ '//': 'JSON5 allow `Infinity` and `NaN`',
> 4 │ numbers: [
│ ^
> 5 │ Infinity,
│ ^^^^^^^^^
6 │ -Infinity,
7 │ NaN,
i Use an array for a sequence of values: `[1, 2]`
json5.json:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Minus must be followed by a digit
@ -183,6 +217,122 @@ json5.json:6:5 parse ━━━━━━━━━━━━━━━━━━━
7 │ NaN,
8 │ ],
json5.json:6:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `Infinity`
4 │ numbers: [
5 │ Infinity,
> 6 │ -Infinity,
│ ^^^^^^^^
7 │ NaN,
8 │ ],
i Remove Infinity
json5.json:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
5 │ Infinity,
6 │ -Infinity,
> 7 │ NaN,
│ ^^^
8 │ ],
9 │ Infinity: NaN,
json5.json:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found ']'.
6 │ -Infinity,
7 │ NaN,
> 8 │ ],
│ ^
9 │ Infinity: NaN,
10 │ NaN: Infinity,
i Expected an array, an object, or a literal here.
6 │ -Infinity,
7 │ NaN,
> 8 │ ],
│ ^
9 │ Infinity: NaN,
10 │ NaN: Infinity,
json5.json:9:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
7 │ NaN,
8 │ ],
> 9 │ Infinity: NaN,
│ ^^^^^^^^
10 │ NaN: Infinity,
11 │ NaN: -Infinity,
json5.json:9:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
7 │ NaN,
8 │ ],
> 9 │ Infinity: NaN,
│ ^
10 │ NaN: Infinity,
11 │ NaN: -Infinity,
i Remove :
json5.json:10:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
8 │ ],
9 │ Infinity: NaN,
> 10 │ NaN: Infinity,
│ ^^^
11 │ NaN: -Infinity,
12 │ },
json5.json:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
8 │ ],
9 │ Infinity: NaN,
> 10 │ NaN: Infinity,
│ ^
11 │ NaN: -Infinity,
12 │ },
i Remove :
json5.json:11:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
9 │ Infinity: NaN,
10 │ NaN: Infinity,
> 11 │ NaN: -Infinity,
│ ^^^
12 │ },
13 │ {
json5.json:11:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
9 │ Infinity: NaN,
10 │ NaN: Infinity,
> 11 │ NaN: -Infinity,
│ ^
12 │ },
13 │ {
i Remove :
json5.json:11:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Minus must be followed by a digit
@ -194,6 +344,26 @@ json5.json:11:8 parse ━━━━━━━━━━━━━━━━━━━
12 │ },
13 │ {
json5.json:12:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '}'.
10 │ NaN: Infinity,
11 │ NaN: -Infinity,
> 12 │ },
│ ^
13 │ {
14 │ '//': 'JSON5 numbers',
i Expected an array, an object, or a literal here.
10 │ NaN: Infinity,
11 │ NaN: -Infinity,
> 12 │ },
│ ^
13 │ {
14 │ '//': 'JSON5 numbers',
json5.json:13:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
@ -220,6 +390,21 @@ json5.json:14:3 parse ━━━━━━━━━━━━━━━━━━━
i Use double quotes to escape the string.
json5.json:14:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
12 │ },
13 │ {
> 14 │ '//': 'JSON5 numbers',
│ ^^^^^^^^^^^^^^^^^^
> 15 │ hexadecimal: 0xdecaf,
│ ^^^^^^^^^^^^
16 │ leadingDecimalPoint: .8675309, andTrailing: 8675309.,
17 │ positiveSign: +1,
i Use an array for a sequence of values: `[1, 2]`
json5.json:14:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -389,6 +574,24 @@ json5.json:20:3 parse ━━━━━━━━━━━━━━━━━━━
i Use double quotes to escape the string.
json5.json:20:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
18 │ },
19 │ {
> 20 │ '//': 'JSON5 strings',
│ ^^^^^^^^^^^^^^^^^^
> 21 │ singleQuotes: 'I can use "double quotes" here',
> 22 │ lineBreaks: "Look, Mom! \
> 23 │ No \\n's!",
> 24 │ }
> 25 │ ]
│ ^
26 │
i Use an array for a sequence of values: `[1, 2]`
json5.json:20:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -415,19 +618,6 @@ json5.json:21:15 parse ━━━━━━━━━━━━━━━━━━━
i Use double quotes to escape the string.
json5.json:22:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
20 │ '//': 'JSON5 strings',
21 │ singleQuotes: 'I can use "double quotes" here',
> 22 │ lineBreaks: "Look, Mom! \
│ ^^^^^^^^^^^^^
23 │ No \\n's!",
24 │ }
i Use an array for a sequence of values: `[1, 2]`
json5.json:22:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -465,17 +655,6 @@ json5.json:22:15 parse ━━━━━━━━━━━━━━━━━━━
24 │ }
25 │ ]
json5.json:23:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× String values must be double quoted.
21 │ singleQuotes: 'I can use "double quotes" here',
22 │ lineBreaks: "Look, Mom! \
> 23 │ No \\n's!",
│ ^^
24 │ }
25 │ ]
json5.json:23:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character `\`
@ -520,21 +699,5 @@ json5.json:23:7 parse ━━━━━━━━━━━━━━━━━━━
25 │ ]
26 │
json5.json:24:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
22 │ lineBreaks: "Look, Mom! \
23 │ No \\n's!",
> 24 │ }
│ ^
> 25 │ ]
│ ^
26 │
i Use an array for a sequence of values: `[1, 2]`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: json/json5-as-json-with-trailing-commas/nested-quotes.json
---
# Input
```json
@ -86,6 +85,19 @@ nested-quotes.json:4:5 parse ━━━━━━━━━━━━━━━━━
i Use double quotes to escape the string.
nested-quotes.json:4:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
2 │ "noSpace":true,
3 │ "quote": {
> 4 │ 'singleQuote': 'exa"mple',
│ ^^^^^^^^^^^^^
5 │ "indented": true,
6 │ },
i Use an array for a sequence of values: `[1, 2]`
nested-quotes.json:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -234,5 +246,3 @@ nested-quotes.json:12:4 parse ━━━━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: json/range/json-stringify/template-literal.json
---
# Input
```json
@ -71,6 +70,18 @@ template-literal.json:2:4 parse ━━━━━━━━━━━━━━━━
3 │ ''},
4 │ {a:`a`,n:
template-literal.json:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `aaa`
1 │ [
> 2 │ {a:`aaa`,n:
│ ^^^
3 │ ''},
4 │ {a:`a`,n:
i Remove aaa
template-literal.json:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character ```
@ -126,6 +137,19 @@ template-literal.json:4:4 parse ━━━━━━━━━━━━━━━━
5 │ ''}
6 │ ]
template-literal.json:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `a`
2 │ {a:`aaa`,n:
3 │ ''},
> 4 │ {a:`a`,n:
│ ^
5 │ ''}
6 │ ]
i Remove a
template-literal.json:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character ```
@ -148,19 +172,6 @@ template-literal.json:4:8 parse ━━━━━━━━━━━━━━━━
5 │ ''}
6 │ ]
template-literal.json:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
2 │ {a:`aaa`,n:
3 │ ''},
> 4 │ {a:`a`,n:
│ ^^^^^^^^^
5 │ ''}
6 │ ]
i Use an array for a sequence of values: `[1, 2]`
template-literal.json:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -176,5 +187,3 @@ template-literal.json:5:1 parse ━━━━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: json/range/template-literal-2.json
---
# Input
```json
@ -65,6 +64,18 @@ template-literal-2.json:2:4 parse ━━━━━━━━━━━━━━━
3 │ ''},
4 │ {a:`a`,n:
template-literal-2.json:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `a`
1 │ [
> 2 │ {a:`a`,n:
│ ^
3 │ ''},
4 │ {a:`a`,n:
i Remove a
template-literal-2.json:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character ```
@ -120,6 +131,19 @@ template-literal-2.json:4:4 parse ━━━━━━━━━━━━━━━
5 │ ''}
6 │ ]
template-literal-2.json:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `a`
2 │ {a:`a`,n:
3 │ ''},
> 4 │ {a:`a`,n:
│ ^
5 │ ''}
6 │ ]
i Remove a
template-literal-2.json:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character ```
@ -142,19 +166,6 @@ template-literal-2.json:4:8 parse ━━━━━━━━━━━━━━━
5 │ ''}
6 │ ]
template-literal-2.json:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
2 │ {a:`a`,n:
3 │ ''},
> 4 │ {a:`a`,n:
│ ^^^^^^^^^
5 │ ''}
6 │ ]
i Use an array for a sequence of values: `[1, 2]`
template-literal-2.json:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -170,5 +181,3 @@ template-literal-2.json:5:1 parse ━━━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_formatter_test/src/snapshot_builder.rs
info: json/range/template-literal.json
---
# Input
```json
@ -65,6 +64,18 @@ template-literal.json:2:4 parse ━━━━━━━━━━━━━━━━
3 │ ''},
4 │ {a:`a`,n:
template-literal.json:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `a`
1 │ [
> 2 │ {a:`a`,n:
│ ^
3 │ ''},
4 │ {a:`a`,n:
i Remove a
template-literal.json:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character ```
@ -120,6 +131,19 @@ template-literal.json:4:4 parse ━━━━━━━━━━━━━━━━
5 │ ''}
6 │ ]
template-literal.json:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `a`
2 │ {a:`a`,n:
3 │ ''},
> 4 │ {a:`a`,n:
│ ^
5 │ ''}
6 │ ]
i Remove a
template-literal.json:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× unexpected character ```
@ -142,19 +166,6 @@ template-literal.json:4:8 parse ━━━━━━━━━━━━━━━━
5 │ ''}
6 │ ]
template-literal.json:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
2 │ {a:`a`,n:
3 │ ''},
> 4 │ {a:`a`,n:
│ ^^^^^^^^^
5 │ ''}
6 │ ]
i Use an array for a sequence of values: `[1, 2]`
template-literal.json:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× JSON standard does not allow single quoted strings
@ -170,5 +181,3 @@ template-literal.json:5:1 parse ━━━━━━━━━━━━━━━━
```

View file

@ -575,8 +575,7 @@ impl<'src> Lexer<'src> {
.with_detail(self.position..self.position + 1, "line breaks here");
self.diagnostics.push(unterminated);
return JSON_STRING_LITERAL;
return ERROR_TOKEN;
}
UNI => self.advance_char_unchecked(),
@ -624,8 +623,7 @@ impl<'src> Lexer<'src> {
"file ends here",
);
self.diagnostics.push(unterminated);
JSON_STRING_LITERAL
ERROR_TOKEN
}
LexStringState::InvalidEscapeSequence => ERROR_TOKEN,
}

View file

@ -243,7 +243,7 @@ fn single_quote_string() {
fn unterminated_string() {
assert_lex! {
r#""A string without the closing quote"#,
JSON_STRING_LITERAL:35,
ERROR_TOKEN:35,
EOF:0
}
}

View file

@ -80,6 +80,13 @@ fn parse_value(p: &mut JsonParser) -> ParsedSyntax {
Present(m.complete(p, JSON_BOGUS_VALUE))
}
ERROR_TOKEN => {
// An error is already emitted by the lexer.
let m = p.start();
p.bump(ERROR_TOKEN);
Present(m.complete(p, JSON_BOGUS_VALUE))
}
_ => Absent,
}
}
@ -282,10 +289,10 @@ fn parse_member_name(p: &mut JsonParser) -> ParsedSyntax {
p.bump(JSON_STRING_LITERAL);
Present(m.complete(p, JSON_MEMBER_NAME))
}
IDENT => {
IDENT | T![null] | T![true] | T![false] => {
let m = p.start();
p.error(p.err_builder("Property key must be double quoted", p.cur_range()));
p.bump(IDENT);
p.bump_remap(IDENT);
Present(m.complete(p, JSON_MEMBER_NAME))
}
_ => Absent,

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,7 +20,17 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..5 "\"\u{b}a\"" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@5..6 "\\" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@6..7 "f" [] [],
],
},
@ -40,10 +49,14 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..8
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..7
0: JSON_BOGUS_VALUE@1..7
0: JSON_BOGUS_VALUE@1..5
0: ERROR_TOKEN@1..5 "\"\u{b}a\"" [] []
1: ERROR_TOKEN@5..6 "\\" [] []
2: IDENT@6..7 "f" [] []
1: (empty)
2: JSON_BOGUS_VALUE@5..6
0: ERROR_TOKEN@5..6 "\\" [] []
3: (empty)
4: JSON_BOGUS_VALUE@6..7
0: IDENT@6..7 "f" [] []
2: R_BRACK@7..8 "]" [] []
2: EOF@8..8 "" [] []
@ -52,18 +65,6 @@ JsonRoot {
## Diagnostics
```
array_spaces_vertical_tab_formfeed.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '" a"\f'.
> 1 │ ["␋a"\f]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["␋a"\f]
│ ^^^^^
array_spaces_vertical_tab_formfeed.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Control character '\u000b' is not allowed in string literals.
@ -80,6 +81,13 @@ array_spaces_vertical_tab_formfeed.json:1:6 parse ━━━━━━━━━━
> 1 │ ["␋a"\f]
│ ^
array_spaces_vertical_tab_formfeed.json:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `f`
> 1 │ ["␋a"\f]
│ ^
i Remove f
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "+" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@2..3 "+" [] [],
],
},
@ -43,11 +47,13 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..8
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..7
0: JSON_BOGUS_VALUE@1..3
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "+" [] []
1: ERROR_TOKEN@2..3 "+" [] []
1: (empty)
2: JSON_NUMBER_VALUE@3..7
2: JSON_BOGUS_VALUE@2..3
0: ERROR_TOKEN@2..3 "+" [] []
3: (empty)
4: JSON_NUMBER_VALUE@3..7
0: JSON_NUMBER_LITERAL@3..7 "1234" [] []
2: R_BRACK@7..8 "]" [] []
2: EOF@8..8 "" [] []
@ -81,5 +87,3 @@ number_++.json:1:4 parse ━━━━━━━━━━━━━━━━━━
i Remove 1234
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "+" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..5 "Inf" [] [],
],
},
@ -39,9 +43,11 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..6
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..5
0: JSON_BOGUS_VALUE@1..5
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "+" [] []
1: IDENT@2..5 "Inf" [] []
1: (empty)
2: JSON_BOGUS_VALUE@2..5
0: IDENT@2..5 "Inf" [] []
2: R_BRACK@5..6 "]" [] []
2: EOF@6..6 "" [] []
@ -57,6 +63,13 @@ number_+Inf.json:1:2 parse ━━━━━━━━━━━━━━━━━
> 1 │ [+Inf]
│ ^
number_+Inf.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `Inf`
> 1 │ [+Inf]
│ ^^^
i Remove Inf
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_-01.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '-01'.
> 1 │ [-01]
│ ^^^
i Expected an array, an object, or a literal here.
> 1 │ [-01]
│ ^^^
number_-01.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× The JSON standard doesn't allow octal number notation (numbers starting with zero)
@ -68,5 +55,3 @@ number_-01.json:1:3 parse ━━━━━━━━━━━━━━━━━━
│ ^
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_-1.0..json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '-1.0.'.
> 1 │ [-1.0.]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ [-1.0.]
│ ^^^^^
number_-1.0..json:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid fraction part
@ -67,6 +54,4 @@ number_-1.0..json:1:6 parse ━━━━━━━━━━━━━━━━━
> 1 │ [-1.0.]
│ ^
```
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_-2..json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '-2.'.
> 1 │ [-2.]
│ ^^^
i Expected an array, an object, or a literal here.
> 1 │ [-2.]
│ ^^^
number_-2..json:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_-2..json:1:5 parse ━━━━━━━━━━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "-" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..5 "NaN" [] [],
],
},
@ -39,9 +43,11 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..6
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..5
0: JSON_BOGUS_VALUE@1..5
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "-" [] []
1: IDENT@2..5 "NaN" [] []
1: (empty)
2: JSON_BOGUS_VALUE@2..5
0: IDENT@2..5 "NaN" [] []
2: R_BRACK@5..6 "]" [] []
2: EOF@6..6 "" [] []
@ -57,6 +63,13 @@ number_-NaN.json:1:2 parse ━━━━━━━━━━━━━━━━━
> 1 │ [-NaN]
│ ^
number_-NaN.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `NaN`
> 1 │ [-NaN]
│ ^^^
i Remove NaN
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_0.1.2.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '0.1.2'.
> 1 │ [0.1.2]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ [0.1.2]
│ ^^^^^
number_0.1.2.json:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid fraction part
@ -68,5 +55,3 @@ number_0.1.2.json:1:5 parse ━━━━━━━━━━━━━━━━━
│ ^
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_0.e1.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '0.e1'.
> 1 │ [0.e1]
│ ^^^^
i Expected an array, an object, or a literal here.
> 1 │ [0.e1]
│ ^^^^
number_0.e1.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_0.e1.json:1:4 parse ━━━━━━━━━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_2.e-3.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '2.e-3'.
> 1 │ [2.e-3]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ [2.e-3]
│ ^^^^^
number_2.e-3.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_2.e-3.json:1:4 parse ━━━━━━━━━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_2.e3.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '2.e3'.
> 1 │ [2.e3]
│ ^^^^
i Expected an array, an object, or a literal here.
> 1 │ [2.e3]
│ ^^^^
number_2.e3.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_2.e3.json:1:4 parse ━━━━━━━━━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_2.e_plus_3.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '2.e+3'.
> 1 │ [2.e+3]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ [2.e+3]
│ ^^^^^
number_2.e_plus_3.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_2.e_plus_3.json:1:4 parse ━━━━━━━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_9.e+.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '9.e+'.
> 1 │ [9.e+]
│ ^^^^
i Expected an array, an object, or a literal here.
> 1 │ [9.e+]
│ ^^^^
number_9.e+.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_9.e+.json:1:4 parse ━━━━━━━━━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "-" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..10 "Infinity" [] [],
],
},
@ -39,9 +43,11 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..11
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..10
0: JSON_BOGUS_VALUE@1..10
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "-" [] []
1: IDENT@2..10 "Infinity" [] []
1: (empty)
2: JSON_BOGUS_VALUE@2..10
0: IDENT@2..10 "Infinity" [] []
2: R_BRACK@10..11 "]" [] []
2: EOF@11..11 "" [] []
@ -57,6 +63,13 @@ number_minus_infinity.json:1:2 parse ━━━━━━━━━━━━━━
> 1 │ [-Infinity]
│ ^
number_minus_infinity.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `Infinity`
> 1 │ [-Infinity]
│ ^^^^^^^^
i Remove Infinity
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "-" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..5 "foo" [] [],
],
},
@ -39,9 +43,11 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..6
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..5
0: JSON_BOGUS_VALUE@1..5
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "-" [] []
1: IDENT@2..5 "foo" [] []
1: (empty)
2: JSON_BOGUS_VALUE@2..5
0: IDENT@2..5 "foo" [] []
2: R_BRACK@5..6 "]" [] []
2: EOF@6..6 "" [] []
@ -57,6 +63,13 @@ number_minus_sign_with_trailing_garbage.json:1:2 parse ━━━━━━━━
> 1 │ [-foo]
│ ^
number_minus_sign_with_trailing_garbage.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `foo`
> 1 │ [-foo]
│ ^^^
i Remove foo
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_neg_int_starting_with_zero.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '-012'.
> 1 │ [-012]
│ ^^^^
i Expected an array, an object, or a literal here.
> 1 │ [-012]
│ ^^^^
number_neg_int_starting_with_zero.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× The JSON standard doesn't allow octal number notation (numbers starting with zero)
@ -68,5 +55,3 @@ number_neg_int_starting_with_zero.json:1:3 parse ━━━━━━━━━━
│ ^
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_neg_real_without_int_part.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '-.123'.
> 1 │ [-.123]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ [-.123]
│ ^^^^^
number_neg_real_without_int_part.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid fraction part
@ -68,5 +55,3 @@ number_neg_real_without_int_part.json:1:3 parse ━━━━━━━━━━
│ ^
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..3 "1e" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@3..4 "a" [] [],
],
},
@ -39,9 +43,11 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..5
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..4
0: JSON_BOGUS_VALUE@1..4
0: JSON_BOGUS_VALUE@1..3
0: ERROR_TOKEN@1..3 "1e" [] []
1: IDENT@3..4 "a" [] []
1: (empty)
2: JSON_BOGUS_VALUE@3..4
0: IDENT@3..4 "a" [] []
2: R_BRACK@4..5 "]" [] []
2: EOF@5..5 "" [] []
@ -62,6 +68,13 @@ number_real_garbage_after_e.json:1:2 parse ━━━━━━━━━━━━
> 1 │ [1ea]
│ ^
number_real_garbage_after_e.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `a`
> 1 │ [1ea]
│ ^
i Remove a
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
number_real_without_fractional_part.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '1.'.
> 1 │ [1.]
│ ^^
i Expected an array, an object, or a literal here.
> 1 │ [1.]
│ ^^
number_real_without_fractional_part.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing fraction
@ -70,5 +57,3 @@ number_real_without_fractional_part.json:1:4 parse ━━━━━━━━━
i Remove the `.`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -15,26 +14,32 @@ expression: snapshot
```
JsonRoot {
bom_token: missing (optional),
value: JsonObjectValue {
l_curly_token: L_CURLY@0..1 "{" [] [],
json_member_list: JsonMemberList [
JsonMember {
name: JsonMemberName {
value_token: JSON_STRING_LITERAL@1..4 "\"x\"" [] [],
},
colon_token: missing (required),
value: missing (required),
},
COMMA@4..6 "," [] [Whitespace(" ")],
JsonMember {
name: missing (required),
colon_token: missing (required),
value: JsonNullValue {
value_token: NULL_KW@6..10 "null" [] [],
},
value: JsonBogusValue {
items: [
L_CURLY@0..1 "{" [] [],
JsonBogus {
items: [
JsonMember {
name: JsonMemberName {
value_token: JSON_STRING_LITERAL@1..4 "\"x\"" [] [],
},
colon_token: missing (required),
value: missing (required),
},
COMMA@4..6 "," [] [Whitespace(" ")],
JsonBogus {
items: [
JsonBogus {
items: [
IDENT@6..10 "null" [] [],
],
},
],
},
],
},
R_CURLY@10..11 "}" [] [],
],
r_curly_token: R_CURLY@10..11 "}" [] [],
},
eof_token: EOF@11..11 "" [] [],
}
@ -45,20 +50,18 @@ JsonRoot {
```
0: JSON_ROOT@0..11
0: (empty)
1: JSON_OBJECT_VALUE@0..11
1: JSON_BOGUS_VALUE@0..11
0: L_CURLY@0..1 "{" [] []
1: JSON_MEMBER_LIST@1..10
1: JSON_BOGUS@1..10
0: JSON_MEMBER@1..4
0: JSON_MEMBER_NAME@1..4
0: JSON_STRING_LITERAL@1..4 "\"x\"" [] []
1: (empty)
2: (empty)
1: COMMA@4..6 "," [] [Whitespace(" ")]
2: JSON_MEMBER@6..10
0: (empty)
1: (empty)
2: JSON_NULL_VALUE@6..10
0: NULL_KW@6..10 "null" [] []
2: JSON_BOGUS@6..10
0: JSON_BOGUS@6..10
0: IDENT@6..10 "null" [] []
2: R_CURLY@10..11 "}" [] []
2: EOF@11..11 "" [] []
@ -78,16 +81,18 @@ object_comma_instead_of_colon.json:1:5 parse ━━━━━━━━━━━
object_comma_instead_of_colon.json:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected a property but instead found 'null'.
× Property key must be double quoted
> 1 │ {"x", null}
│ ^^^^
i Expected a property here.
object_comma_instead_of_colon.json:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `:` but instead found `}`
> 1 │ {"x", null}
│ ^^^^
│ ^
i Remove }
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -28,11 +27,11 @@ JsonRoot {
],
},
COLON@4..6 ":" [] [Whitespace(" ")],
],
},
JsonBogusValue {
items: [
ERROR_TOKEN@6..13 "'value'" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@6..13 "'value'" [] [],
],
},
],
},
],
@ -52,12 +51,12 @@ JsonRoot {
1: JSON_BOGUS_VALUE@0..14
0: L_CURLY@0..1 "{" [] []
1: JSON_BOGUS@1..13
0: JSON_BOGUS@1..6
0: JSON_BOGUS@1..13
0: JSON_BOGUS@1..4
0: IDENT@1..4 "key" [] []
1: COLON@4..6 ":" [] [Whitespace(" ")]
1: JSON_BOGUS_VALUE@6..13
0: ERROR_TOKEN@6..13 "'value'" [] []
2: JSON_BOGUS_VALUE@6..13
0: ERROR_TOKEN@6..13 "'value'" [] []
2: R_CURLY@13..14 "}" [] []
2: EOF@14..14 "" [] []
@ -83,5 +82,3 @@ object_key_with_single_quotes.json:1:7 parse ━━━━━━━━━━━
i Use double quotes to escape the string.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -15,42 +14,42 @@ expression: snapshot
```
JsonRoot {
bom_token: missing (optional),
value: JsonObjectValue {
l_curly_token: L_CURLY@0..1 "{" [] [],
json_member_list: JsonMemberList [
JsonMember {
name: missing (required),
colon_token: missing (required),
value: JsonNullValue {
value_token: NULL_KW@1..5 "null" [] [],
},
},
missing separator,
JsonMember {
name: missing (required),
colon_token: COLON@5..6 ":" [] [],
value: JsonNullValue {
value_token: NULL_KW@6..10 "null" [] [],
},
},
COMMA@10..11 "," [] [],
JsonMember {
name: missing (required),
colon_token: missing (required),
value: JsonNullValue {
value_token: NULL_KW@11..15 "null" [] [],
},
},
missing separator,
JsonMember {
name: missing (required),
colon_token: COLON@15..16 ":" [] [],
value: JsonNullValue {
value_token: NULL_KW@16..20 "null" [] [],
},
value: JsonBogusValue {
items: [
L_CURLY@0..1 "{" [] [],
JsonBogus {
items: [
JsonBogus {
items: [
JsonBogus {
items: [
IDENT@1..5 "null" [] [],
],
},
COLON@5..6 ":" [] [],
JsonNullValue {
value_token: NULL_KW@6..10 "null" [] [],
},
],
},
COMMA@10..11 "," [] [],
JsonBogus {
items: [
JsonBogus {
items: [
IDENT@11..15 "null" [] [],
],
},
COLON@15..16 ":" [] [],
JsonNullValue {
value_token: NULL_KW@16..20 "null" [] [],
},
],
},
],
},
R_CURLY@20..21 "}" [] [],
],
r_curly_token: R_CURLY@20..21 "}" [] [],
},
eof_token: EOF@21..21 "" [] [],
}
@ -61,29 +60,19 @@ JsonRoot {
```
0: JSON_ROOT@0..21
0: (empty)
1: JSON_OBJECT_VALUE@0..21
1: JSON_BOGUS_VALUE@0..21
0: L_CURLY@0..1 "{" [] []
1: JSON_MEMBER_LIST@1..20
0: JSON_MEMBER@1..5
0: (empty)
1: (empty)
2: JSON_NULL_VALUE@1..5
0: NULL_KW@1..5 "null" [] []
1: (empty)
2: JSON_MEMBER@5..10
0: (empty)
1: JSON_BOGUS@1..20
0: JSON_BOGUS@1..10
0: JSON_BOGUS@1..5
0: IDENT@1..5 "null" [] []
1: COLON@5..6 ":" [] []
2: JSON_NULL_VALUE@6..10
0: NULL_KW@6..10 "null" [] []
3: COMMA@10..11 "," [] []
4: JSON_MEMBER@11..15
0: (empty)
1: (empty)
2: JSON_NULL_VALUE@11..15
0: NULL_KW@11..15 "null" [] []
5: (empty)
6: JSON_MEMBER@15..20
0: (empty)
1: COMMA@10..11 "," [] []
2: JSON_BOGUS@11..20
0: JSON_BOGUS@11..15
0: IDENT@11..15 "null" [] []
1: COLON@15..16 ":" [] []
2: JSON_NULL_VALUE@16..20
0: NULL_KW@16..20 "null" [] []
@ -97,46 +86,16 @@ JsonRoot {
```
object_repeated_null_null.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected a property but instead found 'null'.
× Property key must be double quoted
> 1 │ {null:null,null:null}
│ ^^^^
i Expected a property here.
> 1 │ {null:null,null:null}
│ ^^^^
object_repeated_null_null.json:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
> 1 │ {null:null,null:null}
│ ^
i Remove :
object_repeated_null_null.json:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected a property but instead found 'null'.
× Property key must be double quoted
> 1 │ {null:null,null:null}
│ ^^^^
i Expected a property here.
> 1 │ {null:null,null:null}
│ ^^^^
object_repeated_null_null.json:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `:`
> 1 │ {null:null,null:null}
│ ^
i Remove :
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -23,8 +22,10 @@ JsonRoot {
value_token: JSON_STRING_LITERAL@1..4 "\"a\"" [] [],
},
colon_token: COLON@4..5 ":" [] [],
value: JsonStringValue {
value_token: JSON_STRING_LITERAL@5..7 "\"a" [] [],
value: JsonBogusValue {
items: [
ERROR_TOKEN@5..7 "\"a" [] [],
],
},
},
],
@ -46,8 +47,8 @@ JsonRoot {
0: JSON_MEMBER_NAME@1..4
0: JSON_STRING_LITERAL@1..4 "\"a\"" [] []
1: COLON@4..5 ":" [] []
2: JSON_STRING_VALUE@5..7
0: JSON_STRING_LITERAL@5..7 "\"a" [] []
2: JSON_BOGUS_VALUE@5..7
0: ERROR_TOKEN@5..7 "\"a" [] []
2: (empty)
2: EOF@7..7 "" [] []
@ -81,5 +82,3 @@ object_unterminated-value.json:1:8 parse ━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -18,8 +17,10 @@ JsonRoot {
value: JsonArrayValue {
l_brack_token: L_BRACK@0..1 "[" [] [],
elements: JsonArrayElementList [
JsonStringValue {
value_token: JSON_STRING_LITERAL@1..11 "\"\\uD800\\\"]" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@1..11 "\"\\uD800\\\"]" [] [],
],
},
],
r_brack_token: missing (required),
@ -36,8 +37,8 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..11
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..11
0: JSON_STRING_VALUE@1..11
0: JSON_STRING_LITERAL@1..11 "\"\\uD800\\\"]" [] []
0: JSON_BOGUS_VALUE@1..11
0: ERROR_TOKEN@1..11 "\"\\uD800\\\"]" [] []
2: (empty)
2: EOF@11..11 "" [] []
@ -71,5 +72,3 @@ string_1_surrogate_then_escape.json:1:12 parse ━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_1_surrogate_then_escape_u.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\uD800\u"'.
> 1 │ ["\uD800\u"]
│ ^^^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\uD800\u"]
│ ^^^^^^^^^^
string_1_surrogate_then_escape_u.json:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid unicode sequence
@ -75,5 +62,3 @@ string_1_surrogate_then_escape_u.json:1:9 parse ━━━━━━━━━━
i A unicode escape sequence must consist of 4 hexadecimal numbers: `\uXXXX`, e.g. `\u002F' for '/'.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_1_surrogate_then_escape_u1.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\uD800\u1"'.
> 1 │ ["\uD800\u1"]
│ ^^^^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\uD800\u1"]
│ ^^^^^^^^^^^
string_1_surrogate_then_escape_u1.json:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid unicode sequence
@ -75,5 +62,3 @@ string_1_surrogate_then_escape_u1.json:1:9 parse ━━━━━━━━━━
i A unicode escape sequence must consist of 4 hexadecimal numbers: `\uXXXX`, e.g. `\u002F' for '/'.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_1_surrogate_then_escape_u1x.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\uD800\u1x"'.
> 1 │ ["\uD800\u1x"]
│ ^^^^^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\uD800\u1x"]
│ ^^^^^^^^^^^^
string_1_surrogate_then_escape_u1x.json:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid unicode sequence
@ -75,5 +62,3 @@ string_1_surrogate_then_escape_u1x.json:1:9 parse ━━━━━━━━━━
i A unicode escape sequence must consist of 4 hexadecimal numbers: `\uXXXX`, e.g. `\u002F' for '/'.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_escape_x.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\x00"'.
> 1 │ ["\x00"]
│ ^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\x00"]
│ ^^^^^^
string_escape_x.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -70,5 +57,3 @@ string_escape_x.json:1:3 parse ━━━━━━━━━━━━━━━━
i Valid escape sequences are: `\\`, `\/`, `/"`, `\b\`, `\f`, `\n`, `\r`, `\t` or any unicode escape sequence `\uXXXX` where X is hexedecimal number.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -18,8 +17,10 @@ JsonRoot {
value: JsonArrayValue {
l_brack_token: L_BRACK@0..1 "[" [] [],
elements: JsonArrayElementList [
JsonStringValue {
value_token: JSON_STRING_LITERAL@1..7 "\"\\\\\\\"]" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@1..7 "\"\\\\\\\"]" [] [],
],
},
],
r_brack_token: missing (required),
@ -36,8 +37,8 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..7
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..7
0: JSON_STRING_VALUE@1..7
0: JSON_STRING_LITERAL@1..7 "\"\\\\\\\"]" [] []
0: JSON_BOGUS_VALUE@1..7
0: ERROR_TOKEN@1..7 "\"\\\\\\\"]" [] []
2: (empty)
2: EOF@7..7 "" [] []
@ -71,5 +72,3 @@ string_escaped_backslash_bad.json:1:8 parse ━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_escaped_ctrl_char_tab.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\ "'.
> 1 │ ["\ "]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\ "]
│ ^^^^^
string_escaped_ctrl_char_tab.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -70,5 +57,3 @@ string_escaped_ctrl_char_tab.json:1:3 parse ━━━━━━━━━━━━
i Valid escape sequences are: `\\`, `\/`, `/"`, `\b\`, `\f`, `\n`, `\r`, `\t` or any unicode escape sequence `\uXXXX` where X is hexedecimal number.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_escaped_emoji.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\🌀"'.
> 1 │ ["\🌀"]
│ ^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\🌀"]
│ ^^^^^
string_escaped_emoji.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -70,5 +57,3 @@ string_escaped_emoji.json:1:3 parse ━━━━━━━━━━━━━━
i Valid escape sequences are: `\\`, `\/`, `/"`, `\b\`, `\f`, `\n`, `\r`, `\t` or any unicode escape sequence `\uXXXX` where X is hexedecimal number.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -18,8 +17,10 @@ JsonRoot {
value: JsonArrayValue {
l_brack_token: L_BRACK@0..1 "[" [] [],
elements: JsonArrayElementList [
JsonStringValue {
value_token: JSON_STRING_LITERAL@1..5 "\"\\\"]" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@1..5 "\"\\\"]" [] [],
],
},
],
r_brack_token: missing (required),
@ -36,8 +37,8 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..5
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..5
0: JSON_STRING_VALUE@1..5
0: JSON_STRING_LITERAL@1..5 "\"\\\"]" [] []
0: JSON_BOGUS_VALUE@1..5
0: ERROR_TOKEN@1..5 "\"\\\"]" [] []
2: (empty)
2: EOF@5..5 "" [] []
@ -71,5 +72,3 @@ string_incomplete_escape.json:1:6 parse ━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_incomplete_escaped_character.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\u00A"'.
> 1 │ ["\u00A"]
│ ^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\u00A"]
│ ^^^^^^^
string_incomplete_escaped_character.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid unicode sequence
@ -75,5 +62,3 @@ string_incomplete_escaped_character.json:1:3 parse ━━━━━━━━━
i A unicode escape sequence must consist of 4 hexadecimal numbers: `\uXXXX`, e.g. `\u002F' for '/'.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_incomplete_surrogate.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\uD834\uDd"'.
> 1 │ ["\uD834\uDd"]
│ ^^^^^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\uD834\uDd"]
│ ^^^^^^^^^^^^
string_incomplete_surrogate.json:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid unicode sequence
@ -75,5 +62,3 @@ string_incomplete_surrogate.json:1:9 parse ━━━━━━━━━━━━
i A unicode escape sequence must consist of 4 hexadecimal numbers: `\uXXXX`, e.g. `\u002F' for '/'.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_incomplete_surrogate_escape_invalid.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\uD800\uD800\x"'.
> 1 │ ["\uD800\uD800\x"]
│ ^^^^^^^^^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\uD800\uD800\x"]
│ ^^^^^^^^^^^^^^^^
string_incomplete_surrogate_escape_invalid.json:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -70,5 +57,3 @@ string_incomplete_surrogate_escape_invalid.json:1:15 parse ━━━━━━━
i Valid escape sequences are: `\\`, `\/`, `/"`, `\b\`, `\f`, `\n`, `\r`, `\t` or any unicode escape sequence `\uXXXX` where X is hexedecimal number.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_invalid_backslash_esc.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\a"'.
> 1 │ ["\a"]
│ ^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\a"]
│ ^^^^
string_invalid_backslash_esc.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -70,5 +57,3 @@ string_invalid_backslash_esc.json:1:3 parse ━━━━━━━━━━━━
i Valid escape sequences are: `\\`, `\/`, `/"`, `\b\`, `\f`, `\n`, `\r`, `\t` or any unicode escape sequence `\uXXXX` where X is hexedecimal number.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_invalid_unicode_escape.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\uqqqq"'.
> 1 │ ["\uqqqq"]
│ ^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\uqqqq"]
│ ^^^^^^^^
string_invalid_unicode_escape.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid unicode sequence
@ -75,5 +62,3 @@ string_invalid_unicode_escape.json:1:3 parse ━━━━━━━━━━━
i A unicode escape sequence must consist of 4 hexadecimal numbers: `\uXXXX`, e.g. `\u002F' for '/'.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "\\" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..7 "u0020" [] [],
],
},
@ -43,11 +47,13 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..13
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..12
0: JSON_BOGUS_VALUE@1..7
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "\\" [] []
1: IDENT@2..7 "u0020" [] []
1: (empty)
2: JSON_STRING_VALUE@7..12
2: JSON_BOGUS_VALUE@2..7
0: IDENT@2..7 "u0020" [] []
3: (empty)
4: JSON_STRING_VALUE@7..12
0: JSON_STRING_LITERAL@7..12 "\"asd\"" [] []
2: R_BRACK@12..13 "]" [] []
2: EOF@13..13 "" [] []
@ -64,6 +70,15 @@ string_leading_uescaped_thinspace.json:1:2 parse ━━━━━━━━━━
> 1 │ [\u0020"asd"]
│ ^
string_leading_uescaped_thinspace.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `u0020`
> 1 │ [\u0020"asd"]
│ ^^^^^
i Remove u0020
string_leading_uescaped_thinspace.json:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `"asd"`
@ -74,5 +89,3 @@ string_leading_uescaped_thinspace.json:1:8 parse ━━━━━━━━━━
i Remove "asd"
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "\\" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..3 "n" [] [],
],
},
@ -39,9 +43,11 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..4
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..3
0: JSON_BOGUS_VALUE@1..3
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "\\" [] []
1: IDENT@2..3 "n" [] []
1: (empty)
2: JSON_BOGUS_VALUE@2..3
0: IDENT@2..3 "n" [] []
2: R_BRACK@3..4 "]" [] []
2: EOF@4..4 "" [] []
@ -57,6 +63,13 @@ string_no_quotes_with_bad_escape.json:1:2 parse ━━━━━━━━━━
> 1 │ [\n]
│ ^
string_no_quotes_with_bad_escape.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `n`
> 1 │ [\n]
│ ^
i Remove n
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -15,8 +14,10 @@ expression: snapshot
```
JsonRoot {
bom_token: missing (optional),
value: JsonStringValue {
value_token: JSON_STRING_LITERAL@0..1 "\"" [] [],
value: JsonBogusValue {
items: [
ERROR_TOKEN@0..1 "\"" [] [],
],
},
eof_token: EOF@1..1 "" [] [],
}
@ -27,8 +28,8 @@ JsonRoot {
```
0: JSON_ROOT@0..1
0: (empty)
1: JSON_STRING_VALUE@0..1
0: JSON_STRING_LITERAL@0..1 "\"" [] []
1: JSON_BOGUS_VALUE@0..1
0: ERROR_TOKEN@0..1 "\"" [] []
2: EOF@1..1 "" [] []
```
@ -49,5 +50,3 @@ string_single_doublequote.json:1:1 parse ━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_start_escape_unclosed.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\'.
> 1 │ ["\
│ ^^
i Expected an array, an object, or a literal here.
> 1 │ ["\
│ ^^
string_start_escape_unclosed.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an escape sequence following a backslash, but found none
@ -85,5 +72,3 @@ string_start_escape_unclosed.json:1:4 parse ━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -19,8 +18,10 @@ JsonRoot {
value: JsonArrayValue {
l_brack_token: L_BRACK@0..1 "[" [] [],
elements: JsonArrayElementList [
JsonStringValue {
value_token: JSON_STRING_LITERAL@1..5 "\"new" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@1..5 "\"new" [] [],
],
},
missing separator,
JsonBogusValue {
@ -29,8 +30,10 @@ JsonRoot {
],
},
missing separator,
JsonStringValue {
value_token: JSON_STRING_LITERAL@10..12 "\"]" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@10..12 "\"]" [] [],
],
},
],
r_brack_token: missing (required),
@ -47,14 +50,14 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..12
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..12
0: JSON_STRING_VALUE@1..5
0: JSON_STRING_LITERAL@1..5 "\"new" [] []
0: JSON_BOGUS_VALUE@1..5
0: ERROR_TOKEN@1..5 "\"new" [] []
1: (empty)
2: JSON_BOGUS_VALUE@5..10
0: IDENT@5..10 "line" [Newline("\n")] []
3: (empty)
4: JSON_STRING_VALUE@10..12
0: JSON_STRING_LITERAL@10..12 "\"]" [] []
4: JSON_BOGUS_VALUE@10..12
0: ERROR_TOKEN@10..12 "\"]" [] []
2: (empty)
2: EOF@12..12 "" [] []
@ -117,5 +120,3 @@ string_unescaped_newline.json:2:7 parse ━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -48,18 +47,6 @@ JsonRoot {
## Diagnostics
```
string_unescaped_tab.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '" "'.
> 1 │ [" "]
│ ^^^^
i Expected an array, an object, or a literal here.
> 1 │ [" "]
│ ^^^^
string_unescaped_tab.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Control character '\u0009' is not allowed in string literals.
@ -70,5 +57,3 @@ string_unescaped_tab.json:1:3 parse ━━━━━━━━━━━━━━
i Use the escape sequence '\u0009' instead.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -38,18 +37,6 @@ JsonRoot {
## Diagnostics
```
string_unicode_CapitalU.json:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\UA66D"'.
> 1 │ "\UA66D"
│ ^^^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ "\UA66D"
│ ^^^^^^^^
string_unicode_CapitalU.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -60,5 +47,3 @@ string_unicode_CapitalU.json:1:2 parse ━━━━━━━━━━━━━
i Valid escape sequences are: `\\`, `\/`, `/"`, `\b\`, `\f`, `\n`, `\r`, `\t` or any unicode escape sequence `\uXXXX` where X is hexedecimal number.
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -15,12 +14,28 @@ expression: snapshot
```
JsonRoot {
bom_token: missing (optional),
value: JsonBogusValue {
items: [
ERROR_TOKEN@0..1 "<" [] [],
ERROR_TOKEN@1..2 "." [] [],
ERROR_TOKEN@2..3 ">" [] [],
value: JsonArrayValue {
l_brack_token: missing (required),
elements: JsonArrayElementList [
JsonBogusValue {
items: [
ERROR_TOKEN@0..1 "<" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "." [] [],
],
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@2..3 ">" [] [],
],
},
],
r_brack_token: missing (required),
},
eof_token: EOF@3..3 "" [] [],
}
@ -31,10 +46,18 @@ JsonRoot {
```
0: JSON_ROOT@0..3
0: (empty)
1: JSON_BOGUS_VALUE@0..3
0: ERROR_TOKEN@0..1 "<" [] []
1: ERROR_TOKEN@1..2 "." [] []
2: ERROR_TOKEN@2..3 ">" [] []
1: JSON_ARRAY_VALUE@0..3
0: (empty)
1: JSON_ARRAY_ELEMENT_LIST@0..3
0: JSON_BOGUS_VALUE@0..1
0: ERROR_TOKEN@0..1 "<" [] []
1: (empty)
2: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "." [] []
3: (empty)
4: JSON_BOGUS_VALUE@2..3
0: ERROR_TOKEN@2..3 ">" [] []
2: (empty)
2: EOF@3..3 "" [] []
```
@ -64,5 +87,3 @@ structure_angle_bracket_..json:1:3 parse ━━━━━━━━━━━━━
│ ^
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -18,8 +17,10 @@ JsonRoot {
value: JsonArrayValue {
l_brack_token: L_BRACK@0..1 "[" [] [],
elements: JsonArrayElementList [
JsonStringValue {
value_token: JSON_STRING_LITERAL@1..6 "\"asd]" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@1..6 "\"asd]" [] [],
],
},
],
r_brack_token: missing (required),
@ -36,8 +37,8 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..6
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..6
0: JSON_STRING_VALUE@1..6
0: JSON_STRING_LITERAL@1..6 "\"asd]" [] []
0: JSON_BOGUS_VALUE@1..6
0: ERROR_TOKEN@1..6 "\"asd]" [] []
2: (empty)
2: EOF@6..6 "" [] []
@ -71,5 +72,3 @@ structure_array_with_unclosed_string.json:1:7 parse ━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -18,8 +17,10 @@ JsonRoot {
value: JsonArrayValue {
l_brack_token: L_BRACK@0..1 "[" [] [],
elements: JsonArrayElementList [
JsonStringValue {
value_token: JSON_STRING_LITERAL@1..3 "\"a" [] [],
JsonBogusValue {
items: [
ERROR_TOKEN@1..3 "\"a" [] [],
],
},
],
r_brack_token: missing (required),
@ -36,8 +37,8 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..3
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..3
0: JSON_STRING_VALUE@1..3
0: JSON_STRING_LITERAL@1..3 "\"a" [] []
0: JSON_BOGUS_VALUE@1..3
0: ERROR_TOKEN@1..3 "\"a" [] []
2: (empty)
2: EOF@3..3 "" [] []
@ -71,5 +72,3 @@ structure_open_array_open_string.json:1:4 parse ━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -15,18 +14,19 @@ expression: snapshot
```
JsonRoot {
bom_token: missing (optional),
value: JsonObjectValue {
l_curly_token: L_CURLY@0..1 "{" [] [],
json_member_list: JsonMemberList [
JsonMember {
name: JsonMemberName {
value_token: JSON_STRING_LITERAL@1..3 "\"a" [] [],
},
colon_token: missing (required),
value: missing (required),
value: JsonBogusValue {
items: [
L_CURLY@0..1 "{" [] [],
JsonBogus {
items: [
JsonBogusValue {
items: [
ERROR_TOKEN@1..3 "\"a" [] [],
],
},
],
},
],
r_curly_token: missing (required),
},
eof_token: EOF@3..3 "" [] [],
}
@ -37,15 +37,11 @@ JsonRoot {
```
0: JSON_ROOT@0..3
0: (empty)
1: JSON_OBJECT_VALUE@0..3
1: JSON_BOGUS_VALUE@0..3
0: L_CURLY@0..1 "{" [] []
1: JSON_MEMBER_LIST@1..3
0: JSON_MEMBER@1..3
0: JSON_MEMBER_NAME@1..3
0: JSON_STRING_LITERAL@1..3 "\"a" [] []
1: (empty)
2: (empty)
2: (empty)
1: JSON_BOGUS@1..3
0: JSON_BOGUS_VALUE@1..3
0: ERROR_TOKEN@1..3 "\"a" [] []
2: EOF@3..3 "" [] []
```
@ -67,7 +63,7 @@ structure_open_object_open_string.json:1:2 parse ━━━━━━━━━━
structure_open_object_open_string.json:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `:` but instead the file ends
× expected `}` but instead the file ends
> 1 │ {"a
@ -78,5 +74,3 @@ structure_open_object_open_string.json:1:4 parse ━━━━━━━━━━
```

View file

@ -0,0 +1,121 @@
---
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
{
"key": 0,
"a
}
```
## AST
```
JsonRoot {
bom_token: missing (optional),
value: JsonArrayValue {
l_brack_token: missing (required),
elements: JsonArrayElementList [
JsonObjectValue {
l_curly_token: L_CURLY@0..1 "{" [] [],
json_member_list: JsonMemberList [
JsonMember {
name: JsonMemberName {
value_token: JSON_STRING_LITERAL@1..11 "\"key\"" [Newline("\n"), Whitespace(" ")] [],
},
colon_token: COLON@11..13 ":" [] [Whitespace(" ")],
value: JsonNumberValue {
value_token: JSON_NUMBER_LITERAL@13..14 "0" [] [],
},
},
COMMA@14..15 "," [] [],
],
r_curly_token: missing (required),
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@15..22 "\"a" [Newline("\n"), Whitespace(" ")] [],
],
},
missing separator,
JsonBogusValue {
items: [
R_CURLY@22..24 "}" [Newline("\n")] [],
],
},
],
r_brack_token: missing (required),
},
eof_token: EOF@24..24 "" [] [],
}
```
## CST
```
0: JSON_ROOT@0..24
0: (empty)
1: JSON_ARRAY_VALUE@0..24
0: (empty)
1: JSON_ARRAY_ELEMENT_LIST@0..24
0: JSON_OBJECT_VALUE@0..15
0: L_CURLY@0..1 "{" [] []
1: JSON_MEMBER_LIST@1..15
0: JSON_MEMBER@1..14
0: JSON_MEMBER_NAME@1..11
0: JSON_STRING_LITERAL@1..11 "\"key\"" [Newline("\n"), Whitespace(" ")] []
1: COLON@11..13 ":" [] [Whitespace(" ")]
2: JSON_NUMBER_VALUE@13..14
0: JSON_NUMBER_LITERAL@13..14 "0" [] []
1: COMMA@14..15 "," [] []
2: (empty)
1: (empty)
2: JSON_BOGUS_VALUE@15..22
0: ERROR_TOKEN@15..22 "\"a" [Newline("\n"), Whitespace(" ")] []
3: (empty)
4: JSON_BOGUS_VALUE@22..24
0: R_CURLY@22..24 "}" [Newline("\n")] []
2: (empty)
2: EOF@24..24 "" [] []
```
## Diagnostics
```
structure_open_object_with_key_open_string.json:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Missing closing quote
1 │ {
2 │ "key": 0,
> 3 │ "a
│ ^^
4 │ }
i line breaks here
1 │ {
2 │ "key": 0,
> 3 │ "a
> 4 │ }
structure_open_object_with_key_open_string.json:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× End of file expected
2 │ "key": 0,
3 │ "a
> 4 │ }
│ ^
i Use an array for a sequence of values: `[1, 2]`
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..6 "\"\\{[\"" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@6..7 "\\" [] [],
],
},
@ -37,6 +41,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@9..14 "\"\\{[\"" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
ERROR_TOKEN@14..15 "\\" [] [],
],
},
@ -68,11 +77,13 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..16
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..16
0: JSON_BOGUS_VALUE@1..7
0: JSON_BOGUS_VALUE@1..6
0: ERROR_TOKEN@1..6 "\"\\{[\"" [] []
1: ERROR_TOKEN@6..7 "\\" [] []
1: (empty)
2: JSON_OBJECT_VALUE@7..16
2: JSON_BOGUS_VALUE@6..7
0: ERROR_TOKEN@6..7 "\\" [] []
3: (empty)
4: JSON_OBJECT_VALUE@7..16
0: L_CURLY@7..8 "{" [] []
1: JSON_MEMBER_LIST@8..16
0: JSON_MEMBER@8..16
@ -81,11 +92,13 @@ JsonRoot {
2: JSON_ARRAY_VALUE@8..16
0: L_BRACK@8..9 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@9..16
0: JSON_BOGUS_VALUE@9..15
0: JSON_BOGUS_VALUE@9..14
0: ERROR_TOKEN@9..14 "\"\\{[\"" [] []
1: ERROR_TOKEN@14..15 "\\" [] []
1: (empty)
2: JSON_OBJECT_VALUE@15..16
2: JSON_BOGUS_VALUE@14..15
0: ERROR_TOKEN@14..15 "\\" [] []
3: (empty)
4: JSON_OBJECT_VALUE@15..16
0: L_CURLY@15..16 "{" [] []
1: JSON_MEMBER_LIST@16..16
2: (empty)
@ -99,18 +112,6 @@ JsonRoot {
## Diagnostics
```
structure_open_open.json:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\{["\'.
> 1 │ ["\{["\{["\{["\{
│ ^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\{["\{["\{["\{
│ ^^^^^^
structure_open_open.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -148,18 +149,6 @@ structure_open_open.json:1:9 parse ━━━━━━━━━━━━━━━
> 1 │ ["\{["\{["\{["\{
│ ^
structure_open_open.json:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Expected an array, an object, or a literal but instead found '"\{["\'.
> 1 │ ["\{["\{["\{["\{
│ ^^^^^^
i Expected an array, an object, or a literal here.
> 1 │ ["\{["\{["\{["\{
│ ^^^^^^
structure_open_open.json:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Invalid escape sequence
@ -198,5 +187,3 @@ structure_open_open.json:1:17 parse ━━━━━━━━━━━━━━
```

View file

@ -2,7 +2,6 @@
source: crates/biome_json_parser/tests/spec_test.rs
expression: snapshot
---
## Input
```json
@ -21,6 +20,11 @@ JsonRoot {
JsonBogusValue {
items: [
ERROR_TOKEN@1..2 "\\" [] [],
],
},
missing separator,
JsonBogusValue {
items: [
IDENT@2..7 "u000A" [] [],
],
},
@ -43,11 +47,13 @@ JsonRoot {
1: JSON_ARRAY_VALUE@0..10
0: L_BRACK@0..1 "[" [] []
1: JSON_ARRAY_ELEMENT_LIST@1..9
0: JSON_BOGUS_VALUE@1..7
0: JSON_BOGUS_VALUE@1..2
0: ERROR_TOKEN@1..2 "\\" [] []
1: IDENT@2..7 "u000A" [] []
1: (empty)
2: JSON_STRING_VALUE@7..9
2: JSON_BOGUS_VALUE@2..7
0: IDENT@2..7 "u000A" [] []
3: (empty)
4: JSON_STRING_VALUE@7..9
0: JSON_STRING_LITERAL@7..9 "\"\"" [] []
2: R_BRACK@9..10 "]" [] []
2: EOF@10..10 "" [] []
@ -64,6 +70,15 @@ structure_uescaped_LF_before_string.json:1:2 parse ━━━━━━━━━
> 1 │ [\u000A""]
│ ^
structure_uescaped_LF_before_string.json:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `u000A`
> 1 │ [\u000A""]
│ ^^^^^
i Remove u000A
structure_uescaped_LF_before_string.json:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× expected `,` but instead found `""`
@ -74,5 +89,3 @@ structure_uescaped_LF_before_string.json:1:8 parse ━━━━━━━━━
i Remove ""
```

View file

@ -75,7 +75,6 @@ pub fn run(test_case: &str, _snapshot_name: &str, test_directory: &str, outcome_
.clone()
.with_file_path(file_name)
.with_file_source_code(&content);
formatter
.write_markup(markup! {
{PrintDiagnostic::verbose(&error)}

View file

@ -44,6 +44,7 @@ pub enum JsonSyntaxKind {
JSON_MEMBER_NAME,
JSON_ARRAY_ELEMENT_LIST,
JSON_BOGUS,
JSON_BOGUS_MEMBER_NAME,
JSON_BOGUS_VALUE,
#[doc(hidden)]
__LAST,

View file

@ -45,7 +45,14 @@ JsonRoot =
value: AnyJsonValue
eof: 'EOF'
AnyJsonValue = JsonStringValue | JsonBooleanValue | JsonNullValue | JsonNumberValue | JsonArrayValue | JsonObjectValue | JsonBogusValue
AnyJsonValue =
JsonStringValue
| JsonBooleanValue
| JsonNullValue
| JsonNumberValue
| JsonArrayValue
| JsonObjectValue
| JsonBogusValue
JsonObjectValue = '{' JsonMemberList '}'

View file

@ -36,6 +36,7 @@ pub const JSON_KINDS_SRC: KindsSrc = KindsSrc {
"JSON_ARRAY_ELEMENT_LIST",
// Bogus nodes
"JSON_BOGUS",
"JSON_BOGUS_MEMBER_NAME",
"JSON_BOGUS_VALUE",
],
};