swc/crates/swc_ecma_parser/tests/tsc/useRegexpGroups.json
2022-03-22 07:54:08 +00:00

768 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 37,
"end": 372,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 37,
"end": 94,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 41,
"end": 93,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 41,
"end": 43,
"ctxt": 0
},
"value": "re",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "RegExpLiteral",
"span": {
"start": 46,
"end": 93,
"ctxt": 0
},
"pattern": "(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})",
"flags": "u"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 95,
"end": 130,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 99,
"end": 129,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 108,
"end": 129,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 108,
"end": 115,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 108,
"end": 110,
"ctxt": 0
},
"value": "re",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 111,
"end": 115,
"ctxt": 0
},
"value": "exec",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 116,
"end": 128,
"ctxt": 0
},
"value": "2015-01-02",
"raw": "\"2015-01-02\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 132,
"end": 153,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 136,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 136,
"end": 140,
"ctxt": 0
},
"value": "date",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 143,
"end": 152,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 149,
"end": 152,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 150,
"end": 151,
"ctxt": 0
},
"value": 0.0
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 155,
"end": 186,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 159,
"end": 185,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 164,
"ctxt": 0
},
"value": "year1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 167,
"end": 185,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 167,
"end": 180,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 167,
"end": 173,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 181,
"end": 185,
"ctxt": 0
},
"value": "year",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 187,
"end": 209,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 191,
"end": 208,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 191,
"end": 196,
"ctxt": 0
},
"value": "year2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 199,
"end": 208,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 199,
"end": 205,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 205,
"end": 208,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"value": 1.0
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 211,
"end": 244,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 215,
"end": 243,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 215,
"end": 221,
"ctxt": 0
},
"value": "month1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 224,
"end": 243,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 224,
"end": 237,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 224,
"end": 230,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 231,
"end": 237,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 238,
"end": 243,
"ctxt": 0
},
"value": "month",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 245,
"end": 268,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 249,
"end": 267,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 249,
"end": 255,
"ctxt": 0
},
"value": "month2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 258,
"end": 267,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 258,
"end": 264,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 264,
"end": 267,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 265,
"end": 266,
"ctxt": 0
},
"value": 2.0
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 270,
"end": 299,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 274,
"end": 298,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 274,
"end": 278,
"ctxt": 0
},
"value": "day1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 281,
"end": 298,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 281,
"end": 294,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 281,
"end": 287,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 288,
"end": 294,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 295,
"end": 298,
"ctxt": 0
},
"value": "day",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 300,
"end": 321,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 304,
"end": 320,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 304,
"end": 308,
"ctxt": 0
},
"value": "day2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 311,
"end": 320,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 311,
"end": 317,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 317,
"end": 320,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": 3.0
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 323,
"end": 372,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 327,
"end": 371,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 327,
"end": 330,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 333,
"end": 371,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 333,
"end": 367,
"ctxt": 0
},
"object": {
"type": "TsNonNullExpression",
"span": {
"start": 333,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 333,
"end": 359,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 333,
"end": 344,
"ctxt": 0
},
"object": {
"type": "StringLiteral",
"span": {
"start": 333,
"end": 338,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"property": {
"type": "Identifier",
"span": {
"start": 339,
"end": 344,
"ctxt": 0
},
"value": "match",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "RegExpLiteral",
"span": {
"start": 345,
"end": 358,
"ctxt": 0
},
"pattern": "(?<bar>foo)",
"flags": ""
}
}
],
"typeArguments": null
}
},
"property": {
"type": "Identifier",
"span": {
"start": 361,
"end": 367,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 368,
"end": 371,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}