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

740 lines
19 KiB
Plaintext
Raw Normal View History

---
source: kcl/src/simulation_tests.rs
description: Result of parsing boolean_logical_and.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 17,
"id": {
"end": 2,
"name": "aa",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 17,
"left": {
"end": 9,
"raw": "true",
"start": 5,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "&",
"right": {
"end": 17,
"raw": "false",
"start": 12,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 5,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 17,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 48,
"id": {
"end": 19,
"name": "a",
"start": 18,
"type": "Identifier"
},
"init": {
"cond": {
"end": 27,
"name": "aa",
"start": 25,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 48,
"final_else": {
"body": [
{
"end": 46,
"expression": {
"end": 46,
"raw": "2",
"start": 45,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 45,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 47,
"start": 45
},
"start": 22,
"then_val": {
"body": [
{
"end": 33,
"expression": {
"end": 33,
"raw": "1",
"start": 32,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 32,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 34,
"start": 32
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 18,
"type": "VariableDeclarator"
},
"end": 48,
"kind": "const",
"start": 18,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 128,
"expression": {
"arguments": [
{
"end": 62,
"left": {
"end": 57,
"name": "a",
"start": 56,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 62,
"raw": "2",
"start": 61,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 56,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 127,
"raw": "\"right branch of and is false makes the whole expression false\"",
"start": 64,
"type": "Literal",
"type": "Literal",
"value": "right branch of and is false makes the whole expression false"
}
],
"callee": {
"end": 55,
"name": "assert",
"start": 49,
"type": "Identifier"
},
"end": 128,
"start": 49,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 49,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 147,
"id": {
"end": 132,
"name": "bb",
"start": 130,
"type": "Identifier"
},
"init": {
"end": 147,
"left": {
"end": 140,
"raw": "false",
"start": 135,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "&",
"right": {
"end": 147,
"raw": "true",
"start": 143,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 135,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 130,
"type": "VariableDeclarator"
},
"end": 147,
"kind": "const",
"start": 130,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 178,
"id": {
"end": 149,
"name": "b",
"start": 148,
"type": "Identifier"
},
"init": {
"cond": {
"end": 157,
"name": "bb",
"start": 155,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 178,
"final_else": {
"body": [
{
"end": 176,
"expression": {
"end": 176,
"raw": "2",
"start": 175,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 175,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 177,
"start": 175
},
"start": 152,
"then_val": {
"body": [
{
"end": 163,
"expression": {
"end": 163,
"raw": "1",
"start": 162,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 162,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 164,
"start": 162
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 148,
"type": "VariableDeclarator"
},
"end": 178,
"kind": "const",
"start": 148,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 257,
"expression": {
"arguments": [
{
"end": 192,
"left": {
"end": 187,
"name": "b",
"start": 186,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 192,
"raw": "2",
"start": 191,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 186,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 256,
"raw": "\"left branch of and is false makes the whole expression false\"",
"start": 194,
"type": "Literal",
"type": "Literal",
"value": "left branch of and is false makes the whole expression false"
}
],
"callee": {
"end": 185,
"name": "assert",
"start": 179,
"type": "Identifier"
},
"end": 257,
"start": 179,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 179,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 275,
"id": {
"end": 261,
"name": "cc",
"start": 259,
"type": "Identifier"
},
"init": {
"end": 275,
"left": {
"end": 268,
"raw": "true",
"start": 264,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "&",
"right": {
"end": 275,
"raw": "true",
"start": 271,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 264,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 259,
"type": "VariableDeclarator"
},
"end": 275,
"kind": "const",
"start": 259,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 306,
"id": {
"end": 277,
"name": "c",
"start": 276,
"type": "Identifier"
},
"init": {
"cond": {
"end": 285,
"name": "cc",
"start": 283,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 306,
"final_else": {
"body": [
{
"end": 304,
"expression": {
"end": 304,
"raw": "2",
"start": 303,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 303,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 305,
"start": 303
},
"start": 280,
"then_val": {
"body": [
{
"end": 291,
"expression": {
"end": 291,
"raw": "1",
"start": 290,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 290,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 292,
"start": 290
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 276,
"type": "VariableDeclarator"
},
"end": 306,
"kind": "const",
"start": 276,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 386,
"expression": {
"arguments": [
{
"end": 320,
"left": {
"end": 315,
"name": "c",
"start": 314,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 320,
"raw": "1",
"start": 319,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 314,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 385,
"raw": "\"both branches of and are true makes the whole expression true\"",
"start": 322,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are true makes the whole expression true"
}
],
"callee": {
"end": 313,
"name": "assert",
"start": 307,
"type": "Identifier"
},
"end": 386,
"start": 307,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 307,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 406,
"id": {
"end": 390,
"name": "dd",
"start": 388,
"type": "Identifier"
},
"init": {
"end": 406,
"left": {
"end": 398,
"raw": "false",
"start": 393,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "&",
"right": {
"end": 406,
"raw": "false",
"start": 401,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 393,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 388,
"type": "VariableDeclarator"
},
"end": 406,
"kind": "const",
"start": 388,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 437,
"id": {
"end": 408,
"name": "d",
"start": 407,
"type": "Identifier"
},
"init": {
"cond": {
"end": 416,
"name": "dd",
"start": 414,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 437,
"final_else": {
"body": [
{
"end": 435,
"expression": {
"end": 435,
"raw": "2",
"start": 434,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 434,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 436,
"start": 434
},
"start": 411,
"then_val": {
"body": [
{
"end": 422,
"expression": {
"end": 422,
"raw": "1",
"start": 421,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 421,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 423,
"start": 421
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 407,
"type": "VariableDeclarator"
},
"end": 437,
"kind": "const",
"start": 407,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 519,
"expression": {
"arguments": [
{
"end": 451,
"left": {
"end": 446,
"name": "d",
"start": 445,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 451,
"raw": "2",
"start": 450,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 445,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 518,
"raw": "\"both branches of and are false makes the whole expression false\"",
"start": 453,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are false makes the whole expression false"
}
],
"callee": {
"end": 444,
"name": "assert",
"start": 438,
"type": "Identifier"
},
"end": 519,
"start": 438,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 438,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 520,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 130,
"start": 128,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 259,
"start": 257,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"8": [
{
"end": 388,
"start": 386,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}