| 1 |
---input--- |
| 2 |
// An empty object |
| 3 |
{} |
| 4 |
|
| 5 |
// An object with two properties |
| 6 |
// and a trailing comma |
| 7 |
{ |
| 8 |
width: 1920, |
| 9 |
height: 1080, |
| 10 |
} |
| 11 |
|
| 12 |
// Objects can be nested |
| 13 |
{ |
| 14 |
image: { |
| 15 |
width: 1920, |
| 16 |
height: 1080, |
| 17 |
'aspect-ratio': '16:9', |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
// An array of objects |
| 22 |
[ |
| 23 |
{ name: 'Joe', age: 27 }, |
| 24 |
{ name: 'Jane', age: 32 }, |
| 25 |
] |
| 26 |
|
| 27 |
---tokens--- |
| 28 |
'// An empty object\n' Comment.Single |
| 29 |
|
| 30 |
'{' Punctuation |
| 31 |
'}' Punctuation |
| 32 |
'\n\n' Text.Whitespace |
| 33 |
|
| 34 |
'// An object with two properties\n' Comment.Single |
| 35 |
|
| 36 |
'// and a trailing comma\n' Comment.Single |
| 37 |
|
| 38 |
'{' Punctuation |
| 39 |
'\n ' Text.Whitespace |
| 40 |
'width' Name.Variable |
| 41 |
':' Punctuation |
| 42 |
' ' Text.Whitespace |
| 43 |
'1920' Literal.Number.Float |
| 44 |
',' Punctuation |
| 45 |
'\n ' Text.Whitespace |
| 46 |
'height' Name.Variable |
| 47 |
':' Punctuation |
| 48 |
' ' Text.Whitespace |
| 49 |
'1080' Literal.Number.Float |
| 50 |
',' Punctuation |
| 51 |
'\n' Text.Whitespace |
| 52 |
|
| 53 |
'}' Punctuation |
| 54 |
'\n\n' Text.Whitespace |
| 55 |
|
| 56 |
'// Objects can be nested\n' Comment.Single |
| 57 |
|
| 58 |
'{' Punctuation |
| 59 |
'\n ' Text.Whitespace |
| 60 |
'image' Name.Variable |
| 61 |
':' Punctuation |
| 62 |
' ' Text.Whitespace |
| 63 |
'{' Punctuation |
| 64 |
'\n ' Text.Whitespace |
| 65 |
'width' Name.Variable |
| 66 |
':' Punctuation |
| 67 |
' ' Text.Whitespace |
| 68 |
'1920' Literal.Number.Float |
| 69 |
',' Punctuation |
| 70 |
'\n ' Text.Whitespace |
| 71 |
'height' Name.Variable |
| 72 |
':' Punctuation |
| 73 |
' ' Text.Whitespace |
| 74 |
'1080' Literal.Number.Float |
| 75 |
',' Punctuation |
| 76 |
'\n ' Text.Whitespace |
| 77 |
"'" Name.Variable |
| 78 |
"aspect-ratio'" Name.Variable |
| 79 |
':' Punctuation |
| 80 |
' ' Text.Whitespace |
| 81 |
"'" Literal.String |
| 82 |
'16:9' Literal.String |
| 83 |
"'" Literal.String |
| 84 |
',' Punctuation |
| 85 |
'\n ' Text.Whitespace |
| 86 |
'}' Punctuation |
| 87 |
'\n' Text.Whitespace |
| 88 |
|
| 89 |
'}' Punctuation |
| 90 |
'\n\n' Text.Whitespace |
| 91 |
|
| 92 |
'// An array of objects\n' Comment.Single |
| 93 |
|
| 94 |
'[' Punctuation |
| 95 |
'\n ' Text.Whitespace |
| 96 |
'{' Punctuation |
| 97 |
' ' Text.Whitespace |
| 98 |
'name' Name.Variable |
| 99 |
':' Punctuation |
| 100 |
' ' Text.Whitespace |
| 101 |
"'" Literal.String |
| 102 |
'Joe' Literal.String |
| 103 |
"'" Literal.String |
| 104 |
',' Punctuation |
| 105 |
' ' Text.Whitespace |
| 106 |
'age' Name.Variable |
| 107 |
':' Punctuation |
| 108 |
' ' Text.Whitespace |
| 109 |
'27' Literal.Number.Float |
| 110 |
' ' Text.Whitespace |
| 111 |
'}' Punctuation |
| 112 |
',' Punctuation |
| 113 |
'\n ' Text.Whitespace |
| 114 |
'{' Punctuation |
| 115 |
' ' Text.Whitespace |
| 116 |
'name' Name.Variable |
| 117 |
':' Punctuation |
| 118 |
' ' Text.Whitespace |
| 119 |
"'" Literal.String |
| 120 |
'Jane' Literal.String |
| 121 |
"'" Literal.String |
| 122 |
',' Punctuation |
| 123 |
' ' Text.Whitespace |
| 124 |
'age' Name.Variable |
| 125 |
':' Punctuation |
| 126 |
' ' Text.Whitespace |
| 127 |
'32' Literal.Number.Float |
| 128 |
' ' Text.Whitespace |
| 129 |
'}' Punctuation |
| 130 |
',' Punctuation |
| 131 |
'\n' Text.Whitespace |
| 132 |
|
| 133 |
']' Punctuation |
| 134 |
'\n' Text.Whitespace |