* [parser] Track trailing commas in extras instead of state * Update existing tests * Update test262 whitelist * Improve error message and location * nit * Use lookaheadCharCode
408 lines
10 KiB
JSON
408 lines
10 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 96,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 15
|
|
}
|
|
},
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 96,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 15
|
|
}
|
|
},
|
|
"sourceType": "script",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start": 0,
|
|
"end": 83,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 2
|
|
}
|
|
},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start": 4,
|
|
"end": 82,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 4
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 1
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 4,
|
|
"end": 7,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 4
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 7
|
|
},
|
|
"identifierName": "obj"
|
|
},
|
|
"name": "obj"
|
|
},
|
|
"init": {
|
|
"type": "ObjectExpression",
|
|
"start": 10,
|
|
"end": 82,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 1
|
|
}
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 14,
|
|
"end": 20,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 8
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 14,
|
|
"end": 15,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 3
|
|
},
|
|
"identifierName": "a"
|
|
},
|
|
"name": "a"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "StringLiteral",
|
|
"start": 17,
|
|
"end": 20,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 5
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 8
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": "1",
|
|
"raw": "'1'"
|
|
},
|
|
"value": "1"
|
|
}
|
|
},
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 37,
|
|
"end": 43,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 8
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 37,
|
|
"end": 38,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 3
|
|
},
|
|
"identifierName": "b"
|
|
},
|
|
"name": "b"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "StringLiteral",
|
|
"start": 40,
|
|
"end": 43,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 5
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 8
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": "2",
|
|
"raw": "'2'"
|
|
},
|
|
"value": "2"
|
|
},
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 1",
|
|
"start": 22,
|
|
"end": 34,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 22
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 60,
|
|
"end": 66,
|
|
"loc": {
|
|
"start": {
|
|
"line": 4,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 8
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 60,
|
|
"end": 61,
|
|
"loc": {
|
|
"start": {
|
|
"line": 4,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 3
|
|
},
|
|
"identifierName": "c"
|
|
},
|
|
"name": "c"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "StringLiteral",
|
|
"start": 63,
|
|
"end": 66,
|
|
"loc": {
|
|
"start": {
|
|
"line": 4,
|
|
"column": 5
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 8
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": "3",
|
|
"raw": "'3'"
|
|
},
|
|
"value": "3"
|
|
},
|
|
"leadingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 2",
|
|
"start": 45,
|
|
"end": 57,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 22
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"trailingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 3",
|
|
"start": 68,
|
|
"end": 80,
|
|
"loc": {
|
|
"start": {
|
|
"line": 4,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 22
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"extra": {
|
|
"trailingComma": 66
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"kind": "var",
|
|
"trailingComments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 4",
|
|
"start": 84,
|
|
"end": 96,
|
|
"loc": {
|
|
"start": {
|
|
"line": 5,
|
|
"column": 3
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 15
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"directives": []
|
|
},
|
|
"comments": [
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 1",
|
|
"start": 22,
|
|
"end": 34,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 22
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 2",
|
|
"start": 45,
|
|
"end": 57,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 22
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 3",
|
|
"start": 68,
|
|
"end": 80,
|
|
"loc": {
|
|
"start": {
|
|
"line": 4,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 22
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "CommentLine",
|
|
"value": " comment 4",
|
|
"start": 84,
|
|
"end": 96,
|
|
"loc": {
|
|
"start": {
|
|
"line": 5,
|
|
"column": 3
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 15
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |