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

916 lines
23 KiB
Plaintext
Raw Normal View History

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing array_range_expr.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "r1",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 0,
"endElement": {
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"endInclusive": true,
"start": 0,
"startElement": {
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r1",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "four",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "r2",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 0,
"endElement": {
"end": 0,
"name": "four",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"endInclusive": true,
"start": 0,
"startElement": {
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r2",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "five",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 0,
"left": {
"end": 0,
"name": "four",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 0,
"name": "int",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "r3",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 0,
"endElement": {
"end": 0,
"name": "five",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"endInclusive": true,
"start": 0,
"startElement": {
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r3",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"second-to-last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is included"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r3",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 0,
"id": {
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 0,
"endElement": {
"arguments": [
{
"end": 0,
"left": {
"end": 0,
"name": "five",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 0,
"name": "int",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"endInclusive": true,
"start": 0,
"startElement": {
"arguments": [
{
"end": 0,
"left": {
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 0,
"name": "int",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"first element is 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "first element is 1"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"second-to-last element is 3\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is 3"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 0,
"expression": {
"arguments": [
{
"computed": false,
"end": 0,
"object": {
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 0,
"raw": "\"last element is 4\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is 4"
}
],
"callee": {
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"9": [
{
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}