swc/crates/swc_ecma_parser/tests/tsc/useRegexpGroups.json

772 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 38,
"end": 373,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 38,
"end": 95,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 42,
"end": 94,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 42,
"end": 44,
"ctxt": 0
},
"value": "re",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "RegExpLiteral",
"span": {
"start": 47,
"end": 94,
"ctxt": 0
},
"pattern": "(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})",
"flags": "u"
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 96,
"end": 131,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 100,
"end": 130,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"value": "result",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 109,
"end": 130,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 109,
"end": 116,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"value": "re",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 112,
"end": 116,
"ctxt": 0
},
"value": "exec",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 117,
"end": 129,
"ctxt": 0
},
"value": "2015-01-02",
"raw": "\"2015-01-02\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 133,
"end": 154,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 137,
"end": 153,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"value": "date",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 144,
"end": 153,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 150,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 156,
"end": 187,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 160,
"end": 186,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 160,
"end": 165,
"ctxt": 0
},
"value": "year1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 168,
"end": 186,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 168,
"end": 181,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 168,
"end": 174,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 175,
"end": 181,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 182,
"end": 186,
"ctxt": 0
},
"value": "year",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 188,
"end": 210,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 192,
"end": 209,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 197,
"ctxt": 0
},
"value": "year2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 200,
"end": 209,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 200,
"end": 206,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 206,
"end": 209,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 212,
"end": 245,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 216,
"end": 244,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"value": "month1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 225,
"end": 244,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 225,
"end": 238,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 225,
"end": 231,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 232,
"end": 238,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 239,
"end": 244,
"ctxt": 0
},
"value": "month",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 246,
"end": 269,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 250,
"end": 268,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 250,
"end": 256,
"ctxt": 0
},
"value": "month2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 259,
"end": 268,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 259,
"end": 265,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 265,
"end": 268,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 266,
"end": 267,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 271,
"end": 300,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 275,
"end": 299,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 275,
"end": 279,
"ctxt": 0
},
"value": "day1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 282,
"end": 299,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 282,
"end": 295,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 282,
"end": 288,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 289,
"end": 295,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 296,
"end": 299,
"ctxt": 0
},
"value": "day",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 301,
"end": 322,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 305,
"end": 321,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 309,
"ctxt": 0
},
"value": "day2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 312,
"end": 321,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 312,
"end": 318,
"ctxt": 0
},
"value": "result",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 318,
"end": 321,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 319,
"end": 320,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 324,
"end": 373,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 328,
"end": 372,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 328,
"end": 331,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 334,
"end": 372,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 334,
"end": 368,
"ctxt": 0
},
"object": {
"type": "TsNonNullExpression",
"span": {
"start": 334,
"end": 361,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 334,
"end": 360,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 334,
"end": 345,
"ctxt": 0
},
"object": {
"type": "StringLiteral",
"span": {
"start": 334,
"end": 339,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
},
"property": {
"type": "Identifier",
"span": {
"start": 340,
"end": 345,
"ctxt": 0
},
"value": "match",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "RegExpLiteral",
"span": {
"start": 346,
"end": 359,
"ctxt": 0
},
"pattern": "(?<bar>foo)",
"flags": ""
}
}
],
"typeArguments": null
}
},
"property": {
"type": "Identifier",
"span": {
"start": 362,
"end": 368,
"ctxt": 0
},
"value": "groups",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 369,
"end": 372,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}