Parse units on numeric literals and keep them in the AST (#5061)

* Code changes

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* test changes

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Frontend changes

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactor asNum

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
Nick Cameron
2025-01-22 08:29:30 +13:00
committed by GitHub
parent a022b8ef6c
commit 965cb18059
173 changed files with 15324 additions and 4005 deletions

View File

@ -1398,23 +1398,23 @@ export class SceneEntities {
const arg0 = arg(kclCircle3PointArgs[0]) const arg0 = arg(kclCircle3PointArgs[0])
if (!arg0) return kclManager.ast if (!arg0) return kclManager.ast
arg0[0].value = points[0].x arg0[0].value = { value: points[0].x, suffix: 'None' }
arg0[0].raw = points[0].x.toString() arg0[0].raw = points[0].x.toString()
arg0[1].value = points[0].y arg0[1].value = { value: points[0].y, suffix: 'None' }
arg0[1].raw = points[0].y.toString() arg0[1].raw = points[0].y.toString()
const arg1 = arg(kclCircle3PointArgs[1]) const arg1 = arg(kclCircle3PointArgs[1])
if (!arg1) return kclManager.ast if (!arg1) return kclManager.ast
arg1[0].value = points[1].x arg1[0].value = { value: points[1].x, suffix: 'None' }
arg1[0].raw = points[1].x.toString() arg1[0].raw = points[1].x.toString()
arg1[1].value = points[1].y arg1[1].value = { value: points[1].y, suffix: 'None' }
arg1[1].raw = points[1].y.toString() arg1[1].raw = points[1].y.toString()
const arg2 = arg(kclCircle3PointArgs[2]) const arg2 = arg(kclCircle3PointArgs[2])
if (!arg2) return kclManager.ast if (!arg2) return kclManager.ast
arg2[0].value = points[2].x arg2[0].value = { value: points[2].x, suffix: 'None' }
arg2[0].raw = points[2].x.toString() arg2[0].raw = points[2].x.toString()
arg2[1].value = points[2].y arg2[1].value = { value: points[2].y, suffix: 'None' }
arg2[1].raw = points[2].y.toString() arg2[1].raw = points[2].y.toString()
const astSnapshot = structuredClone(kclManager.ast) const astSnapshot = structuredClone(kclManager.ast)

View File

@ -24,7 +24,10 @@ describe('testing AST', () => {
type: 'Literal', type: 'Literal',
start: 0, start: 0,
end: 1, end: 1,
value: 5, value: {
suffix: 'None',
value: 5,
},
raw: '5', raw: '5',
}, },
operator: '+', operator: '+',
@ -32,7 +35,10 @@ describe('testing AST', () => {
type: 'Literal', type: 'Literal',
start: 3, start: 3,
end: 4, end: 4,
value: 6, value: {
suffix: 'None',
value: 6,
},
raw: '6', raw: '6',
}, },
}, },

View File

@ -39,7 +39,7 @@ describe('Testing createLiteral', () => {
it('should create a literal', () => { it('should create a literal', () => {
const result = createLiteral(5) const result = createLiteral(5)
expect(result.type).toBe('Literal') expect(result.type).toBe('Literal')
expect(result.value).toBe(5) expect((result as any).value.value).toBe(5)
}) })
}) })
describe('Testing createIdentifier', () => { describe('Testing createIdentifier', () => {
@ -56,7 +56,7 @@ describe('Testing createCallExpression', () => {
expect(result.callee.type).toBe('Identifier') expect(result.callee.type).toBe('Identifier')
expect(result.callee.name).toBe('myFunc') expect(result.callee.name).toBe('myFunc')
expect(result.arguments[0].type).toBe('Literal') expect(result.arguments[0].type).toBe('Literal')
expect((result.arguments[0] as any).value).toBe(5) expect((result.arguments[0] as any).value.value).toBe(5)
}) })
}) })
describe('Testing createObjectExpression', () => { describe('Testing createObjectExpression', () => {
@ -68,7 +68,7 @@ describe('Testing createObjectExpression', () => {
expect(result.properties[0].type).toBe('ObjectProperty') expect(result.properties[0].type).toBe('ObjectProperty')
expect(result.properties[0].key.name).toBe('myProp') expect(result.properties[0].key.name).toBe('myProp')
expect(result.properties[0].value.type).toBe('Literal') expect(result.properties[0].value.type).toBe('Literal')
expect((result.properties[0].value as any).value).toBe(5) expect((result.properties[0].value as any).value.value).toBe(5)
}) })
}) })
describe('Testing createArrayExpression', () => { describe('Testing createArrayExpression', () => {
@ -76,7 +76,7 @@ describe('Testing createArrayExpression', () => {
const result = createArrayExpression([createLiteral(5)]) const result = createArrayExpression([createLiteral(5)])
expect(result.type).toBe('ArrayExpression') expect(result.type).toBe('ArrayExpression')
expect(result.elements[0].type).toBe('Literal') expect(result.elements[0].type).toBe('Literal')
expect((result.elements[0] as any).value).toBe(5) expect((result.elements[0] as any).value.value).toBe(5)
}) })
}) })
describe('Testing createPipeSubstitution', () => { describe('Testing createPipeSubstitution', () => {
@ -93,7 +93,7 @@ describe('Testing createVariableDeclaration', () => {
expect(result.declaration.id.type).toBe('Identifier') expect(result.declaration.id.type).toBe('Identifier')
expect(result.declaration.id.name).toBe('myVar') expect(result.declaration.id.name).toBe('myVar')
expect(result.declaration.init.type).toBe('Literal') expect(result.declaration.init.type).toBe('Literal')
expect((result.declaration.init as any).value).toBe(5) expect((result.declaration.init as any).value.value).toBe(5)
}) })
}) })
describe('Testing createPipeExpression', () => { describe('Testing createPipeExpression', () => {
@ -101,7 +101,7 @@ describe('Testing createPipeExpression', () => {
const result = createPipeExpression([createLiteral(5)]) const result = createPipeExpression([createLiteral(5)])
expect(result.type).toBe('PipeExpression') expect(result.type).toBe('PipeExpression')
expect(result.body[0].type).toBe('Literal') expect(result.body[0].type).toBe('Literal')
expect((result.body[0] as any).value).toBe(5) expect((result.body[0] as any).value.value).toBe(5)
}) })
}) })

View File

@ -743,14 +743,18 @@ export function splitPathAtPipeExpression(pathToNode: PathToNode): {
return splitPathAtPipeExpression(pathToNode.slice(0, -1)) return splitPathAtPipeExpression(pathToNode.slice(0, -1))
} }
export function createLiteral(value: LiteralValue): Node<Literal> { export function createLiteral(value: LiteralValue | number): Node<Literal> {
const raw = `${value}`
if (typeof value === 'number') {
value = { value, suffix: 'None' }
}
return { return {
type: 'Literal', type: 'Literal',
start: 0, start: 0,
end: 0, end: 0,
moduleId: 0, moduleId: 0,
value, value,
raw: `${value}`, raw,
} }
} }

View File

