Files
modeling-app/rust/kcl-lib/tests/array_range_expr/ast.snap

916 lines
24 KiB
Plaintext
Raw Normal View History

---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_range_expr.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 11,
"id": {
"end": 2,
"name": "r1",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 11,
"endElement": {
"end": 10,
"raw": "4",
"start": 9,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"endInclusive": true,
"start": 5,
"startElement": {
"end": 7,
"raw": "0",
"start": 6,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 11,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 70,
"expression": {
"arguments": [
{
"computed": false,
"end": 29,
"object": {
"end": 26,
"name": "r1",
"start": 24,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 28,
"raw": "4",
"start": 27,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 24,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 32,
"raw": "4",
"start": 31,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 41,
"raw": "0.00001",
"start": 34,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 69,
"raw": "\"last element is included\"",
"start": 43,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 23,
"name": "assertEqual",
"start": 12,
"type": "Identifier"
},
"end": 70,
"start": 12,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 12,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 80,
"id": {
"end": 76,
"name": "four",
"start": 72,
"type": "Identifier"
},
"init": {
"end": 80,
"raw": "4",
"start": 79,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 72,
"type": "VariableDeclarator"
},
"end": 80,
"kind": "const",
"start": 72,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 89,
"id": {
"end": 85,
"name": "zero",
"start": 81,
"type": "Identifier"
},
"init": {
"end": 89,
"raw": "0",
"start": 88,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 81,
"type": "VariableDeclarator"
},
"end": 89,
"kind": "const",
"start": 81,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 107,
"id": {
"end": 92,
"name": "r2",
"start": 90,
"type": "Identifier"
},
"init": {
"end": 107,
"endElement": {
"end": 106,
"name": "four",
"start": 102,
"type": "Identifier",
"type": "Identifier"
},
"endInclusive": true,
"start": 95,
"startElement": {
"end": 100,
"name": "zero",
"start": 96,
"type": "Identifier",
"type": "Identifier"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 90,
"type": "VariableDeclarator"
},
"end": 107,
"kind": "const",
"start": 90,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 166,
"expression": {
"arguments": [
{
"computed": false,
"end": 125,
"object": {
"end": 122,
"name": "r2",
"start": 120,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 124,
"raw": "4",
"start": 123,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 120,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 128,
"raw": "4",
"start": 127,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 137,
"raw": "0.00001",
"start": 130,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 165,
"raw": "\"last element is included\"",
"start": 139,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 119,
"name": "assertEqual",
"start": 108,
"type": "Identifier"
},
"end": 166,
"start": 108,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 108,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 188,
"id": {
"end": 172,
"name": "five",
"start": 168,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 187,
"left": {
"end": 183,
"name": "four",
"start": 179,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"end": 187,
"raw": "1",
"start": 186,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 179,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 178,
"name": "int",
"start": 175,
"type": "Identifier"
},
"end": 188,
"start": 175,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 168,
"type": "VariableDeclarator"
},
"end": 188,
"kind": "const",
"start": 168,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 206,
"id": {
"end": 191,
"name": "r3",
"start": 189,
"type": "Identifier"
},
"init": {
"end": 206,
"endElement": {
"end": 205,
"name": "five",
"start": 201,
"type": "Identifier",
"type": "Identifier"
},
"endInclusive": true,
"start": 194,
"startElement": {
"end": 199,
"name": "zero",
"start": 195,
"type": "Identifier",
"type": "Identifier"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 189,
"type": "VariableDeclarator"
},
"end": 206,
"kind": "const",
"start": 189,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 275,
"expression": {
"arguments": [
{
"computed": false,
"end": 224,
"object": {
"end": 221,
"name": "r3",
"start": 219,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 223,
"raw": "4",
"start": 222,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 219,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 227,
"raw": "4",
"start": 226,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 236,
"raw": "0.00001",
"start": 229,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 274,
"raw": "\"second-to-last element is included\"",
"start": 238,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is included"
}
],
"callee": {
"end": 218,
"name": "assertEqual",
"start": 207,
"type": "Identifier"
},
"end": 275,
"start": 207,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 207,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 334,
"expression": {
"arguments": [
{
"computed": false,
"end": 293,
"object": {
"end": 290,
"name": "r3",
"start": 288,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 292,
"raw": "5",
"start": 291,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"start": 288,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 296,
"raw": "5",
"start": 295,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
{
"end": 305,
"raw": "0.00001",
"start": 298,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 333,
"raw": "\"last element is included\"",
"start": 307,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 287,
"name": "assertEqual",
"start": 276,
"type": "Identifier"
},
"end": 334,
"start": 276,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 276,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 373,
"id": {
"end": 338,
"name": "r4",
"start": 336,
"type": "Identifier"
},
"init": {
"end": 373,
"endElement": {
"arguments": [
{
"end": 371,
"left": {
"end": 367,
"name": "five",
"start": 363,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 371,
"raw": "1",
"start": 370,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 363,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 362,
"name": "int",
"start": 359,
"type": "Identifier"
},
"end": 372,
"start": 359,
"type": "CallExpression",
"type": "CallExpression"
},
"endInclusive": true,
"start": 341,
"startElement": {
"arguments": [
{
"end": 354,
"left": {
"end": 350,
"name": "zero",
"start": 346,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"end": 354,
"raw": "1",
"start": 353,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 346,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 345,
"name": "int",
"start": 342,
"type": "Identifier"
},
"end": 355,
"start": 342,
"type": "CallExpression",
"type": "CallExpression"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 336,
"type": "VariableDeclarator"
},
"end": 373,
"kind": "const",
"start": 336,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 426,
"expression": {
"arguments": [
{
"computed": false,
"end": 391,
"object": {
"end": 388,
"name": "r4",
"start": 386,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 390,
"raw": "0",
"start": 389,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 386,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 394,
"raw": "1",
"start": 393,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 403,
"raw": "0.00001",
"start": 396,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 425,
"raw": "\"first element is 1\"",
"start": 405,
"type": "Literal",
"type": "Literal",
"value": "first element is 1"
}
],
"callee": {
"end": 385,
"name": "assertEqual",
"start": 374,
"type": "Identifier"
},
"end": 426,
"start": 374,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 374,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 488,
"expression": {
"arguments": [
{
"computed": false,
"end": 444,
"object": {
"end": 441,
"name": "r4",
"start": 439,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 443,
"raw": "2",
"start": 442,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 439,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 447,
"raw": "3",
"start": 446,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
{
"end": 456,
"raw": "0.00001",
"start": 449,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 487,
"raw": "\"second-to-last element is 3\"",
"start": 458,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is 3"
}
],
"callee": {
"end": 438,
"name": "assertEqual",
"start": 427,
"type": "Identifier"
},
"end": 488,
"start": 427,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 427,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 540,
"expression": {
"arguments": [
{
"computed": false,
"end": 506,
"object": {
"end": 503,
"name": "r4",
"start": 501,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 505,
"raw": "3",
"start": 504,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 501,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 509,
"raw": "4",
"start": 508,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 518,
"raw": "0.00001",
"start": 511,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 539,
"raw": "\"last element is 4\"",
"start": 520,
"type": "Literal",
"type": "Literal",
"value": "last element is 4"
}
],
"callee": {
"end": 500,
"name": "assertEqual",
"start": 489,
"type": "Identifier"
},
"end": 540,
"start": 489,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 489,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 541,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"end": 72,
"start": 70,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 168,
"start": 166,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"9": [
{
"end": 336,
"start": 334,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}