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

740 lines
19 KiB
Plaintext
Raw Normal View History

---
source: kcl/src/simulation_tests.rs
description: Result of parsing boolean_logical_or.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": 124,
"expression": {
"arguments": [
{
"end": 62,
"left": {
"end": 57,
"name": "a",
"start": 56,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 62,
"raw": "1",
"start": 61,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 56,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 123,
"raw": "\"left branch of or is true makes the whole expression true\"",
"start": 64,
"type": "Literal",
"type": "Literal",
"value": "left branch of or is true makes the whole expression true"
}
],
"callee": {
"end": 55,
"name": "assert",
"start": 49,
"type": "Identifier"
},
"end": 124,
"start": 49,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 49,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 143,
"id": {
"end": 128,
"name": "bb",
"start": 126,
"type": "Identifier"
},
"init": {
"end": 143,
"left": {
"end": 136,
"raw": "false",
"start": 131,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "|",
"right": {
"end": 143,
"raw": "true",
"start": 139,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 131,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 126,
"type": "VariableDeclarator"
},
"end": 143,
"kind": "const",
"start": 126,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 174,
"id": {
"end": 145,
"name": "b",
"start": 144,
"type": "Identifier"
},
"init": {
"cond": {
"end": 153,
"name": "bb",
"start": 151,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 174,
"final_else": {
"body": [
{
"end": 172,
"expression": {
"end": 172,
"raw": "2",
"start": 171,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 171,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 173,
"start": 171
},
"start": 148,
"then_val": {
"body": [
{
"end": 159,
"expression": {
"end": 159,
"raw": "1",
"start": 158,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 158,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 160,
"start": 158
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 144,
"type": "VariableDeclarator"
},
"end": 174,
"kind": "const",
"start": 144,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 251,
"expression": {
"arguments": [
{
"end": 188,
"left": {
"end": 183,
"name": "b",
"start": 182,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 188,
"raw": "1",
"start": 187,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 182,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 250,
"raw": "\"right branch of or is true makes the whole expression true\"",
"start": 190,
"type": "Literal",
"type": "Literal",
"value": "right branch of or is true makes the whole expression true"
}
],
"callee": {
"end": 181,
"name": "assert",
"start": 175,
"type": "Identifier"
},
"end": 251,
"start": 175,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 175,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 269,
"id": {
"end": 255,
"name": "cc",
"start": 253,
"type": "Identifier"
},
"init": {
"end": 269,
"left": {
"end": 262,
"raw": "true",
"start": 258,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "|",
"right": {
"end": 269,
"raw": "true",
"start": 265,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 258,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 253,
"type": "VariableDeclarator"
},
"end": 269,
"kind": "const",
"start": 253,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 300,
"id": {
"end": 271,
"name": "c",
"start": 270,
"type": "Identifier"
},
"init": {
"cond": {
"end": 279,
"name": "cc",
"start": 277,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 300,
"final_else": {
"body": [
{
"end": 298,
"expression": {
"end": 298,
"raw": "2",
"start": 297,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 297,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 299,
"start": 297
},
"start": 274,
"then_val": {
"body": [
{
"end": 285,
"expression": {
"end": 285,
"raw": "1",
"start": 284,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 284,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 286,
"start": 284
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 270,
"type": "VariableDeclarator"
},
"end": 300,
"kind": "const",
"start": 270,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 379,
"expression": {
"arguments": [
{
"end": 314,
"left": {
"end": 309,
"name": "c",
"start": 308,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 314,
"raw": "1",
"start": 313,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 308,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 378,
"raw": "\"both branches of or are true makes the whole expression true\"",
"start": 316,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are true makes the whole expression true"
}
],
"callee": {
"end": 307,
"name": "assert",
"start": 301,
"type": "Identifier"
},
"end": 379,
"start": 301,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 301,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 399,
"id": {
"end": 383,
"name": "dd",
"start": 381,
"type": "Identifier"
},
"init": {
"end": 399,
"left": {
"end": 391,
"raw": "false",
"start": 386,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "|",
"right": {
"end": 399,
"raw": "false",
"start": 394,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 386,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 381,
"type": "VariableDeclarator"
},
"end": 399,
"kind": "const",
"start": 381,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 430,
"id": {
"end": 401,
"name": "d",
"start": 400,
"type": "Identifier"
},
"init": {
"cond": {
"end": 409,
"name": "dd",
"start": 407,
"type": "Identifier",
"type": "Identifier"
},
"digest": null,
"else_ifs": [],
"end": 430,
"final_else": {
"body": [
{
"end": 428,
"expression": {
"end": 428,
"raw": "2",
"start": 427,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 427,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 429,
"start": 427
},
"start": 404,
"then_val": {
"body": [
{
"end": 415,
"expression": {
"end": 415,
"raw": "1",
"start": 414,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 414,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 416,
"start": 414
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 400,
"type": "VariableDeclarator"
},
"end": 430,
"kind": "const",
"start": 400,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 511,
"expression": {
"arguments": [
{
"end": 444,
"left": {
"end": 439,
"name": "d",
"start": 438,
"type": "Identifier",
"type": "Identifier"
},
"operator": "==",
"right": {
"end": 444,
"raw": "2",
"start": 443,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 438,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 510,
"raw": "\"both branches of or are false makes the whole expression false\"",
"start": 446,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are false makes the whole expression false"
}
],
"callee": {
"end": 437,
"name": "assert",
"start": 431,
"type": "Identifier"
},
"end": 511,
"start": 431,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 431,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 512,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 126,
"start": 124,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 253,
"start": 251,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"8": [
{
"end": 381,
"start": 379,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}