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])
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[1].value = points[0].y
arg0[1].value = { value: points[0].y, suffix: 'None' }
arg0[1].raw = points[0].y.toString()
const arg1 = arg(kclCircle3PointArgs[1])
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[1].value = points[1].y
arg1[1].value = { value: points[1].y, suffix: 'None' }
arg1[1].raw = points[1].y.toString()
const arg2 = arg(kclCircle3PointArgs[2])
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[1].value = points[2].y
arg2[1].value = { value: points[2].y, suffix: 'None' }
arg2[1].raw = points[2].y.toString()
const astSnapshot = structuredClone(kclManager.ast)

View File

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

View File

@ -39,7 +39,7 @@ describe('Testing createLiteral', () => {
it('should create a literal', () => {
const result = createLiteral(5)
expect(result.type).toBe('Literal')
expect(result.value).toBe(5)
expect((result as any).value.value).toBe(5)
})
})
describe('Testing createIdentifier', () => {
@ -56,7 +56,7 @@ describe('Testing createCallExpression', () => {
expect(result.callee.type).toBe('Identifier')
expect(result.callee.name).toBe('myFunc')
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', () => {
@ -68,7 +68,7 @@ describe('Testing createObjectExpression', () => {
expect(result.properties[0].type).toBe('ObjectProperty')
expect(result.properties[0].key.name).toBe('myProp')
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', () => {
@ -76,7 +76,7 @@ describe('Testing createArrayExpression', () => {
const result = createArrayExpression([createLiteral(5)])
expect(result.type).toBe('ArrayExpression')
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', () => {
@ -93,7 +93,7 @@ describe('Testing createVariableDeclaration', () => {
expect(result.declaration.id.type).toBe('Identifier')
expect(result.declaration.id.name).toBe('myVar')
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', () => {
@ -101,7 +101,7 @@ describe('Testing createPipeExpression', () => {
const result = createPipeExpression([createLiteral(5)])
expect(result.type).toBe('PipeExpression')
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))
}
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 {
type: 'Literal',
start: 0,
end: 0,
moduleId: 0,
value,
raw: `${value}`,
raw,
}
}

View File

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

View File

@ -717,16 +717,6 @@ function isTypeInArrayExp(
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(
ast: Program,
artifactGraph: ArtifactGraph,

View File

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

View File

@ -929,13 +929,13 @@ impl Property {
LiteralIdentifier::Literal(literal) => {
let value = literal.value.clone();
match value {
LiteralValue::Number(x) => {
if let Some(x) = crate::try_f64_to_usize(x) {
LiteralValue::Number { value, .. } => {
if let Some(x) = crate::try_f64_to_usize(value) {
Ok(Property::UInt(x))
} else {
Err(KclError::Semantic(KclErrorDetails {
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 {
match literal {
LiteralValue::Number(value) => KclValue::Number { value, meta },
LiteralValue::Number { value, .. } => KclValue::Number { value, meta },
LiteralValue::String(value) => KclValue::String { 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> {
Some(match lit {
LiteralValue::Number(value) => *value,
LiteralValue::Number { value, .. } => *value,
_ => {
return None;
}

View File

@ -1,6 +1,6 @@
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::{
ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryPart, BodyItem, CallExpression, CallExpressionKw,
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 {
compute_digest!(|slf, hasher| {
let name = slf.name.as_bytes();

View File

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

View File

@ -1,31 +1,49 @@
use std::fmt;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value as JValue;
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)]
#[ts(export)]
#[serde(untagged, rename_all = "snake_case")]
pub enum LiteralValue {
Number(f64),
Number { value: f64, suffix: NumericSuffix },
String(String),
Bool(bool),
}
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 {
LiteralValue::Number(frac) => frac.to_ne_bytes().into(),
LiteralValue::String(st) => st.as_bytes().into(),
LiteralValue::Bool(b) => {
if *b {
vec![1]
LiteralValue::Number { value, suffix } => {
let int_value = *value as u64;
if int_value as f64 == *value {
write!(f, "{int_value}")?;
} 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 {
fn from(value: String) -> Self {
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 {
fn from(value: &'static str) -> Self {
// TODO: Make this Cow<str>

View File

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

View File

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

View File

@ -483,7 +483,7 @@ pub(crate) fn unsigned_number_literal(i: &mut TokenSlice) -> PResult<Node<Litera
let (value, token) = any
.try_map(|token: Token| match token.token_type {
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))
})?;
@ -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")),
})
@ -2857,7 +2863,10 @@ mySk1 = startSketchAt([0, 0])"#;
ReturnStatement {
argument: Expr::Literal(Box::new(Node::new(
Literal {
value: 2u32.into(),
value: LiteralValue::Number {
value: 2.0,
suffix: NumericSuffix::None
},
raw: "2".to_owned(),
digest: None,
},
@ -3058,7 +3067,15 @@ mySk1 = startSketchAt([0, 0])"#;
match &rhs.right {
BinaryPart::Literal(lit) => {
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!(),
}
@ -3129,11 +3146,23 @@ mySk1 = startSketchAt([0, 0])"#;
let BinaryPart::Literal(left) = actual.inner.left else {
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 {
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,
left: BinaryPart::Literal(Box::new(Node::new(
Literal {
value: 5u32.into(),
value: LiteralValue::Number {
value: 5.0,
suffix: NumericSuffix::None,
},
raw: "5".to_owned(),
digest: None,
},
@ -3499,7 +3531,10 @@ mySk1 = startSketchAt([0, 0])"#;
BinaryExpression {
left: BinaryPart::Literal(Box::new(Node::new(
Literal {
value: 5u32.into(),
value: LiteralValue::Number {
value: 5.0,
suffix: NumericSuffix::None,
},
raw: "5".to_string(),
digest: None,
},
@ -3510,7 +3545,10 @@ mySk1 = startSketchAt([0, 0])"#;
operator: BinaryOperator::Add,
right: BinaryPart::Literal(Box::new(Node::new(
Literal {
value: 6u32.into(),
value: LiteralValue::Number {
value: 6.0,
suffix: NumericSuffix::None,
},
raw: "6".to_string(),
digest: None,
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,8 @@ use std::{fmt, iter::Enumerate, num::NonZeroUsize, str::FromStr};
use anyhow::Result;
use parse_display::Display;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use tokeniser::Input;
use tower_lsp::lsp_types::SemanticTokenType;
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`.
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 {
None,
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)]
pub(crate) struct TokenStream {
tokens: Vec<Token>,

View File

@ -373,11 +373,11 @@ impl VariableDeclaration {
impl Literal {
fn recast(&self) -> String {
match self.value {
LiteralValue::Number(x) => {
if self.raw.contains('.') && x.fract() == 0.0 {
format!("{x:?}")
LiteralValue::Number { value, suffix } => {
if self.raw.contains('.') && value.fract() == 0.0 {
format!("{value:?}{suffix}")
} else {
self.raw.clone()
format!("{}{suffix}", self.raw)
}
}
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
description: Program memory after executing add_lots.kcl
snapshot_kind: text
---
{
"environments": [
@ -49,7 +48,10 @@ snapshot_kind: text
"start": 23,
"type": "Literal",
"type": "Literal",
"value": 2.0
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 19,
"type": "BinaryExpression",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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