--- source: kcl-lib/src/simulation_tests.rs description: Result of parsing bad_units_in_annotation.kcl --- { "Ok": { "body": [ { "commentStart": 33, "declaration": { "commentStart": 123, "end": 0, "id": { "commentStart": 123, "end": 0, "name": "oxygenRadius", "start": 0, "type": "Identifier" }, "init": { "commentStart": 138, "end": 0, "raw": "0.066", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.066, "suffix": "None" } }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "preComments": [ "// Generated by Text-to-CAD: draw a water molecule", "", "", "// Constants for the water molecule" ], "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 143, "declaration": { "commentStart": 184, "end": 0, "id": { "commentStart": 184, "end": 0, "name": "hydrogenRadius", "start": 0, "type": "Identifier" }, "init": { "commentStart": 201, "end": 0, "raw": "0.053", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.053, "suffix": "None" } }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 206, "declaration": { "commentStart": 248, "end": 0, "id": { "commentStart": 248, "end": 0, "name": "oxygenHydrogenDistance", "start": 0, "type": "Identifier" }, "init": { "commentStart": 273, "end": 0, "raw": "0.096", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.096, "suffix": "None" } }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 278, "declaration": { "commentStart": 337, "end": 0, "id": { "commentStart": 337, "end": 0, "name": "bondAngle", "start": 0, "type": "Identifier" }, "init": { "commentStart": 349, "end": 0, "raw": "104.5", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 104.5, "suffix": "None" } }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 354, "declaration": { "commentStart": 437, "end": 0, "id": { "commentStart": 437, "end": 0, "name": "createAtom", "start": 0, "type": "Identifier" }, "init": { "body": { "body": [ { "argument": { "body": [ { "arguments": [ { "commentStart": 489, "end": 0, "raw": "'XY'", "start": 0, "type": "Literal", "type": "Literal", "value": "XY" } ], "callee": { "abs_path": false, "commentStart": 475, "end": 0, "name": { "commentStart": 475, "end": 0, "name": "startSketchOn", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 475, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, { "arguments": [ { "type": "LabeledArg", "label": { "commentStart": 509, "end": 0, "name": "center", "start": 0, "type": "Identifier" }, "arg": { "abs_path": false, "commentStart": 518, "end": 0, "name": { "commentStart": 518, "end": 0, "name": "center", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } }, { "type": "LabeledArg", "label": { "commentStart": 526, "end": 0, "name": "radius", "start": 0, "type": "Identifier" }, "arg": { "abs_path": false, "commentStart": 535, "end": 0, "name": { "commentStart": 535, "end": 0, "name": "radius", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } } ], "callee": { "abs_path": false, "commentStart": 502, "end": 0, "name": { "commentStart": 502, "end": 0, "name": "circle", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 502, "end": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": null }, { "arguments": [ { "type": "LabeledArg", "label": { "commentStart": 558, "end": 0, "name": "length", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 567, "end": 0, "left": { "abs_path": false, "commentStart": 567, "end": 0, "name": { "commentStart": 567, "end": 0, "name": "radius", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "operator": "*", "right": { "commentStart": 576, "end": 0, "raw": "2", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 2.0, "suffix": "None" } }, "start": 0, "type": "BinaryExpression", "type": "BinaryExpression" } } ], "callee": { "abs_path": false, "commentStart": 550, "end": 0, "name": { "commentStart": 550, "end": 0, "name": "extrude", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 550, "end": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": null } ], "commentStart": 475, "end": 0, "start": 0, "type": "PipeExpression", "type": "PipeExpression" }, "commentStart": 468, "end": 0, "start": 0, "type": "ReturnStatement", "type": "ReturnStatement" } ], "commentStart": 464, "end": 0, "start": 0 }, "commentStart": 447, "end": 0, "params": [ { "type": "Parameter", "identifier": { "commentStart": 448, "end": 0, "name": "center", "start": 0, "type": "Identifier" } }, { "type": "Parameter", "identifier": { "commentStart": 456, "end": 0, "name": "radius", "start": 0, "type": "Identifier" } } ], "start": 0, "type": "FunctionExpression", "type": "FunctionExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "fn", "preComments": [ "// Function to create a sphere representing an atom" ], "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 580, "declaration": { "commentStart": 622, "end": 0, "id": { "commentStart": 622, "end": 0, "name": "oxygenAtom", "start": 0, "type": "Identifier" }, "init": { "arguments": [ { "commentStart": 646, "elements": [ { "commentStart": 647, "end": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } }, { "commentStart": 650, "end": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } } ], "end": 0, "start": 0, "type": "ArrayExpression", "type": "ArrayExpression" }, { "abs_path": false, "commentStart": 654, "end": 0, "name": { "commentStart": 654, "end": 0, "name": "oxygenRadius", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } ], "callee": { "abs_path": false, "commentStart": 635, "end": 0, "name": { "commentStart": 635, "end": 0, "name": "createAtom", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 635, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "preComments": [ "", "", "// Create the oxygen atom at the origin" ], "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 667, "declaration": { "commentStart": 718, "end": 0, "id": { "commentStart": 718, "end": 0, "name": "hydrogenOffsetX", "start": 0, "type": "Identifier" }, "init": { "commentStart": 736, "end": 0, "left": { "abs_path": false, "commentStart": 736, "end": 0, "name": { "commentStart": 736, "end": 0, "name": "oxygenHydrogenDistance", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "operator": "*", "right": { "arguments": [ { "arguments": [ { "commentStart": 775, "end": 0, "left": { "abs_path": false, "commentStart": 775, "end": 0, "name": { "commentStart": 775, "end": 0, "name": "bondAngle", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "operator": "/", "right": { "commentStart": 787, "end": 0, "raw": "2", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 2.0, "suffix": "None" } }, "start": 0, "type": "BinaryExpression", "type": "BinaryExpression" } ], "callee": { "abs_path": false, "commentStart": 765, "end": 0, "name": { "commentStart": 765, "end": 0, "name": "toRadians", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 765, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" } ], "callee": { "abs_path": false, "commentStart": 761, "end": 0, "name": { "commentStart": 761, "end": 0, "name": "cos", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 761, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "BinaryExpression", "type": "BinaryExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "preComments": [ "", "", "// Calculate the positions of the hydrogen atoms" ], "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 791, "declaration": { "commentStart": 791, "end": 0, "id": { "commentStart": 791, "end": 0, "name": "hydrogenOffsetY", "start": 0, "type": "Identifier" }, "init": { "commentStart": 809, "end": 0, "left": { "abs_path": false, "commentStart": 809, "end": 0, "name": { "commentStart": 809, "end": 0, "name": "oxygenHydrogenDistance", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "operator": "*", "right": { "arguments": [ { "arguments": [ { "commentStart": 848, "end": 0, "left": { "abs_path": false, "commentStart": 848, "end": 0, "name": { "commentStart": 848, "end": 0, "name": "bondAngle", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "operator": "/", "right": { "commentStart": 860, "end": 0, "raw": "2", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 2.0, "suffix": "None" } }, "start": 0, "type": "BinaryExpression", "type": "BinaryExpression" } ], "callee": { "abs_path": false, "commentStart": 838, "end": 0, "name": { "commentStart": 838, "end": 0, "name": "toRadians", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 838, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" } ], "callee": { "abs_path": false, "commentStart": 834, "end": 0, "name": { "commentStart": 834, "end": 0, "name": "sin", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 834, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "BinaryExpression", "type": "BinaryExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 863, "declaration": { "commentStart": 894, "end": 0, "id": { "commentStart": 894, "end": 0, "name": "hydrogenAtom1", "start": 0, "type": "Identifier" }, "init": { "arguments": [ { "commentStart": 921, "elements": [ { "abs_path": false, "commentStart": 922, "end": 0, "name": { "commentStart": 922, "end": 0, "name": "hydrogenOffsetX", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "abs_path": false, "commentStart": 939, "end": 0, "name": { "commentStart": 939, "end": 0, "name": "hydrogenOffsetY", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } ], "end": 0, "start": 0, "type": "ArrayExpression", "type": "ArrayExpression" }, { "abs_path": false, "commentStart": 957, "end": 0, "name": { "commentStart": 957, "end": 0, "name": "hydrogenRadius", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } ], "callee": { "abs_path": false, "commentStart": 910, "end": 0, "name": { "commentStart": 910, "end": 0, "name": "createAtom", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 910, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "preComments": [ "", "", "// Create the hydrogen atoms" ], "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 973, "declaration": { "commentStart": 973, "end": 0, "id": { "commentStart": 973, "end": 0, "name": "hydrogenAtom2", "start": 0, "type": "Identifier" }, "init": { "arguments": [ { "commentStart": 1000, "elements": [ { "argument": { "abs_path": false, "commentStart": 1002, "end": 0, "name": { "commentStart": 1002, "end": 0, "name": "hydrogenOffsetX", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "commentStart": 1001, "end": 0, "operator": "-", "start": 0, "type": "UnaryExpression", "type": "UnaryExpression" }, { "abs_path": false, "commentStart": 1019, "end": 0, "name": { "commentStart": 1019, "end": 0, "name": "hydrogenOffsetY", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } ], "end": 0, "start": 0, "type": "ArrayExpression", "type": "ArrayExpression" }, { "abs_path": false, "commentStart": 1037, "end": 0, "name": { "commentStart": 1037, "end": 0, "name": "hydrogenRadius", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } ], "callee": { "abs_path": false, "commentStart": 989, "end": 0, "name": { "commentStart": 989, "end": 0, "name": "createAtom", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 989, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" } ], "commentStart": 0, "end": 0, "innerAttrs": [ { "commentStart": 0, "end": 0, "name": { "commentStart": 1, "end": 0, "name": "settings", "start": 0, "type": "Identifier" }, "properties": [ { "commentStart": 10, "end": 0, "key": { "commentStart": 10, "end": 0, "name": "defaultLengthUnit", "start": 0, "type": "Identifier" }, "start": 0, "type": "ObjectProperty", "value": { "abs_path": false, "commentStart": 30, "end": 0, "name": { "commentStart": 30, "end": 0, "name": "nm", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } } ], "start": 0, "type": "Annotation" } ], "nonCodeMeta": { "nonCodeNodes": { "0": [ { "commentStart": 143, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "inlineComment", "value": "Approximate radius of an oxygen atom", "style": "line" } } ], "1": [ { "commentStart": 206, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "inlineComment", "value": "Approximate radius of a hydrogen atom", "style": "line" } } ], "2": [ { "commentStart": 278, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "inlineComment", "value": "Approximate distance between oxygen and hydrogen atoms", "style": "line" } } ], "3": [ { "commentStart": 354, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "inlineComment", "value": "Bond angle in degrees", "style": "line" } }, { "commentStart": 379, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ] }, "startNodes": [ { "commentStart": 33, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ] }, "start": 0 } }