@ -660,7 +660,7 @@ myNestedVar = [
enter: (node, path) => { enter: (node, path) => {
if ( if (
node.type === 'Literal' && node.type === 'Literal' &&
String(node.value) === literalOfInterest String((node as any).value.value) === literalOfInterest
) { ) {
pathToNode = path pathToNode = path
} else if ( } else if (

View File

@ -717,16 +717,6 @@ function isTypeInArrayExp(
return node.elements.some((el) => isTypeInValue(el, syntaxType)) return node.elements.some((el) => isTypeInValue(el, syntaxType))
} }
export function isValueZero(val?: Expr): boolean {
return (
(val?.type === 'Literal' && Number(val.value) === 0) ||
(val?.type === 'UnaryExpression' &&
val.operator === '-' &&
val.argument.type === 'Literal' &&
Number(val.argument.value) === 0)
)
}
export function isLinesParallelAndConstrained( export function isLinesParallelAndConstrained(
ast: Program, ast: Program,
artifactGraph: ArtifactGraph, artifactGraph: ArtifactGraph,

View File

@ -20,12 +20,12 @@ import {
sketchFromKclValue, sketchFromKclValue,
Literal, Literal,
SourceRange, SourceRange,
LiteralValue,
} from '../wasm' } from '../wasm'
import { import {
getNodeFromPath, getNodeFromPath,
getNodeFromPathCurry, getNodeFromPathCurry,
getNodePathFromSourceRange, getNodePathFromSourceRange,
isValueZero,
} from '../queryAst' } from '../queryAst'
import { import {
createArrayExpression, createArrayExpression,
@ -79,11 +79,32 @@ export type ConstraintType =
| 'setAngleBetween' | 'setAngleBetween'
const REF_NUM_ERR = new Error('Referenced segment does not have a to value') const REF_NUM_ERR = new Error('Referenced segment does not have a to value')
function asNum(val: LiteralValue): number | Error {
if (typeof val === 'object') return val.value
return REF_NUM_ERR
}
function forceNum(arg: Literal): number {
if (typeof arg.value === 'boolean' || typeof arg.value === 'string') {
return Number(arg.value)
} else {
return arg.value.value
}
}
function isUndef(val: any): val is undefined { function isUndef(val: any): val is undefined {
return typeof val === 'undefined' return typeof val === 'undefined'
} }
function isNum(val: any): val is number {
return typeof val === 'number' function isValueZero(val?: Expr): boolean {
return (
(val?.type === 'Literal' && forceNum(val) === 0) ||
(val?.type === 'UnaryExpression' &&
val.operator === '-' &&
val.argument.type === 'Literal' &&
Number(val.argument.value) === 0)
)
} }
function createCallWrapper( function createCallWrapper(
@ -190,7 +211,7 @@ const xyLineSetLength =
: referenceSeg : referenceSeg
? segRef ? segRef
: args[0].expr : args[0].expr
const literalARg = getArgLiteralVal(args[0].expr) const literalARg = asNum(args[0].expr.value)
if (err(literalARg)) return literalARg if (err(literalARg)) return literalARg
return createCallWrapper(xOrY, lineVal, tag, literalARg) return createCallWrapper(xOrY, lineVal, tag, literalARg)
} }
@ -211,13 +232,14 @@ const basicAngledLineCreateNode =
referencedSegment: path, referencedSegment: path,
}) => { }) => {
const refAng = path ? getAngle(path?.from, path?.to) : 0 const refAng = path ? getAngle(path?.from, path?.to) : 0
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const argValue = asNum(args[0].expr.value)
if (err(argValue)) return argValue
const nonForcedAng = const nonForcedAng =
varValToUse === 'ang' varValToUse === 'ang'
? inputs[0].expr ? inputs[0].expr
: referenceSeg === 'ang' : referenceSeg === 'ang'
? getClosesAngleDirection( ? getClosesAngleDirection(
args[0].expr.value, argValue,
refAng, refAng,
createSegAngle(referenceSegName) createSegAngle(referenceSegName)
) )
@ -230,8 +252,8 @@ const basicAngledLineCreateNode =
: args[1].expr : args[1].expr
const shouldForceAng = valToForce === 'ang' && forceValueUsedInTransform const shouldForceAng = valToForce === 'ang' && forceValueUsedInTransform
const shouldForceLen = valToForce === 'len' && forceValueUsedInTransform const shouldForceLen = valToForce === 'len' && forceValueUsedInTransform
const literalArg = getArgLiteralVal( const literalArg = asNum(
valToForce === 'ang' ? args[0].expr : args[1].expr valToForce === 'ang' ? args[0].expr.value : args[1].expr.value
) )
if (err(literalArg)) return literalArg if (err(literalArg)) return literalArg
return createCallWrapper( return createCallWrapper(
@ -283,7 +305,7 @@ const getMinAndSegAngVals = (
} }
const getSignedLeg = (arg: Literal, legLenVal: BinaryPart) => const getSignedLeg = (arg: Literal, legLenVal: BinaryPart) =>
Number(arg.value) < 0 ? createUnaryExpression(legLenVal) : legLenVal forceNum(arg) < 0 ? createUnaryExpression(legLenVal) : legLenVal
const getLegAng = (ang: number, legAngleVal: BinaryPart) => { const getLegAng = (ang: number, legAngleVal: BinaryPart) => {
const normalisedAngle = ((ang % 360) + 360) % 360 // between 0 and 360 const normalisedAngle = ((ang % 360) + 360) % 360 // between 0 and 360
@ -322,8 +344,7 @@ const setHorzVertDistanceCreateNode =
referencedSegment, referencedSegment,
}) => { }) => {
const refNum = referencedSegment?.to?.[index] const refNum = referencedSegment?.to?.[index]
const literalArg = getArgLiteralVal(args?.[index].expr) const literalArg = asNum(args?.[index].expr.value)
if (err(literalArg)) return literalArg
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
const valueUsedInTransform = roundOff(literalArg - refNum, 2) const valueUsedInTransform = roundOff(literalArg - refNum, 2)
@ -352,7 +373,7 @@ const setHorzVertDistanceForAngleLineCreateNode =
referencedSegment, referencedSegment,
}) => { }) => {
const refNum = referencedSegment?.to?.[index] const refNum = referencedSegment?.to?.[index]
const literalArg = getArgLiteralVal(args?.[1].expr) const literalArg = asNum(args?.[1].expr.value)
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
const valueUsedInTransform = roundOff(literalArg - refNum, 2) const valueUsedInTransform = roundOff(literalArg - refNum, 2)
const binExp = createBinaryExpressionWithUnary([ const binExp = createBinaryExpressionWithUnary([
@ -374,8 +395,8 @@ const setAbsDistanceCreateNode =
index = xOrY === 'x' ? 0 : 1 index = xOrY === 'x' ? 0 : 1
): CreateStdLibSketchCallExpr => ): CreateStdLibSketchCallExpr =>
({ tag, forceValueUsedInTransform, rawArgs: args }) => { ({ tag, forceValueUsedInTransform, rawArgs: args }) => {
const literalArg = getArgLiteralVal(args?.[index].expr) const literalArg = asNum(args?.[index].expr.value)
if (err(literalArg)) return REF_NUM_ERR if (err(literalArg)) return literalArg
const valueUsedInTransform = roundOff(literalArg, 2) const valueUsedInTransform = roundOff(literalArg, 2)
const val = forceValueUsedInTransform || createLiteral(valueUsedInTransform) const val = forceValueUsedInTransform || createLiteral(valueUsedInTransform)
if (isXOrYLine) { if (isXOrYLine) {
@ -396,8 +417,8 @@ const setAbsDistanceCreateNode =
const setAbsDistanceForAngleLineCreateNode = const setAbsDistanceForAngleLineCreateNode =
(xOrY: 'x' | 'y'): CreateStdLibSketchCallExpr => (xOrY: 'x' | 'y'): CreateStdLibSketchCallExpr =>
({ tag, forceValueUsedInTransform, inputs, rawArgs: args }) => { ({ tag, forceValueUsedInTransform, inputs, rawArgs: args }) => {
const literalArg = getArgLiteralVal(args?.[1].expr) const literalArg = asNum(args?.[1].expr.value)
if (err(literalArg)) return REF_NUM_ERR if (err(literalArg)) return literalArg
const valueUsedInTransform = roundOff(literalArg, 2) const valueUsedInTransform = roundOff(literalArg, 2)
const val = forceValueUsedInTransform || createLiteral(valueUsedInTransform) const val = forceValueUsedInTransform || createLiteral(valueUsedInTransform)
return createCallWrapper( return createCallWrapper(
@ -419,7 +440,7 @@ const setHorVertDistanceForXYLines =
}) => { }) => {
const index = xOrY === 'x' ? 0 : 1 const index = xOrY === 'x' ? 0 : 1
const refNum = referencedSegment?.to?.[index] const refNum = referencedSegment?.to?.[index]
const literalArg = getArgLiteralVal(args?.[index].expr) const literalArg = asNum(args?.[index].expr.value)
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
const valueUsedInTransform = roundOff(literalArg - refNum, 2) const valueUsedInTransform = roundOff(literalArg - refNum, 2)
const makeBinExp = createBinaryExpressionWithUnary([ const makeBinExp = createBinaryExpressionWithUnary([
@ -445,9 +466,9 @@ const setHorzVertDistanceConstraintLineCreateNode =
]) ])
const makeBinExp = (index: 0 | 1) => { const makeBinExp = (index: 0 | 1) => {
const arg = getArgLiteralVal(args?.[index].expr) const arg = asNum(args?.[index].expr.value)
const refNum = referencedSegment?.to?.[index] const refNum = referencedSegment?.to?.[index]
if (err(arg) || !isNum(refNum)) return REF_NUM_ERR if (err(arg) || isUndef(refNum)) return REF_NUM_ERR
return createBinaryExpressionWithUnary([ return createBinaryExpressionWithUnary([
createSegEnd(referenceSegName, isX), createSegEnd(referenceSegName, isX),
createLiteral(roundOff(arg - refNum, 2)), createLiteral(roundOff(arg - refNum, 2)),
@ -468,9 +489,9 @@ const setAngledIntersectLineForLines: CreateStdLibSketchCallExpr = ({
forceValueUsedInTransform, forceValueUsedInTransform,
rawArgs: args, rawArgs: args,
}) => { }) => {
const val = args[1].expr.value, const val = asNum(args[1].expr.value),
angle = args[0].expr.value angle = asNum(args[0].expr.value)
if (!isNum(val) || !isNum(angle)) return REF_NUM_ERR if (err(val) || err(angle)) return REF_NUM_ERR
const valueUsedInTransform = roundOff(val, 2) const valueUsedInTransform = roundOff(val, 2)
const varNamMap: { [key: number]: string } = { const varNamMap: { [key: number]: string } = {
0: 'ZERO', 0: 'ZERO',
@ -498,8 +519,8 @@ const setAngledIntersectForAngledLines: CreateStdLibSketchCallExpr = ({
inputs, inputs,
rawArgs: args, rawArgs: args,
}) => { }) => {
const val = args[1].expr.value const val = asNum(args[1].expr.value)
if (!isNum(val)) return REF_NUM_ERR if (err(val)) return val
const valueUsedInTransform = roundOff(val, 2) const valueUsedInTransform = roundOff(val, 2)
return intersectCallWrapper({ return intersectCallWrapper({
fnName: 'angledLineThatIntersects', fnName: 'angledLineThatIntersects',
@ -524,8 +545,8 @@ const setAngleBetweenCreateNode =
const refAngle = referencedSegment const refAngle = referencedSegment
? getAngle(referencedSegment?.from, referencedSegment?.to) ? getAngle(referencedSegment?.from, referencedSegment?.to)
: 0 : 0
const val = args[0].expr.value const val = asNum(args[0].expr.value)
if (!isNum(val)) return REF_NUM_ERR if (err(val)) return val
let valueUsedInTransform = roundOff(normaliseAngle(val - refAngle)) let valueUsedInTransform = roundOff(normaliseAngle(val - refAngle))
let firstHalfValue = createSegAngle(referenceSegName) let firstHalfValue = createSegAngle(referenceSegName)
if (Math.abs(valueUsedInTransform) > 90) { if (Math.abs(valueUsedInTransform) > 90) {
@ -706,13 +727,11 @@ const transformMap: TransformMap = {
createPipeSubstitution(), createPipeSubstitution(),
] ]
) )
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const val = asNum(args[0].expr.value)
if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineToX', 'angledLineToX',
[ [getAngleLengthSign(val, angleToMatchLengthXCall), inputs[0].expr],
getAngleLengthSign(args[0].expr.value, angleToMatchLengthXCall),
inputs[0].expr,
],
tag tag
) )
}, },
@ -739,13 +758,11 @@ const transformMap: TransformMap = {
createPipeSubstitution(), createPipeSubstitution(),
] ]
) )
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const val = asNum(args[0].expr.value)
if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineToY', 'angledLineToY',
[ [getAngleLengthSign(val, angleToMatchLengthYCall), inputs[1].expr],
getAngleLengthSign(args[0].expr.value, angleToMatchLengthYCall),
inputs[1].expr,
],
tag tag
) )
}, },
@ -763,7 +780,7 @@ const transformMap: TransformMap = {
forceValueUsedInTransform, forceValueUsedInTransform,
rawArgs: args, rawArgs: args,
}) => { }) => {
const val = getArgLiteralVal(args[0].expr) const val = asNum(args[0].expr.value)
if (err(val)) return val if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineToY', 'angledLineToY',
@ -844,7 +861,7 @@ const transformMap: TransformMap = {
tooltip: 'yLine', tooltip: 'yLine',
createNode: ({ inputs, tag, rawArgs: args }) => { createNode: ({ inputs, tag, rawArgs: args }) => {
const expr = inputs[1].expr const expr = inputs[1].expr
if (Number(args[0].expr.value) >= 0) if (forceNum(args[0].expr) >= 0)
return createCallWrapper('yLine', expr, tag) return createCallWrapper('yLine', expr, tag)
if (isExprBinaryPart(expr)) if (isExprBinaryPart(expr))
return createCallWrapper('yLine', createUnaryExpression(expr), tag) return createCallWrapper('yLine', createUnaryExpression(expr), tag)
@ -856,7 +873,7 @@ const transformMap: TransformMap = {
tooltip: 'xLine', tooltip: 'xLine',
createNode: ({ inputs, tag, rawArgs: args }) => { createNode: ({ inputs, tag, rawArgs: args }) => {
const expr = inputs[1].expr const expr = inputs[1].expr
if (Number(args[0].expr.value) >= 0) if (forceNum(args[0].expr) >= 0)
return createCallWrapper('xLine', expr, tag) return createCallWrapper('xLine', expr, tag)
if (isExprBinaryPart(expr)) if (isExprBinaryPart(expr))
return createCallWrapper('xLine', createUnaryExpression(expr), tag) return createCallWrapper('xLine', createUnaryExpression(expr), tag)
@ -900,10 +917,11 @@ const transformMap: TransformMap = {
referenceSegName, referenceSegName,
getInputOfType(inputs, 'xRelative').expr getInputOfType(inputs, 'xRelative').expr
) )
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const val = asNum(args[0].expr.value)
if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineOfXLength', 'angledLineOfXLength',
[getLegAng(args[0].expr.value, legAngle), minVal], [getLegAng(val, legAngle), minVal],
tag tag
) )
}, },
@ -912,7 +930,7 @@ const transformMap: TransformMap = {
tooltip: 'xLine', tooltip: 'xLine',
createNode: ({ inputs, tag, rawArgs: args }) => { createNode: ({ inputs, tag, rawArgs: args }) => {
const expr = inputs[1].expr const expr = inputs[1].expr
if (Number(args[0].expr.value) >= 0) if (forceNum(args[0].expr) >= 0)
return createCallWrapper('xLine', expr, tag) return createCallWrapper('xLine', expr, tag)
if (isExprBinaryPart(expr)) if (isExprBinaryPart(expr))
return createCallWrapper('xLine', createUnaryExpression(expr), tag) return createCallWrapper('xLine', createUnaryExpression(expr), tag)
@ -953,10 +971,11 @@ const transformMap: TransformMap = {
inputs[1].expr, inputs[1].expr,
'legAngY' 'legAngY'
) )
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const val = asNum(args[0].expr.value)
if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineOfXLength', 'angledLineOfXLength',
[getLegAng(args[0].expr.value, legAngle), minVal], [getLegAng(val, legAngle), minVal],
tag tag
) )
}, },
@ -965,7 +984,7 @@ const transformMap: TransformMap = {
tooltip: 'yLine', tooltip: 'yLine',
createNode: ({ inputs, tag, rawArgs: args }) => { createNode: ({ inputs, tag, rawArgs: args }) => {
const expr = inputs[1].expr const expr = inputs[1].expr
if (Number(args[0].expr.value) >= 0) if (forceNum(args[0].expr) >= 0)
return createCallWrapper('yLine', expr, tag) return createCallWrapper('yLine', expr, tag)
if (isExprBinaryPart(expr)) if (isExprBinaryPart(expr))
return createCallWrapper('yLine', createUnaryExpression(expr), tag) return createCallWrapper('yLine', createUnaryExpression(expr), tag)
@ -1005,13 +1024,11 @@ const transformMap: TransformMap = {
createPipeSubstitution(), createPipeSubstitution(),
] ]
) )
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const val = asNum(args[0].expr.value)
if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineToX', 'angledLineToX',
[ [getAngleLengthSign(val, angleToMatchLengthXCall), inputs[1].expr],
getAngleLengthSign(args[0].expr.value, angleToMatchLengthXCall),
inputs[1].expr,
],
tag tag
) )
}, },
@ -1057,13 +1074,11 @@ const transformMap: TransformMap = {
createPipeSubstitution(), createPipeSubstitution(),
] ]
) )
if (!isNum(args[0].expr.value)) return REF_NUM_ERR const val = asNum(args[0].expr.value)
if (err(val)) return val
return createCallWrapper( return createCallWrapper(
'angledLineToY', 'angledLineToY',
[ [getAngleLengthSign(val, angleToMatchLengthXCall), inputs[1].expr],
getAngleLengthSign(args[0].expr.value, angleToMatchLengthXCall),
inputs[1].expr,
],
tag tag
) )
}, },
@ -1080,7 +1095,7 @@ const transformMap: TransformMap = {
equalLength: { equalLength: {
tooltip: 'xLine', tooltip: 'xLine',
createNode: ({ referenceSegName, tag, rawArgs: args }) => { createNode: ({ referenceSegName, tag, rawArgs: args }) => {
const argVal = getArgLiteralVal(args[0].expr) const argVal = asNum(args[0].expr.value)
if (err(argVal)) return argVal if (err(argVal)) return argVal
const segLen = createSegLen(referenceSegName) const segLen = createSegLen(referenceSegName)
if (argVal > 0) return createCallWrapper('xLine', segLen, tag, argVal) if (argVal > 0) return createCallWrapper('xLine', segLen, tag, argVal)
@ -1118,7 +1133,7 @@ const transformMap: TransformMap = {
equalLength: { equalLength: {
tooltip: 'yLine', tooltip: 'yLine',
createNode: ({ referenceSegName, tag, rawArgs: args }) => { createNode: ({ referenceSegName, tag, rawArgs: args }) => {
const argVal = getArgLiteralVal(args[0].expr) const argVal = asNum(args[0].expr.value)
if (err(argVal)) return argVal if (err(argVal)) return argVal
let segLen = createSegLen(referenceSegName) let segLen = createSegLen(referenceSegName)
if (argVal < 0) segLen = createUnaryExpression(segLen) if (argVal < 0) segLen = createUnaryExpression(segLen)
@ -1823,11 +1838,6 @@ function createLastSeg(isX: boolean): Node<CallExpression> {
]) ])
} }
function getArgLiteralVal(arg: Literal): number | Error {
if (!isNum(arg.value)) return REF_NUM_ERR
return arg.value
}
export type ConstraintLevel = 'free' | 'partial' | 'full' export type ConstraintLevel = 'free' | 'partial' | 'full'
export function getConstraintLevelFromSourceRange( export function getConstraintLevelFromSourceRange(

View File

@ -929,13 +929,13 @@ impl Property {
LiteralIdentifier::Literal(literal) => { LiteralIdentifier::Literal(literal) => {
let value = literal.value.clone(); let value = literal.value.clone();
match value { match value {
LiteralValue::Number(x) => { LiteralValue::Number { value, .. } => {
if let Some(x) = crate::try_f64_to_usize(x) { if let Some(x) = crate::try_f64_to_usize(value) {
Ok(Property::UInt(x)) Ok(Property::UInt(x))
} else { } else {
Err(KclError::Semantic(KclErrorDetails { Err(KclError::Semantic(KclErrorDetails {
source_ranges: property_sr, source_ranges: property_sr,
message: format!("{x} is not a valid index, indices must be whole numbers >= 0"), message: format!("{value} is not a valid index, indices must be whole numbers >= 0"),
})) }))
} }
} }

View File

@ -288,7 +288,7 @@ impl KclValue {
pub(crate) fn from_literal(literal: LiteralValue, meta: Vec<Metadata>) -> Self { pub(crate) fn from_literal(literal: LiteralValue, meta: Vec<Metadata>) -> Self {
match literal { match literal {
LiteralValue::Number(value) => KclValue::Number { value, meta }, LiteralValue::Number { value, .. } => KclValue::Number { value, meta },
LiteralValue::String(value) => KclValue::String { value, meta }, LiteralValue::String(value) => KclValue::String { value, meta },
LiteralValue::Bool(value) => KclValue::Bool { value, meta }, LiteralValue::Bool(value) => KclValue::Bool { value, meta },
} }

View File

@ -163,7 +163,7 @@ fn get_xyz(point: &ObjectExpression) -> Option<(f64, f64, f64)> {
fn unlitafy(lit: &LiteralValue) -> Option<f64> { fn unlitafy(lit: &LiteralValue) -> Option<f64> {
Some(match lit { Some(match lit {
LiteralValue::Number(value) => *value, LiteralValue::Number { value, .. } => *value,
_ => { _ => {
return None; return None;
} }

View File

@ -1,6 +1,6 @@
use sha2::{Digest as DigestTrait, Sha256}; use sha2::{Digest as DigestTrait, Sha256};
use super::types::{DefaultParamVal, ItemVisibility, LabelledExpression, VariableKind}; use super::types::{DefaultParamVal, ItemVisibility, LabelledExpression, LiteralValue, VariableKind};
use crate::parsing::ast::types::{ use crate::parsing::ast::types::{
ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryPart, BodyItem, CallExpression, CallExpressionKw, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryPart, BodyItem, CallExpression, CallExpressionKw,
ElseIf, Expr, ExpressionStatement, FnArgType, FunctionExpression, Identifier, IfExpression, ImportItem, ElseIf, Expr, ExpressionStatement, FnArgType, FunctionExpression, Identifier, IfExpression, ImportItem,
@ -277,6 +277,26 @@ impl Literal {
}); });
} }
impl LiteralValue {
fn digestable_id(&self) -> Vec<u8> {
match self {
LiteralValue::Number { value, suffix } => {
let mut result: Vec<u8> = value.to_ne_bytes().into();
result.extend((*suffix as u32).to_ne_bytes());
result
}
LiteralValue::String(st) => st.as_bytes().into(),
LiteralValue::Bool(b) => {
if *b {
vec![1]
} else {
vec![0]
}
}
}
}
}
impl Identifier { impl Identifier {
compute_digest!(|slf, hasher| { compute_digest!(|slf, hasher| {
let name = slf.name.as_bytes(); let name = slf.name.as_bytes();

View File

@ -18,6 +18,8 @@ use crate::{
Program, Program,
}; };
use super::types::LiteralValue;
type Point3d = kcmc::shared::Point3d<f64>; type Point3d = kcmc::shared::Point3d<f64>;
#[derive(Debug)] #[derive(Debug)]
@ -201,8 +203,8 @@ fn create_start_sketch_on(
"startProfileAt", "startProfileAt",
vec![ vec![
ArrayExpression::new(vec![ ArrayExpression::new(vec![
Literal::new(round_before_recast(start[0]).into()).into(), Literal::new(LiteralValue::from_f64_no_uom(round_before_recast(start[0]))).into(),
Literal::new(round_before_recast(start[1]).into()).into(), Literal::new(LiteralValue::from_f64_no_uom(round_before_recast(start[1]))).into(),
]) ])
.into(), .into(),
PipeSubstitution::new().into(), PipeSubstitution::new().into(),
@ -221,8 +223,8 @@ fn create_start_sketch_on(
"line", "line",
vec![ vec![
ArrayExpression::new(vec![ ArrayExpression::new(vec![
Literal::new(round_before_recast(end[0]).into()).into(), Literal::new(LiteralValue::from_f64_no_uom(round_before_recast(end[0]))).into(),
Literal::new(round_before_recast(end[1]).into()).into(), Literal::new(LiteralValue::from_f64_no_uom(round_before_recast(end[1]))).into(),
]) ])
.into(), .into(),
PipeSubstitution::new().into(), PipeSubstitution::new().into(),
@ -254,8 +256,8 @@ fn create_start_sketch_on(
"line", "line",
vec![ vec![
ArrayExpression::new(vec![ ArrayExpression::new(vec![
Literal::new(round_before_recast(line[0]).into()).into(), Literal::new(LiteralValue::from_f64_no_uom(round_before_recast(line[0]))).into(),
Literal::new(round_before_recast(line[1]).into()).into(), Literal::new(LiteralValue::from_f64_no_uom(round_before_recast(line[1]))).into(),
]) ])
.into(), .into(),
PipeSubstitution::new().into(), PipeSubstitution::new().into(),

View File

@ -1,31 +1,49 @@
use std::fmt;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value as JValue;
use super::Node; use super::Node;
use crate::parsing::ast::types::{Expr, Literal}; use crate::parsing::{
ast::types::{Expr, Literal},
token::NumericSuffix,
};
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)] #[ts(export)]
#[serde(untagged, rename_all = "snake_case")] #[serde(untagged, rename_all = "snake_case")]
pub enum LiteralValue { pub enum LiteralValue {
Number(f64), Number { value: f64, suffix: NumericSuffix },
String(String), String(String),
Bool(bool), Bool(bool),
} }
impl LiteralValue { impl LiteralValue {
pub fn digestable_id(&self) -> Vec<u8> { pub fn from_f64_no_uom(value: f64) -> Self {
LiteralValue::Number {
value,
suffix: NumericSuffix::None,
}
}
}
impl fmt::Display for LiteralValue {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
LiteralValue::Number(frac) => frac.to_ne_bytes().into(), LiteralValue::Number { value, suffix } => {
LiteralValue::String(st) => st.as_bytes().into(), let int_value = *value as u64;
LiteralValue::Bool(b) => { if int_value as f64 == *value {
if *b { write!(f, "{int_value}")?;
vec![1]
} else { } else {
vec![0] write!(f, "{value}")?;
} }
if *suffix != NumericSuffix::None {
write!(f, "{suffix}")?;
}
Ok(())
} }
LiteralValue::String(s) => write!(f, "\"{s}\""),
LiteralValue::Bool(b) => write!(f, "{b}"),
} }
} }
} }
@ -36,49 +54,12 @@ impl From<Node<Literal>> for Expr {
} }
} }
impl From<LiteralValue> for JValue {
fn from(value: LiteralValue) -> Self {
match value {
LiteralValue::Number(x) => x.into(),
LiteralValue::String(x) => x.into(),
LiteralValue::Bool(b) => b.into(),
}
}
}
impl From<f64> for LiteralValue {
fn from(value: f64) -> Self {
Self::Number(value)
}
}
impl From<i64> for LiteralValue {
fn from(value: i64) -> Self {
Self::Number(value as f64)
}
}
impl From<String> for LiteralValue { impl From<String> for LiteralValue {
fn from(value: String) -> Self { fn from(value: String) -> Self {
Self::String(value) Self::String(value)
} }
} }
impl From<u32> for LiteralValue {
fn from(value: u32) -> Self {
Self::Number(value as f64)
}
}
impl From<u16> for LiteralValue {
fn from(value: u16) -> Self {
Self::Number(value as f64)
}
}
impl From<u8> for LiteralValue {
fn from(value: u8) -> Self {
Self::Number(value as f64)
}
}
impl From<&'static str> for LiteralValue { impl From<&'static str> for LiteralValue {
fn from(value: &'static str) -> Self { fn from(value: &'static str) -> Self {
// TODO: Make this Cow<str> // TODO: Make this Cow<str>

View File

@ -13,7 +13,6 @@ use anyhow::Result;
use parse_display::{Display, FromStr}; use parse_display::{Display, FromStr};
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value as JValue;
use tower_lsp::lsp_types::{ use tower_lsp::lsp_types::{
CompletionItem, CompletionItemKind, DocumentSymbol, FoldingRange, FoldingRangeKind, Range as LspRange, SymbolKind, CompletionItem, CompletionItemKind, DocumentSymbol, FoldingRange, FoldingRangeKind, Range as LspRange, SymbolKind,
}; };
@ -1867,7 +1866,7 @@ impl Node<Literal> {
impl Literal { impl Literal {
pub fn new(value: LiteralValue) -> Node<Self> { pub fn new(value: LiteralValue) -> Node<Self> {
Node::no_src(Self { Node::no_src(Self {
raw: JValue::from(value.clone()).to_string(), raw: value.to_string(),
value, value,
digest: None, digest: None,
}) })
@ -1878,7 +1877,7 @@ impl From<Node<Literal>> for KclValue {
fn from(literal: Node<Literal>) -> Self { fn from(literal: Node<Literal>) -> Self {
let meta = vec![literal.metadata()]; let meta = vec![literal.metadata()];
match literal.inner.value { match literal.inner.value {
LiteralValue::Number(value) => KclValue::Number { value, meta }, LiteralValue::Number { value, .. } => KclValue::Number { value, meta },
LiteralValue::String(value) => KclValue::String { value, meta }, LiteralValue::String(value) => KclValue::String { value, meta },
LiteralValue::Bool(value) => KclValue::Bool { value, meta }, LiteralValue::Bool(value) => KclValue::Bool { value, meta },
} }

View File

@ -126,7 +126,13 @@ impl From<BinaryOperator> for BinaryExpressionToken {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::{parsing::ast::types::Literal, source_range::ModuleId}; use crate::{
parsing::{
ast::types::{Literal, LiteralValue},
token::NumericSuffix,
},
source_range::ModuleId,
};
#[test] #[test]
fn parse_and_evaluate() { fn parse_and_evaluate() {
@ -134,7 +140,10 @@ mod tests {
fn lit(n: u8) -> BinaryPart { fn lit(n: u8) -> BinaryPart {
BinaryPart::Literal(Box::new(Node::new( BinaryPart::Literal(Box::new(Node::new(
Literal { Literal {
value: n.into(), value: LiteralValue::Number {
value: n as f64,
suffix: NumericSuffix::None,
},
raw: n.to_string(), raw: n.to_string(),
digest: None, digest: None,
}, },

View File

@ -483,7 +483,7 @@ pub(crate) fn unsigned_number_literal(i: &mut TokenSlice) -> PResult<Node<Litera
let (value, token) = any let (value, token) = any
.try_map(|token: Token| match token.token_type { .try_map(|token: Token| match token.token_type {
TokenType::Number => { TokenType::Number => {
let x: f64 = token.numeric_value().ok_or_else(|| { let value: f64 = token.numeric_value().ok_or_else(|| {
CompilationError::fatal(token.as_source_range(), format!("Invalid float: {}", token.value)) CompilationError::fatal(token.as_source_range(), format!("Invalid float: {}", token.value))
})?; })?;
@ -494,7 +494,13 @@ pub(crate) fn unsigned_number_literal(i: &mut TokenSlice) -> PResult<Node<Litera
)); ));
} }
Ok((LiteralValue::Number(x), token)) Ok((
LiteralValue::Number {
value,
suffix: token.numeric_suffix(),
},
token,
))
} }
_ => Err(CompilationError::fatal(token.as_source_range(), "invalid literal")), _ => Err(CompilationError::fatal(token.as_source_range(), "invalid literal")),
}) })
@ -2857,7 +2863,10 @@ mySk1 = startSketchAt([0, 0])"#;
ReturnStatement { ReturnStatement {
argument: Expr::Literal(Box::new(Node::new( argument: Expr::Literal(Box::new(Node::new(
Literal { Literal {
value: 2u32.into(), value: LiteralValue::Number {
value: 2.0,
suffix: NumericSuffix::None
},
raw: "2".to_owned(), raw: "2".to_owned(),
digest: None, digest: None,
}, },
@ -3058,7 +3067,15 @@ mySk1 = startSketchAt([0, 0])"#;
match &rhs.right { match &rhs.right {
BinaryPart::Literal(lit) => { BinaryPart::Literal(lit) => {
assert!(lit.start == 9 && lit.end == 10); assert!(lit.start == 9 && lit.end == 10);
assert!(lit.value == 3u32.into() && &lit.raw == "3" && lit.digest.is_none()); assert!(
lit.value
== LiteralValue::Number {
value: 3.0,
suffix: NumericSuffix::None
}
&& &lit.raw == "3"
&& lit.digest.is_none()
);
} }
_ => panic!(), _ => panic!(),
} }
@ -3129,11 +3146,23 @@ mySk1 = startSketchAt([0, 0])"#;
let BinaryPart::Literal(left) = actual.inner.left else { let BinaryPart::Literal(left) = actual.inner.left else {
panic!("should be expression"); panic!("should be expression");
}; };
assert_eq!(left.value, 1u32.into()); assert_eq!(
left.value,
LiteralValue::Number {
value: 1.0,
suffix: NumericSuffix::None
}
);
let BinaryPart::Literal(right) = actual.inner.right else { let BinaryPart::Literal(right) = actual.inner.right else {
panic!("should be expression"); panic!("should be expression");
}; };
assert_eq!(right.value, 2u32.into()); assert_eq!(
right.value,
LiteralValue::Number {
value: 2.0,
suffix: NumericSuffix::None
}
);
} }
} }
@ -3450,7 +3479,10 @@ mySk1 = startSketchAt([0, 0])"#;
operator: BinaryOperator::Add, operator: BinaryOperator::Add,
left: BinaryPart::Literal(Box::new(Node::new( left: BinaryPart::Literal(Box::new(Node::new(
Literal { Literal {
value: 5u32.into(), value: LiteralValue::Number {
value: 5.0,
suffix: NumericSuffix::None,
},
raw: "5".to_owned(), raw: "5".to_owned(),
digest: None, digest: None,
}, },
@ -3499,7 +3531,10 @@ mySk1 = startSketchAt([0, 0])"#;
BinaryExpression { BinaryExpression {
left: BinaryPart::Literal(Box::new(Node::new( left: BinaryPart::Literal(Box::new(Node::new(
Literal { Literal {
value: 5u32.into(), value: LiteralValue::Number {
value: 5.0,
suffix: NumericSuffix::None,
},
raw: "5".to_string(), raw: "5".to_string(),
digest: None, digest: None,
}, },
@ -3510,7 +3545,10 @@ mySk1 = startSketchAt([0, 0])"#;
operator: BinaryOperator::Add, operator: BinaryOperator::Add,
right: BinaryPart::Literal(Box::new(Node::new( right: BinaryPart::Literal(Box::new(Node::new(
Literal { Literal {
value: 6u32.into(), value: LiteralValue::Number {
value: 6.0,
suffix: NumericSuffix::None,
},
raw: "6".to_string(), raw: "6".to_string(),
digest: None, digest: None,
}, },

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3851
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -18,7 +19,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 4, "start": 4,
"end": 5 "end": 5

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3852
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -18,7 +19,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 2, "start": 2,
"end": 3 "end": 3

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3853
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -18,7 +19,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 3, "start": 3,
"end": 4 "end": 4

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3854
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -22,7 +23,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 4, "start": 4,
"end": 5 "end": 5
@ -30,7 +34,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 8, "start": 8,
"end": 9 "end": 9

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3855
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -22,7 +23,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 6, "start": 6,
"end": 7 "end": 7
@ -30,7 +34,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 10, "start": 10,
"end": 11 "end": 11

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3856
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -14,7 +12,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -26,7 +27,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 6, "start": 6,
"end": 7 "end": 7
@ -34,7 +38,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 10, "start": 10,
"end": 11 "end": 11
@ -48,7 +55,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0, "value": {
"value": 4.0,
"suffix": "None"
},
"raw": "4", "raw": "4",
"start": 16, "start": 16,
"end": 17 "end": 17

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3857
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -26,7 +27,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 6, "start": 6,
"end": 7 "end": 7
@ -34,7 +38,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 10, "start": 10,
"end": 11 "end": 11
@ -45,7 +52,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0, "value": {
"value": 4.0,
"suffix": "None"
},
"raw": "4", "raw": "4",
"start": 16, "start": 16,
"end": 17 "end": 17

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3858
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -30,7 +31,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 7, "start": 7,
"end": 8 "end": 8
@ -38,7 +42,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 11, "start": 11,
"end": 12 "end": 12
@ -49,7 +56,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0, "value": {
"value": 4.0,
"suffix": "None"
},
"raw": "4", "raw": "4",
"start": 17, "start": 17,
"end": 18 "end": 18
@ -60,7 +70,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0, "value": {
"value": 5.0,
"suffix": "None"
},
"raw": "5", "raw": "5",
"start": 21, "start": 21,
"end": 22 "end": 22

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3859
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0, "value": {
"value": 1.0,
"suffix": "None"
},
"raw": "1", "raw": "1",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -22,7 +23,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 8, "start": 8,
"end": 9 "end": 9
@ -30,7 +34,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 12, "start": 12,
"end": 13 "end": 13

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3860
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -49,7 +47,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 6.0, "value": {
"value": 6.0,
"suffix": "None"
},
"raw": "6", "raw": "6",
"start": 21, "start": 21,
"end": 22 "end": 22

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3861
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"type": "BinaryExpression", "type": "BinaryExpression",
@ -10,7 +8,10 @@ snapshot_kind: text
"left": { "left": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2", "raw": "2",
"start": 0, "start": 0,
"end": 1 "end": 1
@ -18,7 +19,10 @@ snapshot_kind: text
"right": { "right": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0, "value": {
"value": 3.0,
"suffix": "None"
},
"raw": "3", "raw": "3",
"start": 7, "start": 7,
"end": 8 "end": 8

View File

@ -25,7 +25,10 @@ expression: actual
"start": 27, "start": 27,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 31, "end": 31,
@ -33,7 +36,10 @@ expression: actual
"start": 30, "start": 30,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 32, "end": 32,
@ -63,7 +69,10 @@ expression: actual
"start": 47, "start": 47,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 52, "end": 52,
@ -71,7 +80,10 @@ expression: actual
"start": 50, "start": 50,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
} }
], ],
"end": 53, "end": 53,
@ -108,7 +120,10 @@ expression: actual
"start": 81, "start": 81,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 82, "end": 82,
"operator": "-", "operator": "-",
@ -122,7 +137,10 @@ expression: actual
"start": 84, "start": 84,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
} }
], ],
"end": 86, "end": 86,
@ -158,7 +176,10 @@ expression: actual
"start": 104, "start": 104,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -167,7 +188,10 @@ expression: actual
"start": 108, "start": 108,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 15.0 "value": {
"value": 15.0,
"suffix": "None"
}
}, },
"end": 110, "end": 110,
"operator": "-", "operator": "-",
@ -207,7 +231,10 @@ expression: actual
"start": 131, "start": 131,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
{ {
"end": 136, "end": 136,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3964
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -31,7 +29,10 @@ snapshot_kind: text
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -40,7 +41,10 @@ snapshot_kind: text
"start": 18, "start": 18,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"end": 19, "end": 19,
"operator": "-", "operator": "-",

View File

@ -21,7 +21,10 @@ expression: actual
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
"endInclusive": true, "endInclusive": true,
"start": 10, "start": 10,
@ -31,7 +34,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"type": "ArrayRangeExpression", "type": "ArrayRangeExpression",
"type": "ArrayRangeExpression" "type": "ArrayRangeExpression"

View File

@ -23,7 +23,10 @@ expression: actual
"start": 50, "start": 50,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"end": 51, "end": 51,
"start": 43, "start": 43,

View File

@ -25,7 +25,10 @@ expression: actual
"start": 26, "start": 26,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 29, "end": 29,
@ -33,7 +36,10 @@ expression: actual
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 30, "end": 30,
@ -63,7 +69,10 @@ expression: actual
"start": 51, "start": 51,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 55, "end": 55,
@ -71,7 +80,10 @@ expression: actual
"start": 54, "start": 54,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 56, "end": 56,
@ -114,7 +126,10 @@ expression: actual
"start": 89, "start": 89,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 93, "end": 93,
@ -122,7 +137,10 @@ expression: actual
"start": 92, "start": 92,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 94, "end": 94,
@ -158,7 +176,10 @@ expression: actual
"start": 118, "start": 118,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 122, "end": 122,
@ -166,7 +187,10 @@ expression: actual
"start": 121, "start": 121,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 123, "end": 123,

View File

@ -25,7 +25,10 @@ expression: actual
"start": 26, "start": 26,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 29, "end": 29,
@ -33,7 +36,10 @@ expression: actual
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 30, "end": 30,
@ -63,7 +69,10 @@ expression: actual
"start": 43, "start": 43,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 47, "end": 47,
@ -71,7 +80,10 @@ expression: actual
"start": 46, "start": 46,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 48, "end": 48,

View File

@ -23,7 +23,10 @@ expression: actual
"start": 10, "start": 10,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -45,7 +48,10 @@ expression: actual
"start": 18, "start": 18,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 22, "end": 22,

View File

@ -46,7 +46,10 @@ expression: actual
"start": 34, "start": 34,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 38, "end": 38,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3996
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -31,7 +29,10 @@ snapshot_kind: text
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 18, "end": 18,
@ -39,7 +40,10 @@ snapshot_kind: text
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 19, "end": 19,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3997
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -31,7 +29,10 @@ snapshot_kind: text
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 18, "end": 18,
@ -39,7 +40,10 @@ snapshot_kind: text
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 19, "end": 19,
@ -66,7 +70,10 @@ snapshot_kind: text
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 32, "end": 32,
@ -74,7 +81,10 @@ snapshot_kind: text
"start": 31, "start": 31,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 33, "end": 33,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3998
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -31,7 +29,10 @@ snapshot_kind: text
"start": 12, "start": 12,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 16, "end": 16,
@ -39,7 +40,10 @@ snapshot_kind: text
"start": 15, "start": 15,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 17, "end": 17,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 3999
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -31,7 +29,10 @@ snapshot_kind: text
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 18, "end": 18,
@ -39,7 +40,10 @@ snapshot_kind: text
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 19, "end": 19,
@ -66,7 +70,10 @@ snapshot_kind: text
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 32, "end": 32,
@ -74,7 +81,10 @@ snapshot_kind: text
"start": 31, "start": 31,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 33, "end": 33,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 4000
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -31,7 +29,10 @@ snapshot_kind: text
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 18, "end": 18,
@ -39,7 +40,10 @@ snapshot_kind: text
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 19, "end": 19,
@ -66,7 +70,10 @@ snapshot_kind: text
"start": 27, "start": 27,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 31, "end": 31,
@ -74,7 +81,10 @@ snapshot_kind: text
"start": 30, "start": 30,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 32, "end": 32,

View File

@ -23,7 +23,10 @@ expression: actual
"start": 26, "start": 26,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 29, "end": 29,
@ -31,7 +34,10 @@ expression: actual
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 30, "end": 30,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 4002
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -16,7 +14,10 @@ snapshot_kind: text
"start": 4, "start": 4,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 14, "end": 14,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 4003
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -16,7 +14,10 @@ snapshot_kind: text
"start": 0, "start": 0,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"operator": "+", "operator": "+",
"right": { "right": {

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 4004
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -18,7 +16,10 @@ snapshot_kind: text
"start": 6, "start": 6,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 10, "end": 10,

View File

@ -60,7 +60,10 @@ expression: actual
"start": 62, "start": 62,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 66, "end": 66,
@ -68,7 +71,10 @@ expression: actual
"start": 65, "start": 65,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 67, "end": 67,
@ -93,7 +99,10 @@ expression: actual
"start": 77, "start": 77,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 22.0 "value": {
"value": 22.0,
"suffix": "None"
}
} }
} }
], ],
@ -127,7 +136,10 @@ expression: actual
"start": 101, "start": 101,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 14.0 "value": {
"value": 14.0,
"suffix": "None"
}
}, },
{ {
"end": 106, "end": 106,

View File

@ -32,7 +32,10 @@ expression: actual
"start": 43, "start": 43,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 360.0 "value": {
"value": 360.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {

View File

@ -21,7 +21,10 @@ expression: actual
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 80, "end": 80,
@ -29,7 +32,10 @@ expression: actual
"start": 79, "start": 79,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 91, "end": 91,

View File

@ -21,7 +21,10 @@ expression: actual
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 44, "end": 44,
@ -29,7 +32,10 @@ expression: actual
"start": 43, "start": 43,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
], ],
"end": 91, "end": 91,

View File

@ -49,7 +49,10 @@ expression: actual
"start": 29, "start": 29,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -68,7 +71,10 @@ expression: actual
"start": 68, "start": 68,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
} }
], ],

View File

@ -49,7 +49,10 @@ expression: actual
"start": 29, "start": 29,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -68,7 +71,10 @@ expression: actual
"start": 68, "start": 68,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
} }
], ],

View File

@ -21,7 +21,10 @@ expression: actual
"start": 12, "start": 12,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -32,7 +35,10 @@ expression: actual
"start": 24, "start": 24,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 28, "end": 28,
@ -40,7 +46,10 @@ expression: actual
"start": 27, "start": 27,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {

View File

@ -23,7 +23,10 @@ expression: actual
"start": 8, "start": 8,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"operator": "^", "operator": "^",
"right": { "right": {
@ -32,7 +35,10 @@ expression: actual
"start": 12, "start": 12,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 8, "start": 8,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -49,7 +55,10 @@ expression: actual
"start": 16, "start": 16,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"operator": "^", "operator": "^",
"right": { "right": {
@ -58,7 +67,10 @@ expression: actual
"start": 20, "start": 20,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 16, "start": 16,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -71,7 +83,10 @@ expression: actual
"start": 24, "start": 24,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 16, "start": 16,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -35,7 +35,10 @@ expression: actual
"start": 57, "start": 57,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 57, "start": 57,
"type": "ExpressionStatement", "type": "ExpressionStatement",
@ -56,7 +59,10 @@ expression: actual
"start": 26, "start": 26,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 26, "start": 26,
"type": "ExpressionStatement", "type": "ExpressionStatement",

View File

@ -59,7 +59,10 @@ expression: actual
"start": 73, "start": 73,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 73, "start": 73,
"type": "ExpressionStatement", "type": "ExpressionStatement",
@ -83,7 +86,10 @@ expression: actual
"start": 104, "start": 104,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"start": 104, "start": 104,
"type": "ExpressionStatement", "type": "ExpressionStatement",
@ -104,7 +110,10 @@ expression: actual
"start": 26, "start": 26,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 26, "start": 26,
"type": "ExpressionStatement", "type": "ExpressionStatement",

View File

@ -21,7 +21,10 @@ expression: actual
"start": 8, "start": 8,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"operator": "==", "operator": "==",
"right": { "right": {
@ -30,7 +33,10 @@ expression: actual
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 8, "start": 8,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -21,7 +21,10 @@ expression: actual
"start": 8, "start": 8,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"operator": "!=", "operator": "!=",
"right": { "right": {
@ -30,7 +33,10 @@ expression: actual
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 8, "start": 8,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -19,7 +19,10 @@ expression: actual
"start": 4, "start": 4,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"

View File

@ -34,7 +34,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
{ {
"end": 23, "end": 23,
@ -42,7 +45,10 @@ expression: actual
"start": 21, "start": 21,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
} }
], ],
"end": 24, "end": 24,
@ -67,7 +73,10 @@ expression: actual
"start": 34, "start": 34,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
} }
} }
], ],

View File

@ -19,7 +19,10 @@ expression: actual
"start": 4, "start": 4,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"
@ -76,7 +79,10 @@ expression: actual
"start": 28, "start": 28,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
} }
} }
], ],

View File

@ -24,7 +24,10 @@ expression: actual
"start": 20, "start": 20,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 24, "end": 24,
@ -32,7 +35,10 @@ expression: actual
"start": 23, "start": 23,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -58,7 +64,10 @@ expression: actual
"start": 27, "start": 27,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {

View File

@ -23,7 +23,10 @@ expression: actual
"start": 8, "start": 8,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"operator": "+", "operator": "+",
"right": { "right": {
@ -32,7 +35,10 @@ expression: actual
"start": 12, "start": 12,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 6.0 "value": {
"value": 6.0,
"suffix": "None"
}
}, },
"start": 8, "start": 8,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -46,7 +52,10 @@ expression: actual
"start": 24, "start": 24,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 45.0 "value": {
"value": 45.0,
"suffix": "None"
}
}, },
{ {
"end": 29, "end": 29,

View File

@ -21,7 +21,10 @@ expression: actual
"start": 8, "start": 8,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"operator": "*", "operator": "*",
"right": { "right": {
@ -32,7 +35,10 @@ expression: actual
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"operator": "-", "operator": "-",
"right": { "right": {
@ -41,7 +47,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 13, "start": 13,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -19,7 +19,10 @@ expression: actual
"start": 4, "start": 4,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 0, "start": 0,
"type": "VariableDeclarator" "type": "VariableDeclarator"

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],
@ -85,7 +91,10 @@ expression: actual
"start": 34, "start": 34,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"operator": "-", "operator": "-",
"right": { "right": {

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],
@ -85,7 +91,10 @@ expression: actual
"start": 35, "start": 35,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"operator": "-", "operator": "-",
"right": { "right": {

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],
@ -108,7 +114,10 @@ expression: actual
"start": 45, "start": 45,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 34, "start": 34,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],
@ -87,7 +93,10 @@ expression: actual
"start": 35, "start": 35,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"operator": "-", "operator": "-",
"right": { "right": {
@ -122,7 +131,10 @@ expression: actual
"start": 49, "start": 49,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 51, "end": 51,

View File

@ -1,8 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
assertion_line: 4674
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -23,7 +21,10 @@ snapshot_kind: text
"start": 6, "start": 6,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"arguments": [ "arguments": [

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -24,7 +23,10 @@ snapshot_kind: text
"start": 22, "start": 22,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"end": 23, "end": 23,
"start": 15, "start": 15,

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -24,7 +23,10 @@ snapshot_kind: text
"start": 23, "start": 23,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"end": 24, "end": 24,
"start": 16, "start": 16,

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -24,7 +23,10 @@ snapshot_kind: text
"start": 32, "start": 32,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"end": 33, "end": 33,
"start": 25, "start": 25,
@ -52,7 +54,10 @@ snapshot_kind: text
"default_value": { "default_value": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2" "raw": "2"
} }
} }

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/parsing/parser.rs source: kcl/src/parsing/parser.rs
expression: actual expression: actual
snapshot_kind: text
--- ---
{ {
"body": [ "body": [
@ -24,7 +23,10 @@ snapshot_kind: text
"start": 24, "start": 24,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"end": 25, "end": 25,
"start": 17, "start": 17,
@ -48,7 +50,10 @@ snapshot_kind: text
"default_value": { "default_value": {
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0, "value": {
"value": 2.0,
"suffix": "None"
},
"raw": "2" "raw": "2"
} }
} }

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],
@ -110,7 +116,10 @@ expression: actual
"start": 46, "start": 46,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 35, "start": 35,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -122,7 +131,10 @@ expression: actual
"start": 49, "start": 49,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 51, "end": 51,

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],
@ -110,7 +116,10 @@ expression: actual
"start": 45, "start": 45,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 35, "start": 35,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -122,7 +131,10 @@ expression: actual
"start": 48, "start": 48,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 50, "end": 50,

View File

@ -21,7 +21,10 @@ expression: actual
"start": 9, "start": 9,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"operator": "-", "operator": "-",
"right": { "right": {

View File

@ -23,7 +23,10 @@ expression: actual
"start": 6, "start": 6,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"operator": "+", "operator": "+",
"right": { "right": {
@ -32,7 +35,10 @@ expression: actual
"start": 10, "start": 10,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 6, "start": 6,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -45,7 +51,10 @@ expression: actual
"start": 14, "start": 14,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 6, "start": 6,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -23,7 +23,10 @@ expression: actual
"start": 7, "start": 7,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"operator": "*", "operator": "*",
"right": { "right": {
@ -32,7 +35,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 7, "start": 7,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -45,7 +51,10 @@ expression: actual
"start": 15, "start": 15,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 7, "start": 7,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -43,7 +43,10 @@ expression: actual
"start": 21, "start": 21,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 24, "end": 24,

View File

@ -32,7 +32,10 @@ expression: actual
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
}, },
{ {
@ -51,7 +54,10 @@ expression: actual
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
} }
], ],

View File

@ -29,7 +29,10 @@ expression: actual
"start": 9, "start": 9,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 6, "start": 6,
"type": "MemberExpression", "type": "MemberExpression",

View File

@ -46,7 +46,10 @@ expression: actual
"start": 33, "start": 33,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {

View File

@ -5,6 +5,8 @@ use std::{fmt, iter::Enumerate, num::NonZeroUsize, str::FromStr};
use anyhow::Result; use anyhow::Result;
use parse_display::Display; use parse_display::Display;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use tokeniser::Input; use tokeniser::Input;
use tower_lsp::lsp_types::SemanticTokenType; use tower_lsp::lsp_types::SemanticTokenType;
use winnow::{ use winnow::{
@ -28,7 +30,8 @@ pub(crate) use tokeniser::RESERVED_WORDS;
// Note the ordering, it's important that `m` comes after `mm` and `cm`. // Note the ordering, it's important that `m` comes after `mm` and `cm`.
pub const NUM_SUFFIXES: [&str; 9] = ["mm", "cm", "m", "inch", "in", "ft", "yd", "deg", "rad"]; pub const NUM_SUFFIXES: [&str; 9] = ["mm", "cm", "m", "inch", "in", "ft", "yd", "deg", "rad"];
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, ts_rs::TS, JsonSchema)]
#[repr(u32)]
pub enum NumericSuffix { pub enum NumericSuffix {
None, None,
Count, Count,
@ -72,6 +75,23 @@ impl FromStr for NumericSuffix {
} }
} }
impl fmt::Display for NumericSuffix {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
NumericSuffix::None => Ok(()),
NumericSuffix::Count => write!(f, "_"),
NumericSuffix::Mm => write!(f, "mm"),
NumericSuffix::Cm => write!(f, "cm"),
NumericSuffix::M => write!(f, "m"),
NumericSuffix::Inch => write!(f, "in"),
NumericSuffix::Ft => write!(f, "ft"),
NumericSuffix::Yd => write!(f, "yd"),
NumericSuffix::Deg => write!(f, "deg"),
NumericSuffix::Rad => write!(f, "rad"),
}
}
}
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub(crate) struct TokenStream { pub(crate) struct TokenStream {
tokens: Vec<Token>, tokens: Vec<Token>,

View File

@ -373,11 +373,11 @@ impl VariableDeclaration {
impl Literal { impl Literal {
fn recast(&self) -> String { fn recast(&self) -> String {
match self.value { match self.value {
LiteralValue::Number(x) => { LiteralValue::Number { value, suffix } => {
if self.raw.contains('.') && x.fract() == 0.0 { if self.raw.contains('.') && value.fract() == 0.0 {
format!("{x:?}") format!("{value:?}{suffix}")
} else { } else {
self.raw.clone() format!("{}{suffix}", self.raw)
} }
} }
LiteralValue::String(ref s) => { LiteralValue::String(ref s) => {

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/simulation_tests.rs source: kcl/src/simulation_tests.rs
description: Program memory after executing add_lots.kcl description: Program memory after executing add_lots.kcl
snapshot_kind: text
--- ---
{ {
"environments": [ "environments": [
@ -49,7 +48,10 @@ snapshot_kind: text
"start": 23, "start": 23,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 19, "start": 19,
"type": "BinaryExpression", "type": "BinaryExpression",

View File

@ -48,7 +48,10 @@ description: Result of parsing angled_line.kcl
"start": 51, "start": 51,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.83 "value": {
"value": 4.83,
"suffix": "None"
}
}, },
{ {
"end": 62, "end": 62,
@ -56,7 +59,10 @@ description: Result of parsing angled_line.kcl
"start": 57, "start": 57,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 12.56 "value": {
"value": 12.56,
"suffix": "None"
}
} }
], ],
"end": 63, "end": 63,
@ -92,7 +98,10 @@ description: Result of parsing angled_line.kcl
"start": 79, "start": 79,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 15.1 "value": {
"value": 15.1,
"suffix": "None"
}
}, },
{ {
"end": 89, "end": 89,
@ -100,7 +109,10 @@ description: Result of parsing angled_line.kcl
"start": 85, "start": 85,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.48 "value": {
"value": 2.48,
"suffix": "None"
}
} }
], ],
"end": 90, "end": 90,
@ -136,7 +148,10 @@ description: Result of parsing angled_line.kcl
"start": 106, "start": 106,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.15 "value": {
"value": 3.15,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -145,7 +160,10 @@ description: Result of parsing angled_line.kcl
"start": 113, "start": 113,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 9.85 "value": {
"value": 9.85,
"suffix": "None"
}
}, },
"end": 117, "end": 117,
"operator": "-", "operator": "-",
@ -195,7 +213,10 @@ description: Result of parsing angled_line.kcl
"start": 143, "start": 143,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 15.17 "value": {
"value": 15.17,
"suffix": "None"
}
}, },
"end": 148, "end": 148,
"operator": "-", "operator": "-",
@ -210,7 +231,10 @@ description: Result of parsing angled_line.kcl
"start": 151, "start": 151,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.1 "value": {
"value": 4.1,
"suffix": "None"
}
}, },
"end": 154, "end": 154,
"operator": "-", "operator": "-",
@ -273,7 +297,10 @@ description: Result of parsing angled_line.kcl
"start": 192, "start": 192,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 12.35 "value": {
"value": 12.35,
"suffix": "None"
}
} }
], ],
"end": 198, "end": 198,
@ -310,7 +337,10 @@ description: Result of parsing angled_line.kcl
"start": 215, "start": 215,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 13.02 "value": {
"value": 13.02,
"suffix": "None"
}
}, },
"end": 220, "end": 220,
"operator": "-", "operator": "-",
@ -324,7 +354,10 @@ description: Result of parsing angled_line.kcl
"start": 222, "start": 222,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.03 "value": {
"value": 10.03,
"suffix": "None"
}
} }
], ],
"end": 228, "end": 228,
@ -378,7 +411,10 @@ description: Result of parsing angled_line.kcl
"start": 260, "start": 260,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 264, "end": 264,

View File

@ -24,7 +24,10 @@ description: Result of parsing argument_error.kcl
"start": 19, "start": 19,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 20, "end": 20,
"start": 12, "start": 12,
@ -79,7 +82,10 @@ description: Result of parsing argument_error.kcl
"start": 32, "start": 32,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 36, "end": 36,
@ -87,7 +93,10 @@ description: Result of parsing argument_error.kcl
"start": 35, "start": 35,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 37, "end": 37,

View File

@ -22,7 +22,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 7, "start": 7,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 11, "end": 11,
@ -30,7 +33,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 10, "start": 10,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 14, "end": 14,
@ -38,7 +44,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 15, "end": 15,
@ -192,7 +201,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 107, "start": 107,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 98, "start": 98,
"type": "MemberExpression", "type": "MemberExpression",
@ -204,7 +216,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 111, "start": 111,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 121, "end": 121,
@ -212,7 +227,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 114, "start": 114,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 158, "end": 158,
@ -258,7 +276,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 181, "start": 181,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 172, "start": 172,
"type": "MemberExpression", "type": "MemberExpression",
@ -270,7 +291,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 185, "start": 185,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 195, "end": 195,
@ -278,7 +302,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 188, "start": 188,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 232, "end": 232,
@ -324,7 +351,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 255, "start": 255,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 246, "start": 246,
"type": "MemberExpression", "type": "MemberExpression",
@ -336,7 +366,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 259, "start": 259,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 269, "end": 269,
@ -344,7 +377,10 @@ description: Result of parsing array_elem_pop.kcl
"start": 262, "start": 262,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 306, "end": 306,

View File

@ -22,7 +22,10 @@ description: Result of parsing array_elem_pop_fail.kcl
"start": 7, "start": 7,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 11, "end": 11,
@ -30,7 +33,10 @@ description: Result of parsing array_elem_pop_fail.kcl
"start": 10, "start": 10,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 14, "end": 14,
@ -38,7 +44,10 @@ description: Result of parsing array_elem_pop_fail.kcl
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 15, "end": 15,
@ -119,7 +128,10 @@ description: Result of parsing array_elem_pop_fail.kcl
"start": 54, "start": 54,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 44, "start": 44,
"type": "MemberExpression", "type": "MemberExpression",

View File

@ -22,7 +22,10 @@ description: Result of parsing array_elem_push.kcl
"start": 7, "start": 7,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 11, "end": 11,
@ -30,7 +33,10 @@ description: Result of parsing array_elem_push.kcl
"start": 10, "start": 10,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 14, "end": 14,
@ -38,7 +44,10 @@ description: Result of parsing array_elem_push.kcl
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 15, "end": 15,
@ -79,7 +88,10 @@ description: Result of parsing array_elem_push.kcl
"start": 37, "start": 37,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -126,7 +138,10 @@ description: Result of parsing array_elem_push.kcl
"start": 66, "start": 66,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -169,7 +184,10 @@ description: Result of parsing array_elem_push.kcl
"start": 90, "start": 90,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 81, "start": 81,
"type": "MemberExpression", "type": "MemberExpression",
@ -181,7 +199,10 @@ description: Result of parsing array_elem_push.kcl
"start": 94, "start": 94,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 104, "end": 104,
@ -189,7 +210,10 @@ description: Result of parsing array_elem_push.kcl
"start": 97, "start": 97,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 141, "end": 141,
@ -235,7 +259,10 @@ description: Result of parsing array_elem_push.kcl
"start": 164, "start": 164,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 155, "start": 155,
"type": "MemberExpression", "type": "MemberExpression",
@ -247,7 +274,10 @@ description: Result of parsing array_elem_push.kcl
"start": 168, "start": 168,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 178, "end": 178,
@ -255,7 +285,10 @@ description: Result of parsing array_elem_push.kcl
"start": 171, "start": 171,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 215, "end": 215,
@ -301,7 +334,10 @@ description: Result of parsing array_elem_push.kcl
"start": 238, "start": 238,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 229, "start": 229,
"type": "MemberExpression", "type": "MemberExpression",
@ -313,7 +349,10 @@ description: Result of parsing array_elem_push.kcl
"start": 242, "start": 242,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 252, "end": 252,
@ -321,7 +360,10 @@ description: Result of parsing array_elem_push.kcl
"start": 245, "start": 245,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 289, "end": 289,
@ -367,7 +409,10 @@ description: Result of parsing array_elem_push.kcl
"start": 312, "start": 312,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 303, "start": 303,
"type": "MemberExpression", "type": "MemberExpression",
@ -379,7 +424,10 @@ description: Result of parsing array_elem_push.kcl
"start": 316, "start": 316,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 326, "end": 326,
@ -387,7 +435,10 @@ description: Result of parsing array_elem_push.kcl
"start": 319, "start": 319,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 365, "end": 365,
@ -433,7 +484,10 @@ description: Result of parsing array_elem_push.kcl
"start": 388, "start": 388,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 379, "start": 379,
"type": "MemberExpression", "type": "MemberExpression",
@ -445,7 +499,10 @@ description: Result of parsing array_elem_push.kcl
"start": 392, "start": 392,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 402, "end": 402,
@ -453,7 +510,10 @@ description: Result of parsing array_elem_push.kcl
"start": 395, "start": 395,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 439, "end": 439,
@ -499,7 +559,10 @@ description: Result of parsing array_elem_push.kcl
"start": 462, "start": 462,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 453, "start": 453,
"type": "MemberExpression", "type": "MemberExpression",
@ -511,7 +574,10 @@ description: Result of parsing array_elem_push.kcl
"start": 466, "start": 466,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 476, "end": 476,
@ -519,7 +585,10 @@ description: Result of parsing array_elem_push.kcl
"start": 469, "start": 469,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 513, "end": 513,
@ -565,7 +634,10 @@ description: Result of parsing array_elem_push.kcl
"start": 536, "start": 536,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 527, "start": 527,
"type": "MemberExpression", "type": "MemberExpression",
@ -577,7 +649,10 @@ description: Result of parsing array_elem_push.kcl
"start": 540, "start": 540,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 550, "end": 550,
@ -585,7 +660,10 @@ description: Result of parsing array_elem_push.kcl
"start": 543, "start": 543,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 587, "end": 587,
@ -631,7 +709,10 @@ description: Result of parsing array_elem_push.kcl
"start": 610, "start": 610,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 601, "start": 601,
"type": "MemberExpression", "type": "MemberExpression",
@ -643,7 +724,10 @@ description: Result of parsing array_elem_push.kcl
"start": 614, "start": 614,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 624, "end": 624,
@ -651,7 +735,10 @@ description: Result of parsing array_elem_push.kcl
"start": 617, "start": 617,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 663, "end": 663,
@ -697,7 +784,10 @@ description: Result of parsing array_elem_push.kcl
"start": 686, "start": 686,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 677, "start": 677,
"type": "MemberExpression", "type": "MemberExpression",
@ -709,7 +799,10 @@ description: Result of parsing array_elem_push.kcl
"start": 690, "start": 690,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 700, "end": 700,
@ -717,7 +810,10 @@ description: Result of parsing array_elem_push.kcl
"start": 693, "start": 693,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 739, "end": 739,

View File

@ -22,7 +22,10 @@ description: Result of parsing array_elem_push_fail.kcl
"start": 7, "start": 7,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 11, "end": 11,
@ -30,7 +33,10 @@ description: Result of parsing array_elem_push_fail.kcl
"start": 10, "start": 10,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 14, "end": 14,
@ -38,7 +44,10 @@ description: Result of parsing array_elem_push_fail.kcl
"start": 13, "start": 13,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 15, "end": 15,
@ -79,7 +88,10 @@ description: Result of parsing array_elem_push_fail.kcl
"start": 38, "start": 38,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -127,7 +139,10 @@ description: Result of parsing array_elem_push_fail.kcl
"start": 52, "start": 52,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 48, "start": 48,
"type": "MemberExpression", "type": "MemberExpression",

View File

@ -55,7 +55,10 @@ description: Result of parsing array_index_oob.kcl
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 13, "start": 13,
"type": "MemberExpression", "type": "MemberExpression",

View File

@ -22,7 +22,10 @@ description: Result of parsing array_range_expr.kcl
"start": 9, "start": 9,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"endInclusive": true, "endInclusive": true,
"start": 5, "start": 5,
@ -32,7 +35,10 @@ description: Result of parsing array_range_expr.kcl
"start": 6, "start": 6,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"type": "ArrayRangeExpression", "type": "ArrayRangeExpression",
"type": "ArrayRangeExpression" "type": "ArrayRangeExpression"
@ -66,7 +72,10 @@ description: Result of parsing array_range_expr.kcl
"start": 27, "start": 27,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 24, "start": 24,
"type": "MemberExpression", "type": "MemberExpression",
@ -78,7 +87,10 @@ description: Result of parsing array_range_expr.kcl
"start": 31, "start": 31,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 41, "end": 41,
@ -86,7 +98,10 @@ description: Result of parsing array_range_expr.kcl
"start": 34, "start": 34,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 69, "end": 69,
@ -127,7 +142,10 @@ description: Result of parsing array_range_expr.kcl
"start": 79, "start": 79,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 72, "start": 72,
"type": "VariableDeclarator" "type": "VariableDeclarator"
@ -153,7 +171,10 @@ description: Result of parsing array_range_expr.kcl
"start": 88, "start": 88,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 81, "start": 81,
"type": "VariableDeclarator" "type": "VariableDeclarator"
@ -223,7 +244,10 @@ description: Result of parsing array_range_expr.kcl
"start": 123, "start": 123,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 120, "start": 120,
"type": "MemberExpression", "type": "MemberExpression",
@ -235,7 +259,10 @@ description: Result of parsing array_range_expr.kcl
"start": 127, "start": 127,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 137, "end": 137,
@ -243,7 +270,10 @@ description: Result of parsing array_range_expr.kcl
"start": 130, "start": 130,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 165, "end": 165,
@ -296,7 +326,10 @@ description: Result of parsing array_range_expr.kcl
"start": 186, "start": 186,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 179, "start": 179,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -382,7 +415,10 @@ description: Result of parsing array_range_expr.kcl
"start": 222, "start": 222,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
"start": 219, "start": 219,
"type": "MemberExpression", "type": "MemberExpression",
@ -394,7 +430,10 @@ description: Result of parsing array_range_expr.kcl
"start": 226, "start": 226,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 236, "end": 236,
@ -402,7 +441,10 @@ description: Result of parsing array_range_expr.kcl
"start": 229, "start": 229,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 274, "end": 274,
@ -448,7 +490,10 @@ description: Result of parsing array_range_expr.kcl
"start": 291, "start": 291,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"start": 288, "start": 288,
"type": "MemberExpression", "type": "MemberExpression",
@ -460,7 +505,10 @@ description: Result of parsing array_range_expr.kcl
"start": 295, "start": 295,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 305, "end": 305,
@ -468,7 +516,10 @@ description: Result of parsing array_range_expr.kcl
"start": 298, "start": 298,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 333, "end": 333,
@ -523,7 +574,10 @@ description: Result of parsing array_range_expr.kcl
"start": 370, "start": 370,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 363, "start": 363,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -561,7 +615,10 @@ description: Result of parsing array_range_expr.kcl
"start": 353, "start": 353,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
"start": 346, "start": 346,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -611,7 +668,10 @@ description: Result of parsing array_range_expr.kcl
"start": 389, "start": 389,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 386, "start": 386,
"type": "MemberExpression", "type": "MemberExpression",
@ -623,7 +683,10 @@ description: Result of parsing array_range_expr.kcl
"start": 393, "start": 393,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 403, "end": 403,
@ -631,7 +694,10 @@ description: Result of parsing array_range_expr.kcl
"start": 396, "start": 396,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 425, "end": 425,
@ -677,7 +743,10 @@ description: Result of parsing array_range_expr.kcl
"start": 442, "start": 442,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"start": 439, "start": 439,
"type": "MemberExpression", "type": "MemberExpression",
@ -689,7 +758,10 @@ description: Result of parsing array_range_expr.kcl
"start": 446, "start": 446,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 456, "end": 456,
@ -697,7 +769,10 @@ description: Result of parsing array_range_expr.kcl
"start": 449, "start": 449,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 487, "end": 487,
@ -743,7 +818,10 @@ description: Result of parsing array_range_expr.kcl
"start": 504, "start": 504,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"start": 501, "start": 501,
"type": "MemberExpression", "type": "MemberExpression",
@ -755,7 +833,10 @@ description: Result of parsing array_range_expr.kcl
"start": 508, "start": 508,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 518, "end": 518,
@ -763,7 +844,10 @@ description: Result of parsing array_range_expr.kcl
"start": 511, "start": 511,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.00001 "value": {
"value": 0.00001,
"suffix": "None"
}
}, },
{ {
"end": 539, "end": 539,

View File

@ -22,7 +22,10 @@ description: Result of parsing array_range_negative_expr.kcl
"start": 17, "start": 17,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"endInclusive": true, "endInclusive": true,
"start": 5, "start": 5,
@ -35,7 +38,10 @@ description: Result of parsing array_range_negative_expr.kcl
"start": 11, "start": 11,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 12, "end": 12,
"operator": "-", "operator": "-",
@ -87,7 +93,10 @@ description: Result of parsing array_range_negative_expr.kcl
"start": 35, "start": 35,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
"start": 32, "start": 32,
"type": "MemberExpression", "type": "MemberExpression",
@ -100,7 +109,10 @@ description: Result of parsing array_range_negative_expr.kcl
"start": 40, "start": 40,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 41, "end": 41,
"operator": "-", "operator": "-",
@ -114,7 +126,10 @@ description: Result of parsing array_range_negative_expr.kcl
"start": 43, "start": 43,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.001 "value": {
"value": 0.001,
"suffix": "None"
}
}, },
{ {
"end": 71, "end": 71,

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/simulation_tests.rs source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code1.kcl description: Result of parsing artifact_graph_example_code1.kcl
snapshot_kind: text
--- ---
{ {
"Ok": { "Ok": {
@ -50,7 +49,10 @@ snapshot_kind: text
"start": 54, "start": 54,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 55, "end": 55,
"operator": "-", "operator": "-",
@ -65,7 +67,10 @@ snapshot_kind: text
"start": 58, "start": 58,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 59, "end": 59,
"operator": "-", "operator": "-",
@ -107,7 +112,10 @@ snapshot_kind: text
"start": 76, "start": 76,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 81, "end": 81,
@ -115,7 +123,10 @@ snapshot_kind: text
"start": 79, "start": 79,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
} }
], ],
"end": 82, "end": 82,
@ -151,7 +162,10 @@ snapshot_kind: text
"start": 98, "start": 98,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.55 "value": {
"value": 10.55,
"suffix": "None"
}
}, },
{ {
"end": 106, "end": 106,
@ -159,7 +173,10 @@ snapshot_kind: text
"start": 105, "start": 105,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 107, "end": 107,
@ -202,7 +219,10 @@ snapshot_kind: text
"start": 131, "start": 131,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -211,7 +231,10 @@ snapshot_kind: text
"start": 135, "start": 135,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
"end": 137, "end": 137,
"operator": "-", "operator": "-",
@ -373,7 +396,10 @@ snapshot_kind: text
"start": 240, "start": 240,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
"end": 242, "end": 242,
"operator": "-", "operator": "-",
@ -421,7 +447,10 @@ snapshot_kind: text
"start": 278, "start": 278,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
} }
}, },
{ {
@ -538,7 +567,10 @@ snapshot_kind: text
"start": 369, "start": 369,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"end": 370, "end": 370,
"operator": "-", "operator": "-",
@ -553,7 +585,10 @@ snapshot_kind: text
"start": 373, "start": 373,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 6.0 "value": {
"value": 6.0,
"suffix": "None"
}
}, },
"end": 374, "end": 374,
"operator": "-", "operator": "-",
@ -595,7 +630,10 @@ snapshot_kind: text
"start": 391, "start": 391,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 395, "end": 395,
@ -603,7 +641,10 @@ snapshot_kind: text
"start": 394, "start": 394,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
} }
], ],
"end": 396, "end": 396,
@ -639,7 +680,10 @@ snapshot_kind: text
"start": 412, "start": 412,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -648,7 +692,10 @@ snapshot_kind: text
"start": 416, "start": 416,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"end": 417, "end": 417,
"operator": "-", "operator": "-",
@ -800,7 +847,10 @@ snapshot_kind: text
"start": 511, "start": 511,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 523, "end": 523,

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/simulation_tests.rs source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code_no_3d.kcl description: Result of parsing artifact_graph_example_code_no_3d.kcl
snapshot_kind: text
--- ---
{ {
"Ok": { "Ok": {
@ -49,7 +48,10 @@ snapshot_kind: text
"start": 53, "start": 53,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.82 "value": {
"value": 5.82,
"suffix": "None"
}
}, },
{ {
"end": 60, "end": 60,
@ -57,7 +59,10 @@ snapshot_kind: text
"start": 59, "start": 59,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 61, "end": 61,
@ -93,7 +98,10 @@ snapshot_kind: text
"start": 83, "start": 83,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 180.0 "value": {
"value": 180.0,
"suffix": "None"
}
}, },
{ {
"end": 93, "end": 93,
@ -101,7 +109,10 @@ snapshot_kind: text
"start": 88, "start": 88,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 11.54 "value": {
"value": 11.54,
"suffix": "None"
}
} }
], ],
"end": 94, "end": 94,
@ -168,7 +179,10 @@ snapshot_kind: text
"start": 178, "start": 178,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 90.0 "value": {
"value": 90.0,
"suffix": "None"
}
}, },
"start": 147, "start": 147,
"type": "BinaryExpression", "type": "BinaryExpression",
@ -180,7 +194,10 @@ snapshot_kind: text
"start": 189, "start": 189,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 8.21 "value": {
"value": 8.21,
"suffix": "None"
}
} }
], ],
"end": 200, "end": 200,
@ -443,7 +460,10 @@ snapshot_kind: text
"start": 475, "start": 475,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 483, "end": 483,
@ -451,7 +471,10 @@ snapshot_kind: text
"start": 478, "start": 478,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 14.36 "value": {
"value": 14.36,
"suffix": "None"
}
} }
], ],
"end": 484, "end": 484,
@ -487,7 +510,10 @@ snapshot_kind: text
"start": 500, "start": 500,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 15.49 "value": {
"value": 15.49,
"suffix": "None"
}
}, },
{ {
"end": 511, "end": 511,
@ -495,7 +521,10 @@ snapshot_kind: text
"start": 507, "start": 507,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.05 "value": {
"value": 0.05,
"suffix": "None"
}
} }
], ],
"end": 512, "end": 512,
@ -531,7 +560,10 @@ snapshot_kind: text
"start": 539, "start": 539,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 543, "end": 543,
@ -539,7 +571,10 @@ snapshot_kind: text
"start": 542, "start": 542,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 544, "end": 544,
@ -576,7 +611,10 @@ snapshot_kind: text
"start": 572, "start": 572,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 6.8 "value": {
"value": 6.8,
"suffix": "None"
}
}, },
"end": 575, "end": 575,
"operator": "-", "operator": "-",
@ -590,7 +628,10 @@ snapshot_kind: text
"start": 577, "start": 577,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 8.17 "value": {
"value": 8.17,
"suffix": "None"
}
} }
], ],
"end": 582, "end": 582,

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/simulation_tests.rs source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code_offset_planes.kcl description: Result of parsing artifact_graph_example_code_offset_planes.kcl
snapshot_kind: text
--- ---
{ {
"Ok": { "Ok": {
@ -31,7 +30,10 @@ snapshot_kind: text
"start": 35, "start": 35,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 20.0 "value": {
"value": 20.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -80,7 +82,10 @@ snapshot_kind: text
"start": 75, "start": 75,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 50.0 "value": {
"value": 50.0,
"suffix": "None"
}
}, },
"end": 77, "end": 77,
"operator": "-", "operator": "-",
@ -134,7 +139,10 @@ snapshot_kind: text
"start": 114, "start": 114,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
} }
], ],
"callee": { "callee": {
@ -199,7 +207,10 @@ snapshot_kind: text
"start": 182, "start": 182,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 186, "end": 186,
@ -207,7 +218,10 @@ snapshot_kind: text
"start": 185, "start": 185,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 187, "end": 187,
@ -243,7 +257,10 @@ snapshot_kind: text
"start": 203, "start": 203,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 6.78 "value": {
"value": 6.78,
"suffix": "None"
}
}, },
{ {
"end": 214, "end": 214,
@ -251,7 +268,10 @@ snapshot_kind: text
"start": 209, "start": 209,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 15.01 "value": {
"value": 15.01,
"suffix": "None"
}
} }
], ],
"end": 215, "end": 215,

View File

@ -1,7 +1,6 @@
--- ---
source: kcl/src/simulation_tests.rs source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_sketch_on_face_etc.kcl description: Result of parsing artifact_graph_sketch_on_face_etc.kcl
snapshot_kind: text
--- ---
{ {
"Ok": { "Ok": {
@ -49,7 +48,10 @@ snapshot_kind: text
"start": 53, "start": 53,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 57, "end": 57,
@ -57,7 +59,10 @@ snapshot_kind: text
"start": 56, "start": 56,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 58, "end": 58,
@ -93,7 +98,10 @@ snapshot_kind: text
"start": 74, "start": 74,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 78, "end": 78,
@ -101,7 +109,10 @@ snapshot_kind: text
"start": 77, "start": 77,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 8.0 "value": {
"value": 8.0,
"suffix": "None"
}
} }
], ],
"end": 79, "end": 79,
@ -137,7 +148,10 @@ snapshot_kind: text
"start": 95, "start": 95,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -146,7 +160,10 @@ snapshot_kind: text
"start": 99, "start": 99,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 8.0 "value": {
"value": 8.0,
"suffix": "None"
}
}, },
"end": 100, "end": 100,
"operator": "-", "operator": "-",
@ -305,7 +322,10 @@ snapshot_kind: text
"start": 202, "start": 202,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 6.0 "value": {
"value": 6.0,
"suffix": "None"
}
}, },
{ {
"end": 214, "end": 214,
@ -385,7 +405,10 @@ snapshot_kind: text
"start": 283, "start": 283,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.5 "value": {
"value": 0.5,
"suffix": "None"
}
}, },
"end": 286, "end": 286,
"operator": "-", "operator": "-",
@ -399,7 +422,10 @@ snapshot_kind: text
"start": 288, "start": 288,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.5 "value": {
"value": 0.5,
"suffix": "None"
}
} }
], ],
"end": 292, "end": 292,
@ -435,7 +461,10 @@ snapshot_kind: text
"start": 308, "start": 308,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"end": 312, "end": 312,
@ -443,7 +472,10 @@ snapshot_kind: text
"start": 311, "start": 311,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
} }
], ],
"end": 313, "end": 313,
@ -479,7 +511,10 @@ snapshot_kind: text
"start": 329, "start": 329,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -488,7 +523,10 @@ snapshot_kind: text
"start": 333, "start": 333,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
"end": 334, "end": 334,
"operator": "-", "operator": "-",
@ -640,7 +678,10 @@ snapshot_kind: text
"start": 428, "start": 428,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5.0 "value": {
"value": 5.0,
"suffix": "None"
}
}, },
{ {
"end": 440, "end": 440,
@ -720,7 +761,10 @@ snapshot_kind: text
"start": 508, "start": 508,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"end": 514, "end": 514,
@ -728,7 +772,10 @@ snapshot_kind: text
"start": 511, "start": 511,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.5 "value": {
"value": 1.5,
"suffix": "None"
}
} }
], ],
"end": 515, "end": 515,
@ -764,7 +811,10 @@ snapshot_kind: text
"start": 531, "start": 531,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.5 "value": {
"value": 0.5,
"suffix": "None"
}
}, },
{ {
"end": 537, "end": 537,
@ -772,7 +822,10 @@ snapshot_kind: text
"start": 536, "start": 536,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
], ],
"end": 538, "end": 538,
@ -815,7 +868,10 @@ snapshot_kind: text
"start": 562, "start": 562,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -824,7 +880,10 @@ snapshot_kind: text
"start": 566, "start": 566,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"end": 567, "end": 567,
"operator": "-", "operator": "-",
@ -976,7 +1035,10 @@ snapshot_kind: text
"start": 661, "start": 661,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 4.0 "value": {
"value": 4.0,
"suffix": "None"
}
}, },
{ {
"end": 673, "end": 673,
@ -1056,7 +1118,10 @@ snapshot_kind: text
"start": 742, "start": 742,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
"end": 743, "end": 743,
"operator": "-", "operator": "-",
@ -1070,7 +1135,10 @@ snapshot_kind: text
"start": 745, "start": 745,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 14.0 "value": {
"value": 14.0,
"suffix": "None"
}
} }
], ],
"end": 748, "end": 748,
@ -1106,7 +1174,10 @@ snapshot_kind: text
"start": 764, "start": 764,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.5 "value": {
"value": 0.5,
"suffix": "None"
}
}, },
{ {
"end": 770, "end": 770,
@ -1114,7 +1185,10 @@ snapshot_kind: text
"start": 769, "start": 769,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1.0 "value": {
"value": 1.0,
"suffix": "None"
}
} }
], ],
"end": 771, "end": 771,
@ -1150,7 +1224,10 @@ snapshot_kind: text
"start": 787, "start": 787,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.5 "value": {
"value": 0.5,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -1159,7 +1236,10 @@ snapshot_kind: text
"start": 793, "start": 793,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
}, },
"end": 794, "end": 794,
"operator": "-", "operator": "-",
@ -1311,7 +1391,10 @@ snapshot_kind: text
"start": 888, "start": 888,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 3.0 "value": {
"value": 3.0,
"suffix": "None"
}
}, },
{ {
"end": 900, "end": 900,

View File

@ -48,7 +48,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 51, "start": 51,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 55, "end": 55,
@ -56,7 +59,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 54, "start": 54,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 56, "end": 56,
@ -92,7 +98,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 72, "start": 72,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 77, "end": 77,
@ -100,7 +109,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 75, "start": 75,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
} }
], ],
"end": 78, "end": 78,
@ -143,7 +155,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 102, "start": 102,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
{ {
"end": 107, "end": 107,
@ -151,7 +166,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 106, "start": 106,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 108, "end": 108,
@ -187,7 +205,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 124, "start": 124,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -196,7 +217,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 128, "start": 128,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
"end": 130, "end": 130,
"operator": "-", "operator": "-",
@ -270,7 +294,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 181, "start": 181,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
{ {
"end": 186, "end": 186,
@ -311,7 +338,10 @@ description: Result of parsing basic_fillet_cube_close_opposite.kcl
"start": 218, "start": 218,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
}, },
{ {

View File

@ -48,7 +48,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 51, "start": 51,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 55, "end": 55,
@ -56,7 +59,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 54, "start": 54,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 56, "end": 56,
@ -92,7 +98,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 72, "start": 72,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"end": 77, "end": 77,
@ -100,7 +109,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 75, "start": 75,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
} }
], ],
"end": 78, "end": 78,
@ -143,7 +155,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 102, "start": 102,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
{ {
"end": 107, "end": 107,
@ -151,7 +166,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 106, "start": 106,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
} }
], ],
"end": 108, "end": 108,
@ -187,7 +205,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 124, "start": 124,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0.0 "value": {
"value": 0.0,
"suffix": "None"
}
}, },
{ {
"argument": { "argument": {
@ -196,7 +217,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 128, "start": 128,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
"end": 130, "end": 130,
"operator": "-", "operator": "-",
@ -263,7 +287,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 172, "start": 172,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10.0 "value": {
"value": 10.0,
"suffix": "None"
}
}, },
{ {
"end": 177, "end": 177,
@ -304,7 +331,10 @@ description: Result of parsing basic_fillet_cube_end.kcl
"start": 209, "start": 209,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2.0 "value": {
"value": 2.0,
"suffix": "None"
}
} }
}, },
{ {

Some files were not shown because too many files have changed in this diff Show More